From 1f2feb546e848e8c76a7f56aaaaa88715a325985 Mon Sep 17 00:00:00 2001 From: Sascha Volkenandt Date: Sat, 25 Jun 2022 23:48:54 +0200 Subject: [PATCH 1/7] implement analog clock as a usermod --- usermods/Analog_Clock/Analog_Clock.h | 165 +++++++++++++++++++++++++++ wled00/const.h | 1 + wled00/usermods_list.cpp | 8 ++ 3 files changed, 174 insertions(+) create mode 100644 usermods/Analog_Clock/Analog_Clock.h diff --git a/usermods/Analog_Clock/Analog_Clock.h b/usermods/Analog_Clock/Analog_Clock.h new file mode 100644 index 0000000000..b9307f4a8d --- /dev/null +++ b/usermods/Analog_Clock/Analog_Clock.h @@ -0,0 +1,165 @@ +#pragma once +#include "wled.h" + +/* + * Usermod for analog clock + */ +class AnalogClockUsermod : public Usermod { +private: + struct Segment { + // config + int16_t firstLed = 0; + int16_t lastLed = 59; + int16_t centerLed = 0; + + // runtime + int16_t size; + + Segment() { + update(); + } + + void validateAndUpdate() { + if (firstLed < 0 || firstLed >= strip.getLengthTotal() || + lastLed < firstLed || lastLed >= strip.getLengthTotal()) { + *this = {}; + return; + } + if (centerLed < firstLed || centerLed > lastLed) { + centerLed = firstLed; + } + update(); + } + + void update() { + size = lastLed - firstLed + 1; + } + }; + + // configuration (available in API and stored in flash) + bool enabled = false; + Segment mainSegment; + uint32_t hourColor = 0x0000FF; + uint32_t minuteColor = 0x00FF00; + bool secondsEnabled = true; + Segment secondsSegment; + uint32_t secondColor = 0xFF0000; + bool blendColors = true; + int16_t secondsTrail = 0; + + void validateAndUpdate() { + mainSegment.validateAndUpdate(); + secondsSegment.validateAndUpdate(); + } + + uint16_t adjustToSegment(double progress, Segment const& segment) { + int16_t led = segment.centerLed + progress * segment.size; + return led > segment.lastLed + ? segment.firstLed + led - segment.lastLed - 1 + : led; + } + + void setPixelColor(uint16_t n, uint32_t c) { + if (!blendColors) { + strip.setPixelColor(n, c); + } else { + uint32_t oldC = strip.getPixelColor(n); + strip.setPixelColor(n, qadd8(R(oldC), R(c)), qadd8(G(oldC), G(c)), qadd8(B(oldC), B(c)), qadd8(W(oldC), W(c))); + } + } + + String colorToHexString(uint32_t c) { + char buffer[9]; + sprintf(buffer, "%06X", c); + return buffer; + } + + bool hexStringToColor(String const& s, uint32_t& c, uint32_t def) { + errno = 0; + char* ep; + unsigned long long r = strtoull(s.c_str(), &ep, 16); + if (*ep == 0 && errno != ERANGE) { + c = r; + return true; + } else { + c = def; + return false; + } + } + +public: + AnalogClockUsermod() { + } + + void handleOverlayDraw() override { + if (!enabled) { + return; + } + + double secondP = second(localTime) / 60.0; + double minuteP = minute(localTime) / 60.0; + double hourP = (hour(localTime) % 12) / 12.0 + minuteP / 12.0; + + if (secondsEnabled) { + uint16_t secondLed = adjustToSegment(secondP, secondsSegment); + setPixelColor(secondLed, secondColor); + + for (uint16_t i = 1; i < secondsTrail + 1; ++i) { + uint16_t trailLed = i <= secondLed ? secondLed - i : secondsSegment.lastLed - i + 1; + uint8_t trailBright = 255 / (secondsTrail + 1) * (secondsTrail - i + 1); + setPixelColor(trailLed, trailBright << 16); + } + } + + setPixelColor(adjustToSegment(minuteP, mainSegment), minuteColor); + setPixelColor(adjustToSegment(hourP, mainSegment), hourColor); + } + + void addToConfig(JsonObject& root) override { + validateAndUpdate(); + + JsonObject top = root.createNestedObject("Analog Clock"); + top["Overlay Enabled"] = enabled; + top["First LED (Main Ring)"] = mainSegment.firstLed; + top["Last LED (Main Ring)"] = mainSegment.lastLed; + top["Center/12h LED (Main Ring)"] = mainSegment.centerLed; + top["Hour Color (RRGGBB)"] = colorToHexString(hourColor); + top["Minute Color (RRGGBB)"] = colorToHexString(minuteColor); + top["Show Seconds"] = secondsEnabled; + top["First LED (Seconds Ring)"] = secondsSegment.firstLed; + top["Last LED (Seconds Ring)"] = secondsSegment.lastLed; + top["Center/12h LED (Seconds Ring)"] = secondsSegment.centerLed; + top["Second Color (RRGGBB)"] = colorToHexString(secondColor); + top["Seconds Trail (0-99)"] = secondsTrail; + top["Blend Colors"] = blendColors; + } + + bool readFromConfig(JsonObject& root) override { + JsonObject top = root["Analog Clock"]; + + bool configComplete = !top.isNull(); + + String color; + configComplete &= getJsonValue(top["Overlay Enabled"], enabled, false); + configComplete &= getJsonValue(top["First LED (Main Ring)"], mainSegment.firstLed, 0); + configComplete &= getJsonValue(top["Last LED (Main Ring)"], mainSegment.lastLed, 59); + configComplete &= getJsonValue(top["Center/12h LED (Main Ring)"], mainSegment.centerLed, 0); + configComplete &= getJsonValue(top["Hour Color (RRGGBB)"], color, "0000FF") && hexStringToColor(color, hourColor, 0x0000FF); + configComplete &= getJsonValue(top["Minute Color (RRGGBB)"], color, "00FF00") && hexStringToColor(color, minuteColor, 0x00FF00); + configComplete &= getJsonValue(top["Show Seconds"], secondsEnabled, true); + configComplete &= getJsonValue(top["First LED (Seconds Ring)"], secondsSegment.firstLed, 0); + configComplete &= getJsonValue(top["Last LED (Seconds Ring)"], secondsSegment.lastLed, 59); + configComplete &= getJsonValue(top["Center/12h LED (Seconds Ring)"], secondsSegment.centerLed, 0); + configComplete &= getJsonValue(top["Second Color (RRGGBB)"], color, "FF0000") && hexStringToColor(color, secondColor, 0xFF0000); + configComplete &= getJsonValue(top["Seconds Trail (0-99)"], secondsTrail, 0); + configComplete &= getJsonValue(top["Blend Colors"], blendColors, true); + + validateAndUpdate(); + + return configComplete; + } + + uint16_t getId() override { + return USERMOD_ID_ANALOG_CLOCK; + } +}; \ No newline at end of file diff --git a/wled00/const.h b/wled00/const.h index 95b471cb1a..87545c1a20 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -84,6 +84,7 @@ #define USERMOD_ID_SI7021_MQTT_HA 29 //Usermod "usermod_si7021_mqtt_ha.h" #define USERMOD_ID_BME280 30 //Usermod "usermod_bme280.h #define USERMOD_ID_AUDIOREACTIVE 31 //Usermod "audioreactive.h" +#define USERMOD_ID_ANALOG_CLOCK 32 //Usermod "Analog_Clock.h" //Access point behavior #define AP_BEHAVIOR_BOOT_NO_CONN 0 //Open AP when no connection after boot diff --git a/wled00/usermods_list.cpp b/wled00/usermods_list.cpp index d63730d45b..8436b87d68 100644 --- a/wled00/usermods_list.cpp +++ b/wled00/usermods_list.cpp @@ -136,6 +136,10 @@ #include "../usermods/audioreactive/audio_reactive.h" #endif +#ifdef USERMOD_ANALOG_CLOCK +#include "../usermods/Analog_Clock/Analog_Clock.h" +#endif + void registerUsermods() { /* @@ -259,4 +263,8 @@ void registerUsermods() #ifdef USERMOD_AUDIOREACTIVE usermods.add(new AudioReactive()); #endif + + #ifdef USERMOD_ANALOG_CLOCK + usermods.add(new AnalogClockUsermod()); + #endif } From 36c99f5c9c266ce1af20571374762f9dccf91430 Mon Sep 17 00:00:00 2001 From: Sascha Volkenandt Date: Sat, 2 Jul 2022 23:28:46 +0200 Subject: [PATCH 2/7] fix some bugs, use toki for time measurement, implement fading seconds --- usermods/Analog_Clock/Analog_Clock.h | 104 +++++++++++++++++++++++---- 1 file changed, 91 insertions(+), 13 deletions(-) diff --git a/usermods/Analog_Clock/Analog_Clock.h b/usermods/Analog_Clock/Analog_Clock.h index b9307f4a8d..e514dcfcb9 100644 --- a/usermods/Analog_Clock/Analog_Clock.h +++ b/usermods/Analog_Clock/Analog_Clock.h @@ -47,12 +47,15 @@ class AnalogClockUsermod : public Usermod { bool blendColors = true; int16_t secondsTrail = 0; + // runtime + bool initDone = false; + void validateAndUpdate() { mainSegment.validateAndUpdate(); secondsSegment.validateAndUpdate(); } - uint16_t adjustToSegment(double progress, Segment const& segment) { + int16_t adjustToSegment(double progress, Segment const& segment) { int16_t led = segment.centerLed + progress * segment.size; return led > segment.lastLed ? segment.firstLed + led - segment.lastLed - 1 @@ -64,7 +67,7 @@ class AnalogClockUsermod : public Usermod { strip.setPixelColor(n, c); } else { uint32_t oldC = strip.getPixelColor(n); - strip.setPixelColor(n, qadd8(R(oldC), R(c)), qadd8(G(oldC), G(c)), qadd8(B(oldC), B(c)), qadd8(W(oldC), W(c))); + strip.setPixelColor(n, qadd32(oldC, c)); } } @@ -87,28 +90,101 @@ class AnalogClockUsermod : public Usermod { } } + static inline uint32_t qadd32(uint32_t c1, uint32_t c2) { + return RGBW32( + qadd8(R(c1), R(c2)), + qadd8(G(c1), G(c2)), + qadd8(B(c1), B(c2)), + qadd8(W(c1), W(c2)) + ); + } + + static inline uint32_t scale32(uint32_t c, fract8 scale) { + return RGBW32( + scale8(R(c), scale), + scale8(G(c), scale), + scale8(B(c), scale), + scale8(W(c), scale) + ); + } + + static inline uint32_t gamma32(uint32_t c) { + return RGBW32( + strip.gamma8(R(c)), + strip.gamma8(G(c)), + strip.gamma8(B(c)), + strip.gamma8(W(c)) + ); + } + + static inline int16_t dec(int16_t n, int16_t i, Segment const& seg) { + return n - seg.firstLed >= i + ? n - i + : seg.lastLed - seg.firstLed - i + n + 1; + } + + static inline int16_t inc(int16_t n, int16_t i, Segment const& seg) { + int16_t r = n + i; + if (r > seg.lastLed) { + return seg.firstLed + (n - seg.lastLed + 1); + } + return r; + } + public: AnalogClockUsermod() { } + void setup() override { + initDone = true; + validateAndUpdate(); + } + + void loop() override { + strip.trigger(); + } + void handleOverlayDraw() override { if (!enabled) { return; } - double secondP = second(localTime) / 60.0; - double minuteP = minute(localTime) / 60.0; - double hourP = (hour(localTime) % 12) / 12.0 + minuteP / 12.0; + auto time = toki.getTime(); + double secondP = second(time.sec) / 60.0; + double minuteP = minute(time.sec) / 60.0; + double hourP = (hour(time.sec) % 12) / 12.0 + minuteP / 12.0; if (secondsEnabled) { - uint16_t secondLed = adjustToSegment(secondP, secondsSegment); - setPixelColor(secondLed, secondColor); - - for (uint16_t i = 1; i < secondsTrail + 1; ++i) { - uint16_t trailLed = i <= secondLed ? secondLed - i : secondsSegment.lastLed - i + 1; - uint8_t trailBright = 255 / (secondsTrail + 1) * (secondsTrail - i + 1); - setPixelColor(trailLed, trailBright << 16); + int16_t secondLed = adjustToSegment(secondP, secondsSegment); + // setPixelColor(secondLed, secondColor); + + // for (uint16_t i = 1; i < secondsTrail + 1; ++i) { + // uint16_t trailLed = dec(secondLed, i, secondsSegment); + // uint8_t trailBright = 255 / (secondsTrail + 1) * (secondsTrail - i + 1); + // setPixelColor(trailLed, gamma32(scale32(secondColor, trailBright))); + // } + + uint32_t ms = time.ms % 1000; + { + uint8_t b = (cos8(ms * 64 / 1000) - 128) * 2; + setPixelColor(secondLed, gamma32(scale32(secondColor, b))); + } + { + uint8_t b = (sin8(ms * 64 / 1000) - 128) * 2; + setPixelColor(inc(secondLed, 1, secondsSegment), gamma32(scale32(secondColor, b))); } + // { + // uint8_t x = ((ms + 250) % 1000) / 2; + // uint8_t b = cos8(x * 256 / 1000); + // uint16_t l = dec(secondLed, 1, secondsSegment); + // setPixelColor(l, gamma32(scale32(secondColor, b))); + // } + // { + // uint32_t x = ((ms + 500) % 1000) / 2; + // uint8_t b = cos8(x * 256 / 1000); + // uint16_t l = dec(secondLed, 2, secondsSegment); + // setPixelColor(l, gamma32(scale32(secondColor, b))); + // } } setPixelColor(adjustToSegment(minuteP, mainSegment), minuteColor); @@ -154,7 +230,9 @@ class AnalogClockUsermod : public Usermod { configComplete &= getJsonValue(top["Seconds Trail (0-99)"], secondsTrail, 0); configComplete &= getJsonValue(top["Blend Colors"], blendColors, true); - validateAndUpdate(); + if (initDone) { + validateAndUpdate(); + } return configComplete; } From edbd630c9485a7fb68b7b339ee9a34151ceaa08a Mon Sep 17 00:00:00 2001 From: Sascha Volkenandt Date: Sun, 3 Jul 2022 01:06:35 +0200 Subject: [PATCH 3/7] added timezone handling to analog clock --- usermods/Analog_Clock/Analog_Clock.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usermods/Analog_Clock/Analog_Clock.h b/usermods/Analog_Clock/Analog_Clock.h index e514dcfcb9..c0d1e88998 100644 --- a/usermods/Analog_Clock/Analog_Clock.h +++ b/usermods/Analog_Clock/Analog_Clock.h @@ -4,6 +4,8 @@ /* * Usermod for analog clock */ +extern Timezone* tz; + class AnalogClockUsermod : public Usermod { private: struct Segment { @@ -150,9 +152,10 @@ class AnalogClockUsermod : public Usermod { } auto time = toki.getTime(); - double secondP = second(time.sec) / 60.0; - double minuteP = minute(time.sec) / 60.0; - double hourP = (hour(time.sec) % 12) / 12.0 + minuteP / 12.0; + auto localSec = tz ? tz->toLocal(time.sec) : time.sec; + double secondP = second(localSec) / 60.0; + double minuteP = minute(localSec) / 60.0; + double hourP = (hour(localSec) % 12) / 12.0 + minuteP / 12.0; if (secondsEnabled) { int16_t secondLed = adjustToSegment(secondP, secondsSegment); From 56163d54b97106b32bd020d81889facbb091b1a6 Mon Sep 17 00:00:00 2001 From: Sascha Volkenandt Date: Wed, 6 Jul 2022 20:35:42 +0200 Subject: [PATCH 4/7] fixed looping second pointer, lower refresh rate --- usermods/Analog_Clock/Analog_Clock.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/usermods/Analog_Clock/Analog_Clock.h b/usermods/Analog_Clock/Analog_Clock.h index c0d1e88998..5b517edee1 100644 --- a/usermods/Analog_Clock/Analog_Clock.h +++ b/usermods/Analog_Clock/Analog_Clock.h @@ -8,6 +8,9 @@ extern Timezone* tz; class AnalogClockUsermod : public Usermod { private: + static constexpr uint32_t refreshRate = 50; // per second + static constexpr uint32_t refreshDelay = 1000 / refreshRate; + struct Segment { // config int16_t firstLed = 0; @@ -51,6 +54,7 @@ class AnalogClockUsermod : public Usermod { // runtime bool initDone = false; + uint32_t lastOverlayDraw = 0; void validateAndUpdate() { mainSegment.validateAndUpdate(); @@ -128,7 +132,7 @@ class AnalogClockUsermod : public Usermod { static inline int16_t inc(int16_t n, int16_t i, Segment const& seg) { int16_t r = n + i; if (r > seg.lastLed) { - return seg.firstLed + (n - seg.lastLed + 1); + return seg.firstLed + n - seg.lastLed; } return r; } @@ -143,7 +147,9 @@ class AnalogClockUsermod : public Usermod { } void loop() override { - strip.trigger(); + if (millis() - lastOverlayDraw > refreshDelay) { + strip.trigger(); + } } void handleOverlayDraw() override { @@ -151,12 +157,21 @@ class AnalogClockUsermod : public Usermod { return; } + lastOverlayDraw = millis(); + auto time = toki.getTime(); auto localSec = tz ? tz->toLocal(time.sec) : time.sec; double secondP = second(localSec) / 60.0; double minuteP = minute(localSec) / 60.0; double hourP = (hour(localSec) % 12) / 12.0 + minuteP / 12.0; + if (WLED_MQTT_CONNECTED) { + String topic = String(mqttDeviceTopic) + "/time"; + char buf[13]; + sprintf(buf, "%02d:%02d:%02d.%03d", hour(localSec), minute(localSec), second(localSec), time.ms); + mqtt->publish(topic.c_str(), 0, false, buf); + } + if (secondsEnabled) { int16_t secondLed = adjustToSegment(secondP, secondsSegment); // setPixelColor(secondLed, secondColor); @@ -168,6 +183,14 @@ class AnalogClockUsermod : public Usermod { // } uint32_t ms = time.ms % 1000; + + if (WLED_MQTT_CONNECTED) { + String topic = String(mqttDeviceTopic) + "/leds"; + char buf[13]; + sprintf(buf, "%02d %02d %03d", secondLed, inc(secondLed, 1, secondsSegment), ms); + mqtt->publish(topic.c_str(), 0, false, buf); + } + { uint8_t b = (cos8(ms * 64 / 1000) - 128) * 2; setPixelColor(secondLed, gamma32(scale32(secondColor, b))); From 46ceebf6d6330b9c2c6ca1ba2f0713bea63bf9b8 Mon Sep 17 00:00:00 2001 From: Sascha Volkenandt Date: Fri, 8 Jul 2022 09:07:35 +0200 Subject: [PATCH 5/7] removed mqtt debug code --- usermods/Analog_Clock/Analog_Clock.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/usermods/Analog_Clock/Analog_Clock.h b/usermods/Analog_Clock/Analog_Clock.h index 5b517edee1..b0891d6bfa 100644 --- a/usermods/Analog_Clock/Analog_Clock.h +++ b/usermods/Analog_Clock/Analog_Clock.h @@ -165,13 +165,6 @@ class AnalogClockUsermod : public Usermod { double minuteP = minute(localSec) / 60.0; double hourP = (hour(localSec) % 12) / 12.0 + minuteP / 12.0; - if (WLED_MQTT_CONNECTED) { - String topic = String(mqttDeviceTopic) + "/time"; - char buf[13]; - sprintf(buf, "%02d:%02d:%02d.%03d", hour(localSec), minute(localSec), second(localSec), time.ms); - mqtt->publish(topic.c_str(), 0, false, buf); - } - if (secondsEnabled) { int16_t secondLed = adjustToSegment(secondP, secondsSegment); // setPixelColor(secondLed, secondColor); @@ -184,13 +177,6 @@ class AnalogClockUsermod : public Usermod { uint32_t ms = time.ms % 1000; - if (WLED_MQTT_CONNECTED) { - String topic = String(mqttDeviceTopic) + "/leds"; - char buf[13]; - sprintf(buf, "%02d %02d %03d", secondLed, inc(secondLed, 1, secondsSegment), ms); - mqtt->publish(topic.c_str(), 0, false, buf); - } - { uint8_t b = (cos8(ms * 64 / 1000) - 128) * 2; setPixelColor(secondLed, gamma32(scale32(secondColor, b))); From 45efaaba588c36343fdc6d818920659f696b4a06 Mon Sep 17 00:00:00 2001 From: Sascha Volkenandt Date: Sat, 30 Jul 2022 23:59:12 +0200 Subject: [PATCH 6/7] implement seconds effect choice --- usermods/Analog_Clock/Analog_Clock.h | 52 +++++++++++++--------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/usermods/Analog_Clock/Analog_Clock.h b/usermods/Analog_Clock/Analog_Clock.h index b0891d6bfa..53ef1bd9d8 100644 --- a/usermods/Analog_Clock/Analog_Clock.h +++ b/usermods/Analog_Clock/Analog_Clock.h @@ -50,7 +50,7 @@ class AnalogClockUsermod : public Usermod { Segment secondsSegment; uint32_t secondColor = 0xFF0000; bool blendColors = true; - int16_t secondsTrail = 0; + uint16_t secondsEffect = 0; // runtime bool initDone = false; @@ -59,6 +59,9 @@ class AnalogClockUsermod : public Usermod { void validateAndUpdate() { mainSegment.validateAndUpdate(); secondsSegment.validateAndUpdate(); + if (secondsEffect < 0 || secondsEffect > 1) { + secondsEffect = 0; + } } int16_t adjustToSegment(double progress, Segment const& segment) { @@ -96,6 +99,14 @@ class AnalogClockUsermod : public Usermod { } } + void secondsEffectSineFade(int16_t secondLed, Toki::Time const& time) { + uint32_t ms = time.ms % 1000; + uint8_t b0 = (cos8(ms * 64 / 1000) - 128) * 2; + setPixelColor(secondLed, gamma32(scale32(secondColor, b0))); + uint8_t b1 = (sin8(ms * 64 / 1000) - 128) * 2; + setPixelColor(inc(secondLed, 1, secondsSegment), gamma32(scale32(secondColor, b1))); + } + static inline uint32_t qadd32(uint32_t c1, uint32_t c2) { return RGBW32( qadd8(R(c1), R(c2)), @@ -167,36 +178,23 @@ class AnalogClockUsermod : public Usermod { if (secondsEnabled) { int16_t secondLed = adjustToSegment(secondP, secondsSegment); - // setPixelColor(secondLed, secondColor); + switch (secondsEffect) { + case 0: // no effect + setPixelColor(secondLed, secondColor); + break; + + case 1: // fading seconds + secondsEffectSineFade(secondLed, time); + break; + } + + // TODO: move to secondsTrailEffect // for (uint16_t i = 1; i < secondsTrail + 1; ++i) { // uint16_t trailLed = dec(secondLed, i, secondsSegment); // uint8_t trailBright = 255 / (secondsTrail + 1) * (secondsTrail - i + 1); // setPixelColor(trailLed, gamma32(scale32(secondColor, trailBright))); // } - - uint32_t ms = time.ms % 1000; - - { - uint8_t b = (cos8(ms * 64 / 1000) - 128) * 2; - setPixelColor(secondLed, gamma32(scale32(secondColor, b))); - } - { - uint8_t b = (sin8(ms * 64 / 1000) - 128) * 2; - setPixelColor(inc(secondLed, 1, secondsSegment), gamma32(scale32(secondColor, b))); - } - // { - // uint8_t x = ((ms + 250) % 1000) / 2; - // uint8_t b = cos8(x * 256 / 1000); - // uint16_t l = dec(secondLed, 1, secondsSegment); - // setPixelColor(l, gamma32(scale32(secondColor, b))); - // } - // { - // uint32_t x = ((ms + 500) % 1000) / 2; - // uint8_t b = cos8(x * 256 / 1000); - // uint16_t l = dec(secondLed, 2, secondsSegment); - // setPixelColor(l, gamma32(scale32(secondColor, b))); - // } } setPixelColor(adjustToSegment(minuteP, mainSegment), minuteColor); @@ -218,7 +216,7 @@ class AnalogClockUsermod : public Usermod { top["Last LED (Seconds Ring)"] = secondsSegment.lastLed; top["Center/12h LED (Seconds Ring)"] = secondsSegment.centerLed; top["Second Color (RRGGBB)"] = colorToHexString(secondColor); - top["Seconds Trail (0-99)"] = secondsTrail; + top["Seconds Effect (0-1)"] = secondsEffect; top["Blend Colors"] = blendColors; } @@ -239,7 +237,7 @@ class AnalogClockUsermod : public Usermod { configComplete &= getJsonValue(top["Last LED (Seconds Ring)"], secondsSegment.lastLed, 59); configComplete &= getJsonValue(top["Center/12h LED (Seconds Ring)"], secondsSegment.centerLed, 0); configComplete &= getJsonValue(top["Second Color (RRGGBB)"], color, "FF0000") && hexStringToColor(color, secondColor, 0xFF0000); - configComplete &= getJsonValue(top["Seconds Trail (0-99)"], secondsTrail, 0); + configComplete &= getJsonValue(top["Seconds Effect (0-1)"], secondsEffect, 0); configComplete &= getJsonValue(top["Blend Colors"], blendColors, true); if (initDone) { From 1c60170be7c79a93c65c22c12a4db19645007aa7 Mon Sep 17 00:00:00 2001 From: Sascha Volkenandt Date: Fri, 14 Oct 2022 17:20:59 +0200 Subject: [PATCH 7/7] adapt to 0_14 branch --- usermods/Analog_Clock/Analog_Clock.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/usermods/Analog_Clock/Analog_Clock.h b/usermods/Analog_Clock/Analog_Clock.h index 53ef1bd9d8..10c4758839 100644 --- a/usermods/Analog_Clock/Analog_Clock.h +++ b/usermods/Analog_Clock/Analog_Clock.h @@ -125,15 +125,6 @@ class AnalogClockUsermod : public Usermod { ); } - static inline uint32_t gamma32(uint32_t c) { - return RGBW32( - strip.gamma8(R(c)), - strip.gamma8(G(c)), - strip.gamma8(B(c)), - strip.gamma8(W(c)) - ); - } - static inline int16_t dec(int16_t n, int16_t i, Segment const& seg) { return n - seg.firstLed >= i ? n - i