From c05e42f56371e79faf2a76c5961854d7ebf2e337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20R=2E=20Weimar?= Date: Tue, 12 Feb 2019 11:22:46 +0100 Subject: [PATCH 1/2] Changed ws2812 clock to local time instead of UTC --- sonoff/xplg_ws2812.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sonoff/xplg_ws2812.ino b/sonoff/xplg_ws2812.ino index ab4ba1c35..e7eb16dd8 100644 --- a/sonoff/xplg_ws2812.ino +++ b/sonoff/xplg_ws2812.ino @@ -170,7 +170,8 @@ void Ws2812Clock(void) Ws2812UpdateHand((RtcTime.second * 1000) / clksize, WS_SECOND); Ws2812UpdateHand((RtcTime.minute * 1000) / clksize, WS_MINUTE); - Ws2812UpdateHand(((RtcTime.hour % 12) * (5000 / clksize)) + ((RtcTime.minute * 1000) / (12 * clksize)), WS_HOUR); + uint32_t local_hour = (LocalTime()/3600)%12; // RtcTime.hour is UTC timezone, not local. + Ws2812UpdateHand(((local_hour % 12) * (5000 / clksize)) + ((RtcTime.minute * 1000) / (12 * clksize)), WS_HOUR); if (Settings.ws_color[WS_MARKER][WS_RED] + Settings.ws_color[WS_MARKER][WS_GREEN] + Settings.ws_color[WS_MARKER][WS_BLUE]) { for (uint8_t i = 0; i < 12; i++) { Ws2812UpdateHand((i * 5000) / clksize, WS_MARKER); From e8df8c4fa6c1e74156746bdb05c64eda7fbbca5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20R=2E=20Weimar?= Date: Tue, 12 Feb 2019 15:28:45 +0100 Subject: [PATCH 2/2] corrected sliding hour rounding for pixels < 60 --- sonoff/xplg_ws2812.ino | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sonoff/xplg_ws2812.ino b/sonoff/xplg_ws2812.ino index e7eb16dd8..5fdc68f82 100644 --- a/sonoff/xplg_ws2812.ino +++ b/sonoff/xplg_ws2812.ino @@ -170,8 +170,7 @@ void Ws2812Clock(void) Ws2812UpdateHand((RtcTime.second * 1000) / clksize, WS_SECOND); Ws2812UpdateHand((RtcTime.minute * 1000) / clksize, WS_MINUTE); - uint32_t local_hour = (LocalTime()/3600)%12; // RtcTime.hour is UTC timezone, not local. - Ws2812UpdateHand(((local_hour % 12) * (5000 / clksize)) + ((RtcTime.minute * 1000) / (12 * clksize)), WS_HOUR); + Ws2812UpdateHand((((RtcTime.hour % 12) * 5000) + ((RtcTime.minute * 1000) / 12 )) / clksize, WS_HOUR); if (Settings.ws_color[WS_MARKER][WS_RED] + Settings.ws_color[WS_MARKER][WS_GREEN] + Settings.ws_color[WS_MARKER][WS_BLUE]) { for (uint8_t i = 0; i < 12; i++) { Ws2812UpdateHand((i * 5000) / clksize, WS_MARKER);