lcd4l/weather: fix creation of data files for first run

Origin commit data
------------------
Branch: ni/coolstream
Commit: ae4338d710
Author: vanhofen <vanhofen@gmx.de>
Date: 2019-03-20 (Wed, 20 Mar 2019)

Origin message was:
------------------
- lcd4l/weather: fix creation of data files for first run

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2019-03-20 15:27:15 +01:00
parent 56c2f4b7f1
commit 63b3f21d98
4 changed files with 10 additions and 10 deletions

View File

@@ -1016,7 +1016,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun)
strcpy(m_Duration, Duration); strcpy(m_Duration, Duration);
} }
if (g_settings.weather_enabled && CWeather::getInstance()->checkUpdate()) if (g_settings.weather_enabled && CWeather::getInstance()->checkUpdate(firstRun))
{ {
std::string wtemp = CWeather::getInstance()->getActTemp(); std::string wtemp = CWeather::getInstance()->getActTemp();
std::string wicon = CWeather::getInstance()->getActIcon(); std::string wicon = CWeather::getInstance()->getActIcon();

View File

@@ -79,10 +79,10 @@ void CWeather::setCoords(std::string new_coords, std::string new_city)
} }
} }
bool CWeather::checkUpdate() bool CWeather::checkUpdate(bool forceUpdate)
{ {
time_t current_time = time(NULL); time_t current_time = time(NULL);
if (difftime(current_time,last_time) > MINUTES) if (forceUpdate || (difftime(current_time,last_time) > MINUTES))
return GetWeatherDetails(); return GetWeatherDetails();
else else
return false; return false;

View File

@@ -61,7 +61,7 @@ public:
static CWeather* getInstance(); static CWeather* getInstance();
CWeather(); CWeather();
~CWeather(); ~CWeather();
bool checkUpdate(); bool checkUpdate(bool forceUpdate = false);
void setCoords(std::string new_coords, std::string new_city = "Unknown"); void setCoords(std::string new_coords, std::string new_city = "Unknown");
void show(int x = 50, int y = 50); void show(int x = 50, int y = 50);
void hide(); void hide();