From 7f6a554e1b36d5d11e3e331ec0903dd23cc2749f Mon Sep 17 00:00:00 2001 From: cschwinne Date: Wed, 21 Apr 2021 17:21:55 +0200 Subject: [PATCH] Small adjustments --- CHANGELOG.md | 6 ++++++ wled00/FX.cpp | 2 +- wled00/json.cpp | 14 ++++++++++++-- wled00/wled.h | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59a4bad1..6172e26d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ### Builds after release 0.12.0 +#### Build 2104210 + +- Added `tb` to JSON state, allowing setting the timebase (set tb=0 to start e.g. wipe effect from the beginning). Receive only. +- Slightly raised Solid mode refresh rate to work with LEDs (TM1814) that require refresh rates of at least 2fps +- Added sunrise and sunset calculation to the backup JSON time source + #### Build 2104151 - `NUM_STRIPS` no longer required with compile-time strip defaults diff --git a/wled00/FX.cpp b/wled00/FX.cpp index d64e6f80..0e60f9e9 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -35,7 +35,7 @@ */ uint16_t WS2812FX::mode_static(void) { fill(SEGCOLOR(0)); - return (SEGMENT.getOption(SEG_OPTION_TRANSITIONAL)) ? FRAMETIME : 500; //update faster if in transition + return (SEGMENT.getOption(SEG_OPTION_TRANSITIONAL)) ? FRAMETIME : 380; //update faster if in transition } diff --git a/wled00/json.cpp b/wled00/json.cpp index 1ff090c2..ffb2714c 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -182,6 +182,9 @@ bool deserializeState(JsonObject root) jsonTransitionOnce = true; } strip.setTransition(transitionDelayTemp); + + tr = root[F("tb")] | -1; + if (tr >= 0) strip.timebase = ((uint32_t)tr) - millis(); int cy = root[F("pl")] | -2; if (cy > -2) presetCyclingEnabled = (cy >= 0); @@ -203,9 +206,16 @@ bool deserializeState(JsonObject root) receiveNotifications = udpn["recv"] | receiveNotifications; bool noNotification = udpn[F("nn")]; //send no notification just for this request - unsigned long timein = root[F("time")] | UINT32_MAX; + unsigned long timein = root[F("time")] | UINT32_MAX; //backup time source if NTP not synced if (timein != UINT32_MAX) { - if (millis() - ntpLastSyncTime > 50000000L) setTime(timein); + time_t prev = now(); + if (millis() - ntpLastSyncTime > 50000000L) { + setTime(timein); + if (abs(now() - prev) > 60L) { + updateLocalTime(); + calculateSunriseAndSunset(); + } + } if (presetsModifiedTime == 0) presetsModifiedTime = timein; } diff --git a/wled00/wled.h b/wled00/wled.h index 5294f8cc..8391e425 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2104151 +#define VERSION 2104210 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG