From cd95abb2a17ad2ebf42bb9e29a59054ce995532a Mon Sep 17 00:00:00 2001 From: Andy Hofmann Date: Mon, 20 Dec 2021 01:41:37 +0100 Subject: [PATCH 01/13] Usermod quinled-an-penta: Updated IOs for v1r1 release (#2429) * UM QuinLED-An-Penta: First version * UM QuinLED-An-Penta: Made OLED seconds a setting; small improvements * UM QuinLED-An-Penta: Fixed unique ID * Merge branch 'master' of https://github.com/Aircoookie/WLED * UM QuinLED-An-Penta: Fixed config loading * UM QuinLED-An-Penta: Replaced ledcRead() with calculating the percentage * UM QuinLED-An-Penta: Fixed temp sensor readings * UM QuinLED-An-Penta: Removing OLED bus clk setting * UM QuinLED-An-Penta: ETH support, lots of OLED improvements * UM quinled-an-penta: v1r1 adjustments --- usermods/quinled-an-penta/quinled-an-penta.h | 8 +++---- usermods/quinled-an-penta/readme.md | 22 ++++++++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/usermods/quinled-an-penta/quinled-an-penta.h b/usermods/quinled-an-penta/quinled-an-penta.h index 10777e36c..5153ee58a 100644 --- a/usermods/quinled-an-penta/quinled-an-penta.h +++ b/usermods/quinled-an-penta/quinled-an-penta.h @@ -61,10 +61,10 @@ class QuinLEDAnPentaUsermod : public Usermod float shtLastKnownHumidity = 0; // Pin/IO vars - const int8_t anPentaPins[5] = {14, 13, 12, 4, 2}; + const int8_t anPentaLEDPins[5] = {14, 13, 12, 4, 2}; int8_t oledSpiClk = 15; int8_t oledSpiData = 16; - int8_t oledSpiCs = 0; + int8_t oledSpiCs = 27; int8_t oledSpiDc = 32; int8_t oledSpiRst = 33; int8_t shtSda = 1; @@ -75,7 +75,7 @@ class QuinLEDAnPentaUsermod : public Usermod { for(int8_t i = 0; i <= 4; i++) { - if(anPentaPins[i] == pin) + if(anPentaLEDPins[i] == pin) return true; } return false; @@ -313,7 +313,7 @@ class QuinLEDAnPentaUsermod : public Usermod byte drawnLines = 0; for (int8_t app = 0; app <= 4; app++) { for (int8_t clp = 0; clp <= 4; clp++) { - if (anPentaPins[app] == currentLedPins[clp]) { + if (anPentaLEDPins[app] == currentLedPins[clp]) { char charCurrentLedcReads[17]; sprintf(charCurrentLedcReads, "LED %d:", app+1); if (oledUseProgressBars) { diff --git a/usermods/quinled-an-penta/readme.md b/usermods/quinled-an-penta/readme.md index c292736c8..4a4c0290a 100644 --- a/usermods/quinled-an-penta/readme.md +++ b/usermods/quinled-an-penta/readme.md @@ -1,12 +1,12 @@ # QuinLED-An-Penta -The (un)official usermod to get the best out of the QuinLED-An-Penta, like using the OLED and the SHT30 temperature/humidity sensor. +The (un)official usermod to get the best out of the QuinLED-An-Penta (https://quinled.info/quinled-an-penta/), like using the OLED and the SHT30 temperature/humidity sensor. ## Requirements * "u8gs" by olikraus, v2.28 or higher: https://github.com/olikraus/u8g2 * "SHT85" by Rob Tillaart, v0.2 or higher: https://github.com/RobTillaart/SHT85 ## Usermod installation -Simply copy the below block (build task) to your `platformio_override.ini` and compile WLED using this new build task. Or use an existing one and add the buildflag `-D QUINLED_AN_PENTA`. +Simply copy the below block (build task) to your `platformio_override.ini` and compile WLED using this new build task. Or use an existing one, add the buildflag `-D QUINLED_AN_PENTA` and the below library dependencies. ESP32 (**without** ethernet): ``` @@ -33,14 +33,19 @@ This mod has been optimized for an SSD1306 driven 128x64 OLED. Using a smaller O I highly recommend using these "two color monochromatic OLEDs", which have the first 16 pixels in a different color than the other 48, e.g. a yellow/blue OLED. Also note, you need to have an **SPI** driven OLED, **not i2c**! +### Limitations combined with Ethernet +The initial development of this mod had been done with a beta version of the QuinLED-An-Penta, which had a different IO layout for the OLED: The CS pin used to be IO_0, but has been changed to IO27 with the first v1 public release. Unfortunately, IO27 is used by the Ethernet boards, so WLED will not let you enable the OLED screen, if you're using it with Ethernet. This unfortunately makes the development I've done to support/show Ethernet information void, as it cannot be used. +However (and I've not tried this, as I don't own a v1 board): You can try to modify this mod and try to use IO27 for the OLED and share it with the Ethernet board. It is "just" the chip select pin, so there is a chance that both can coexist and use the same IO. You need to skip WLEDs PinManager for the CS pin, so WLED will not block using it. If you don't know how this works: Leave it. If you know what I'm talking about: Try it and please let me know on the Intermit.Tech (QuinLED) Discord server: https://discord.gg/WdbAauG + ### My OLED flickers after some time, what should I do? -That's a tricky one: During development I saw that the OLED sometimes starts to "bug out" / flicker and won't work anymore. This seems to be caused by the high PWM interference the board produces. It seems to loose it's settings and then doesn't know how to draw anymore. Turns out the only way to fix this is to call the libraries `begin()` method again which will re-initialize the display. +That's a tricky one: During development I saw that the OLED sometimes starts to "bug out" / flicker and won't work anymore. This seems to be caused by the high PWM interference the board produces. It seems to loose its settings and then doesn't know how to draw anymore. Turns out the only way to fix this is to call the libraries `begin()` method again which will re-initialize the display. If you're facing this issue, you can enable a setting I've added which will call the `begin()` roughly every 60 seconds between a page change. This will make the page change take ~500ms, but will fix the display. + ## Configuration Navigate to the "Config" and then to the "Usermods" section. If you compiled WLED with `-D QUINLED_AN_PENTA`, you will see the config for it there: * Enable-OLED: - * What it does: Enabled the optional SPI driven OLED that can be mounted to the 7-pin female header + * What it does: Enables the optional SPI driven OLED that can be mounted to the 7-pin female header. Won't work with Ethernet, read above. * Possible values: Enabled/Disabled * Default: Disabled * OLED-Use-Progress-Bars: @@ -60,10 +65,15 @@ Navigate to the "Config" and then to the "Usermods" section. If you compiled WLE * Possible values: Enabled/Disabled * Default: Disabled * Enable-SHT30-Temp-Humidity-Sensor: - * What it does: Enabled the onboard SHT30 temperature and humidity sensor + * What it does: Enables the onboard SHT30 temperature and humidity sensor * Possible values: Enabled/Disabled * Default: Disabled ## Change log +2021-12 +* Adjusted IO layout to match An-Penta v1r1 2021-10 -* First implementation. \ No newline at end of file +* First implementation. + +## Credits +ezcGman | Andy: Find me on the Intermit.Tech (QuinLED) Discord server: https://discord.gg/WdbAauG \ No newline at end of file From 8bd716c056943a2a47059fe1fffdcb3315c63565 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Mon, 20 Dec 2021 16:43:47 +0100 Subject: [PATCH 02/13] Prevent undefind FX behaviour on millis() rollover --- wled00/FX.h | 1 + wled00/FX_fcn.cpp | 6 ++++++ wled00/wled.cpp | 1 + 3 files changed, 8 insertions(+) diff --git a/wled00/FX.h b/wled00/FX.h index 7215e347b..9a910108d 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -648,6 +648,7 @@ class WS2812FX { calcGammaTable(float), trigger(void), setSegment(uint8_t n, uint16_t start, uint16_t stop, uint8_t grouping = 0, uint8_t spacing = 0, uint16_t offset = UINT16_MAX), + restartRuntime(), resetSegments(), makeAutoSegments(), fixInvalidSegments(), diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 20ff12b85..b1088d140 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -606,6 +606,12 @@ void WS2812FX::setSegment(uint8_t n, uint16_t i1, uint16_t i2, uint8_t grouping, _segment_runtimes[n].reset(); } +void WS2812FX::restartRuntime() { + for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) { + _segment_runtimes[i].reset(); + } +} + void WS2812FX::resetSegments() { for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) if (_segments[i].name) delete _segments[i].name; mainSegment = 0; diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 6e120e4d8..55fd95956 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -193,6 +193,7 @@ void WLED::loop() if (lastMqttReconnectAttempt > millis()) { rolloverMillis++; lastMqttReconnectAttempt = 0; + strip.restartRuntime(); } if (millis() - lastMqttReconnectAttempt > 30000) { lastMqttReconnectAttempt = millis(); From 84624666ce59c8ac7d96181575ba6d4c24e35fdd Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Tue, 21 Dec 2021 18:16:25 +0100 Subject: [PATCH 03/13] Incorrect delete fix. --- wled00/FX_fcn.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index b1088d140..1e1bbab2d 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -613,7 +613,7 @@ void WS2812FX::restartRuntime() { } void WS2812FX::resetSegments() { - for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) if (_segments[i].name) delete _segments[i].name; + for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) if (_segments[i].name) delete[] _segments[i].name; mainSegment = 0; memset(_segments, 0, sizeof(_segments)); //memset(_segment_runtimes, 0, sizeof(_segment_runtimes)); From 296fe4b62e706ef01cc7714a42bf232b952d60a1 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Tue, 21 Dec 2021 22:46:06 +0100 Subject: [PATCH 04/13] Unload playlist on timed presets. --- wled00/ntp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wled00/ntp.cpp b/wled00/ntp.cpp index eb8a52007..a631d654b 100644 --- a/wled00/ntp.cpp +++ b/wled00/ntp.cpp @@ -336,6 +336,7 @@ void checkTimers() && (timerWeekday[i] & 0x01) //timer is enabled && ((timerWeekday[i] >> weekdayMondayFirst()) & 0x01)) //timer should activate at current day of week { + unloadPlaylist(); applyPreset(timerMacro[i]); } } @@ -349,6 +350,7 @@ void checkTimers() && (timerWeekday[8] & 0x01) //timer is enabled && ((timerWeekday[8] >> weekdayMondayFirst()) & 0x01)) //timer should activate at current day of week { + unloadPlaylist(); applyPreset(timerMacro[8]); DEBUG_PRINTF("Sunrise macro %d triggered.",timerMacro[8]); } @@ -363,6 +365,7 @@ void checkTimers() && (timerWeekday[9] & 0x01) //timer is enabled && ((timerWeekday[9] >> weekdayMondayFirst()) & 0x01)) //timer should activate at current day of week { + unloadPlaylist(); applyPreset(timerMacro[9]); DEBUG_PRINTF("Sunset macro %d triggered.",timerMacro[9]); } From 2c1418105154457c658d1f01fa9c329561567cee Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Thu, 23 Dec 2021 20:32:45 +0100 Subject: [PATCH 05/13] LAT/LON helper for Samsung devices. --- wled00/data/settings_time.htm | 12 +++++++++--- wled00/html_settings.h | 16 +++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/wled00/data/settings_time.htm b/wled00/data/settings_time.htm index 622cff668..ffe82924d 100644 --- a/wled00/data/settings_time.htm +++ b/wled00/data/settings_time.htm @@ -16,7 +16,7 @@ } function S() { - BTa();GetV();Cs();FC(); + BTa();GetV();updLoc();Cs();FC(); } function gId(s) { @@ -74,6 +74,8 @@ } gId("W"+i).value=a[i]; } + if (d.Sf.LTR.value==="S") { d.Sf.LT.value = -1*parseFloat(d.Sf.LT.value); } + if (d.Sf.LNR.value==="W") { d.Sf.LN.value = -1*parseFloat(d.Sf.LN.value); } } function addRow(i,p,l,d) { var t = gId("macros"); // table @@ -90,6 +92,10 @@ td = tr.insertCell(3); td.innerHTML = ``; } + function updLoc(i) { + if (parseFloat(d.Sf.LT.value)<0) { d.Sf.LTR.value = "S"; d.Sf.LT.value = -1*parseFloat(d.Sf.LT.value); } else d.Sf.LTR.value = "N"; + if (parseFloat(d.Sf.LN.value)<0) { d.Sf.LNR.value = "W"; d.Sf.LN.value = -1*parseFloat(d.Sf.LN.value); } else d.Sf.LNR.value = "E"; + } function GetV() { //values injected by server while sending HTML @@ -134,8 +140,8 @@
UTC offset: seconds (max. 18 hours)
Current local time is unknown.
- Latitude (N): - Longitude (E): + Latitude:
+ Longitude:

Clock

Clock Overlay: diff --git a/wled00/html_settings.h b/wled00/html_settings.h index c3e7d1daf..3655872f7 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -338,7 +338,7 @@ type="submit">Save)====="; // Autogenerated from wled00/data/settings_time.htm, do not edit!! const char PAGE_settings_time[] PROGMEM = R"=====( Time Settings