fix: date timezone + weather periodic refresh (closes #5, #7)

- Use localTime instead of epochTime when formatting date string,
  so date rolls over at local midnight, not UTC midnight (fixes #5)
- Remove WEATHER_SUCCESS state assignment that blocked periodic refresh;
  state correctly stays WEATHER_IDLE after successful fetch (fixes #7)
- Fix weather debug page "Last update" to show elapsed seconds
  (millis() - lastUpdate) instead of raw timestamp

Applied from PR #6 by @Mysteoa with a compilation fix in web_server.cpp
(missing closing parenthesis in snprintf_P call).

Co-authored-by: Mysteoa <mysteoa@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alex Petrochenko
2026-05-14 17:20:08 +01:00
co-authored by Mysteoa Claude Sonnet 4.6
parent 9c0f269ee5
commit 441c61676b
4 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -166,7 +166,7 @@ void ICACHE_FLASH_ATTR handleDebug() {
if (weather.valid) {
snprintf_P(buf, sizeof(buf), PSTR("Temperature: %.1f C\nWeather code: %d\nWind speed: %.1f km/h\nLast update: %lu sec ago\n"),
weather.temperature, weather.weathercode, weather.windspeed, weather.lastUpdate/1000);
weather.temperature, weather.weathercode, weather.windspeed, (millis() - weather.lastUpdate)/1000);
server.sendContent(buf);
}