check if weather is configured

pull/1/head
Thomas Ballmann 3 years ago
parent 1ad74f7664
commit e8283b4af0

@ -19,9 +19,14 @@ unsigned long lastWeatherDataUpdate = 0;
void render_current();
void render_forecast();
bool readWeatherData();
bool isFaceWeatherSetupCompleted();
void setupFaceWeather()
{
if (!isFaceWeatherSetupCompleted()) {
Serial.println("weather not configured");
}
readWeatherData();
lastWeatherDataUpdate = millis();
}
@ -52,6 +57,11 @@ void playlistFaceWeather()
displayFlush();
}
bool isFaceWeatherSetupCompleted()
{
return !(NVS.getString("weather.api").isEmpty() || NVS.getString("weather.lang").isEmpty() || NVS.getString("weather.lang").isEmpty());
}
void render_current()
{
GFXcanvas1 *canvas = displayGetCanvas();
@ -199,11 +209,14 @@ bool downloadWeatherData()
*/
bool updateWeatherData()
{
if (downloadWeatherData())
if (isFaceWeatherSetupCompleted())
{
readWeatherData();
if (downloadWeatherData())
{
readWeatherData();
return true;
return true;
}
}
return false;

Loading…
Cancel
Save