panbachi / wordclock

DIY WordClock
https://www.panbachi.de/eigene-word-clock-bauen/
MIT License
108 stars 47 forks source link

fix: auto timezone: handle if timezone server is not reachable #10

Closed ibrot closed 3 years ago

ibrot commented 3 years ago

In case the timezone server is not reachable we use know the last known timezone instead of falling back to timezone +/-0.

When the we receive a answer from timezone server, it will be checked if the timezone has changed. Only iff the timezone has changed the new value will be stored in the config.

SehlingS commented 3 years ago

I have test your modifyed files. But now the "Zeitzone" is the complete time at 0 but i need +1 for germany. No jumping but wrong the hole time. Do you have any idea? br Sascha

Edit: Now it is at +1. I will double check it and come back to you tomorrow.

I will test some other ntp server like ntp.uni-regensburg.de.

SehlingS commented 3 years ago

Hello again, it does not work for me. Attached the output of the seriell console in Arduino.

14:10:11.462 -> Load config. 14:10:11.462 -> WM: [1] AutoConnect 14:10:11.462 -> WM: [2] Connecting as wifi client... 14:10:11.462 -> WM: [3] STA static IP: 14:10:11.462 -> WM: [2] setSTAConfig static ip not set, skipping 14:10:11.462 -> WM: [1] Connecting to SAVED AP: XXXX 14:10:11.462 -> WM: [3] Using Password: XXXX 14:10:11.462 -> WM: [3] WiFi station enable 14:10:11.462 -> WM: [3] enableSTA PERSISTENT ON 14:10:11.462 -> WM: [1] connectTimeout not set, ESP waitForConnectResult... 14:10:13.367 -> WM: [2] Connection result: WL_CONNECTED 14:10:13.414 -> WM: [3] lastconxresult: WL_CONNECTED 14:10:13.414 -> WM: [1] AutoConnect: SUCCESS 14:10:13.414 -> WM: [1] STA IP Address: 192.168.178.223 14:10:13.414 -> WM: [3] unloading 14:10:16.505 -> Old timezone: 0 14:10:16.505 -> New timezone: 3600 14:10:16.505 -> Save config. 14:10:24.924 -> 14:10:24.924 -> ets Jan 8 2013,rst cause:4, boot mode:(3,6) 14:10:24.924 -> 14:10:24.924 -> wdt reset 14:10:24.924 -> load 0x4010f000, len 3584, room 16 14:10:24.924 -> tail 0 14:10:24.924 -> chksum 0xb0 14:10:24.924 -> csum 0xb0 14:10:24.924 -> v5d3af165 14:10:24.924 -> ~ld 14:10:24.971 -> 14:10:25.025 -> Load config. 14:10:25.072 -> WM: [1] AutoConnect 14:10:25.072 -> WM: [2] Connecting as wifi client... 14:10:25.072 -> WM: [3] STA static IP: 14:10:25.072 -> WM: [2] setSTAConfig static ip not set, skipping 14:10:25.072 -> WM: [1] Connecting to SAVED AP: XXXX 14:10:25.072 -> WM: [3] Using Password: XXXX 14:10:25.072 -> WM: [3] WiFi station enable 14:10:25.072 -> WM: [3] enableSTA PERSISTENT ON 14:10:25.072 -> WM: [1] connectTimeout not set, ESP waitForConnectResult... 14:10:26.976 -> WM: [2] Connection result: WL_CONNECTED 14:10:26.976 -> WM: [3] lastconxresult: WL_CONNECTED 14:10:26.976 -> WM: [1] AutoConnect: SUCCESS 14:10:27.030 -> WM: [1] STA IP Address: 192.168.178.223 14:10:27.030 -> WM: [3] unloading 14:10:27.177 -> Old timezone: 3600 14:10:27.177 -> New timezone: 0 14:10:27.177 -> Save config. 14:11:03.166 -> Old timezone: 0 14:11:03.166 -> New timezone: 3600 14:11:03.166 -> Save config. 14:13:01.123 -> Old timezone: 3600 14:13:01.123 -> New timezone: 0 14:13:01.123 -> Save config. 14:16:03.484 -> Old timezone: 0 14:16:03.484 -> New timezone: 3600 14:16:03.484 -> Save config.

And that is the output if the original version: 14:19:46.190 -> Load config. 14:19:46.244 -> WM: [1] AutoConnect 14:19:46.244 -> WM: [2] Connecting as wifi client... 14:19:46.244 -> WM: [3] STA static IP: 14:19:46.244 -> WM: [2] setSTAConfig static ip not set, skipping 14:19:46.244 -> WM: [1] Connecting to SAVED AP: XXX 14:19:46.244 -> WM: [3] Using Password: XXX 14:19:46.244 -> WM: [3] WiFi station enable 14:19:46.244 -> WM: [3] enableSTA PERSISTENT ON 14:19:46.244 -> WM: [1] connectTimeout not set, ESP waitForConnectResult... 14:19:48.149 -> WM: [2] Connection result: WL_CONNECTED 14:19:48.149 -> WM: [3] lastconxresult: WL_CONNECTED 14:19:48.149 -> WM: [1] AutoConnect: SUCCESS 14:19:48.149 -> WM: [1] STA IP Address: 192.168.178.223 14:19:48.189 -> WM: [3] unloading 14:19:48.249 -> 13 14:20:01.730 -> 14 14:21:02.396 -> 13 14:22:01.719 -> 14 14:23:03.693 -> 14 14:24:01.883 -> 14 14:25:01.758 -> 14 14:26:00.611 -> 14 14:27:01.059 -> 14

ibrot commented 3 years ago

Hi, I checked my local repo and found changes I haven't pushed.

Could you check if it works for you with the update?

SehlingS commented 3 years ago

i think now it looks better and ==200 makes more sense than greater than 0.

napsio commented 3 years ago

I've merged it to the master branch. And yes, ==200 makes more sense than 0 :)