move missing settings to config

pull/1/head
Thomas Ballmann 3 years ago
parent abfbb31b5b
commit 2fd51c80ea

@ -3,6 +3,8 @@
#include "app.h"
#include "ESPAsyncWebServer.h"
#include <ESPmDNS.h>
#define ARDUINOJSON_DECODE_UNICODE 1
#define ARDUINOJSON_USE_LONG_LONG 1
#include "ArduinoJson.h"
#include "settings.h"
#include "device.h"
@ -180,14 +182,12 @@ void setupApiSettings()
root["system"]["dst"] = NVS.getInt("system.dst");
root["system"]["wifi"] = NVS.getString("wifi.ssid");
// gmtOffset_sec
// daylightOffset_sec
//root["device"]["angle"] = NVS.getInt("device.angle");
root["device"]["theme"] = NVS.getString("device.theme");
root["device"]["name"] = NVS.getString("device.name");
root["playlist"]["timer"] = NVS.getInt("playlist.timer");
root["playlist"]["images"] = NVS.getString("playlist.images");
root["weather"]["api"] = NVS.getString("weather.api");
root["weather"]["location"] = NVS.getInt("weather.loc");
@ -234,6 +234,7 @@ void setupApiSettings()
JsonVariant playlist = doc["playlist"];
if (!playlist.isNull()) {
NVS.setInt("playlist.timer", playlist["timer"].as<unsigned int>());
NVS.setString("playlist.images", playlist["images"]);
}
JsonVariant weather = doc["weather"];

@ -2,13 +2,11 @@
#include <time.h>
#include <sys/time.h>
#include "datetime.h"
#include "settings.h"
RTC_DATA_ATTR struct datetime_struct now;
// TODO offset
const char *ntpServer = "pool.ntp.org";
const long gmtOffset_sec = 3600;
const int daylightOffset_sec = 3600;
unsigned long lastUpdate = 0;
@ -54,6 +52,9 @@ bool updateDateTime()
void setupDateTime()
{
int gmtOffset_sec = NVS.getInt("system.utc");
int daylightOffset_sec = NVS.getInt("system.dst");
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
if (!updateDateTime())

@ -65,6 +65,15 @@ void showFaceCalendar()
*/
bool updateCalendarData()
{
String url = NVS.getString("service.image");
// TODO
if (url) {
url += "390x384.jpg"
}
// url += "APPID=" + NVS.getString("service.image");
// char faceCalendarPictureUrl[] = NVS.getString("service.image");
return downloadFile(faceCalendarPictureUrl, faceCalendarPicture);
}

@ -160,7 +160,6 @@ void render_forecast()
}
}
// @todo load params from settings
// @see https://openweathermap.org/appid#work
// @note no more than one time every 10 minutes for one location
bool downloadWeatherData()

Loading…
Cancel
Save