check if weather is configured

pull/1/head
Thomas Ballmann 4 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();
@ -198,6 +208,8 @@ bool downloadWeatherData()
* download and update weather data
*/
bool updateWeatherData()
{
if (isFaceWeatherSetupCompleted())
{
if (downloadWeatherData())
{
@ -205,6 +217,7 @@ bool updateWeatherData()
return true;
}
}
return false;
}

Loading…
Cancel
Save