diff --git a/lib/app/app.cpp b/lib/app/app.cpp index 2823f46..308bd29 100644 --- a/lib/app/app.cpp +++ b/lib/app/app.cpp @@ -20,7 +20,7 @@ AsyncWebServer server(80); struct AppConfig { - char buildRev[40 +1]; + char buildRev[40 + 1]; uint32_t buildTime; }; @@ -100,7 +100,7 @@ void setupApp() // TODO response server.on("/stats", HTTP_GET, [](AsyncWebServerRequest *request) { AsyncResponseStream *response = request->beginResponseStream("application/json"); - const size_t capacity = 5*JSON_OBJECT_SIZE(2) + JSON_OBJECT_SIZE(3) + JSON_OBJECT_SIZE(5) + JSON_OBJECT_SIZE(7) + JSON_OBJECT_SIZE(8) + 410; + const size_t capacity = 5 * JSON_OBJECT_SIZE(2) + JSON_OBJECT_SIZE(3) + JSON_OBJECT_SIZE(5) + JSON_OBJECT_SIZE(7) + JSON_OBJECT_SIZE(8) + 410; DynamicJsonDocument doc(capacity); doc["wifi"]["mac"] = WiFi.macAddress(); @@ -207,10 +207,6 @@ void setupApiSettings() root["weather"]["lang"] = NVS.getString("weather.lang"); root["weather"]["unit"] = NVS.getString("weather.unit"); - //root["cloud"]["mode"] = NVS.getString("cloud.mode"); - //root["cloud"]["url"] = NVS.getString("cloud.url"); - //root["cloud"]["token"] = NVS.getString("cloud.token"); - serializeJson(root, *response); request->send(response); }); @@ -258,11 +254,6 @@ void setupApiSettings() NVS.setString("weather.lang", weather["lang"]); NVS.setString("weather.unit", weather["unit"]); } -/* - NVS.setString("cloud.mode", doc["cloud"]["mode"]); - NVS.setString("cloud.url", doc["cloud"]["url"]); - NVS.setString("cloud.token", doc["cloud"]["token"]); - */ NVS.commit(); diff --git a/lib/datetime/datetime.cpp b/lib/datetime/datetime.cpp index f0b7d2b..94e7395 100644 --- a/lib/datetime/datetime.cpp +++ b/lib/datetime/datetime.cpp @@ -7,7 +7,6 @@ RTC_DATA_ATTR struct datetime_struct now; const char *ntpServer = "pool.ntp.org"; - unsigned long lastUpdate = 0; int getNumberOfDays(int month, int year) @@ -29,7 +28,6 @@ int getNumberOfDays(int month, int year) bool updateDateTime() { - //configTime(gmtOffset_sec, daylightOffset_sec, ntpServer); if (!getLocalTime(&now)) { Serial.println("Failed to obtain time"); @@ -52,11 +50,12 @@ bool updateDateTime() void setupDateTime() { + // config time int gmtOffset_sec = NVS.getInt("system.utc"); int daylightOffset_sec = NVS.getInt("system.dst"); - configTime(gmtOffset_sec, daylightOffset_sec, ntpServer); + // get current time if (!updateDateTime()) { // re-try