From c6db901051d431603bdd47459a74c4d61cc8ca73 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Tue, 17 Jan 2023 19:54:44 +0100 Subject: [PATCH 01/13] Added gradient to drawCharacter() Ability to select gradient text on Scrolling Text FX. --- wled00/FX.cpp | 12 +++++++++--- wled00/FX.h | 3 ++- wled00/FX_2Dfcn.cpp | 8 ++++++-- wled00/wled.h | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index cfd5d170..38b31177 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -5892,15 +5892,21 @@ uint16_t mode_2Dscrollingtext(void) { SEGMENT.fade_out(255 - (SEGMENT.custom1>>5)); // fade to background color SEGMENT.fade_out(255 - (SEGMENT.custom1>>5)); // fade to background color } -} + } for (int i = 0; i < numberOfLetters; i++) { if (int(cols) - int(SEGENV.aux0) + letterWidth*(i+1) < 0) continue; // don't draw characters off-screen - SEGMENT.drawCharacter(text[i], int(cols) - int(SEGENV.aux0) + letterWidth*i, yoffset, letterWidth, letterHeight, SEGMENT.color_from_palette(SEGENV.aux1, false, PALETTE_SOLID_WRAP, 0)); + uint32_t col1 = SEGMENT.color_from_palette(SEGENV.aux1, false, PALETTE_SOLID_WRAP, 0); + uint32_t col2 = BLACK; + if (SEGMENT.check1 && SEGMENT.palette == 0) { + col1 = SEGCOLOR(0); + col2 = SEGCOLOR(2); + } + SEGMENT.drawCharacter(text[i], int(cols) - int(SEGENV.aux0) + letterWidth*i, yoffset, letterWidth, letterHeight, col1, col2); } return FRAMETIME; } -static const char _data_FX_MODE_2DSCROLLTEXT[] PROGMEM = "Scrolling Text@!,Y Offset,Trail,Font size,,,Overlay;!,!;!;2;ix=128,c1=0,rev=0,mi=0,rY=0,mY=0"; +static const char _data_FX_MODE_2DSCROLLTEXT[] PROGMEM = "Scrolling Text@!,Y Offset,Trail,Font size,,Gradient,Overlay;!,!,Gradient;!;2;ix=128,c1=0,rev=0,mi=0,rY=0,mY=0"; //////////////////////////// diff --git a/wled00/FX.h b/wled00/FX.h index 5de4aff5..8db9e255 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -593,8 +593,9 @@ typedef struct Segment { void fill_circle(uint16_t cx, uint16_t cy, uint8_t radius, CRGB c); void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t c); void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, CRGB c) { drawLine(x0, y0, x1, y1, RGBW32(c.r,c.g,c.b,0)); } // automatic inline - void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, uint32_t color); + void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, uint32_t color, uint32_t col2 = 0); void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, CRGB c) { drawCharacter(chr, x, y, w, h, RGBW32(c.r,c.g,c.b,0)); } // automatic inline + void drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, CRGB c, CRGB c2) { drawCharacter(chr, x, y, w, h, RGBW32(c.r,c.g,c.b,0), RGBW32(c2.r,c2.g,c2.b,0)); } // automatic inline void wu_pixel(uint32_t x, uint32_t y, CRGB c); void blur1d(fract8 blur_amount); // blur all rows in 1 dimension void blur2d(fract8 blur_amount) { blur(blur_amount); } diff --git a/wled00/FX_2Dfcn.cpp b/wled00/FX_2Dfcn.cpp index 17882fe8..27840a3a 100644 --- a/wled00/FX_2Dfcn.cpp +++ b/wled00/FX_2Dfcn.cpp @@ -499,13 +499,16 @@ void Segment::drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint3 // draws a raster font character on canvas // only supports: 4x6=24, 5x8=40, 5x12=60, 6x8=48 and 7x9=63 fonts ATM -void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, uint32_t color) { +void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w, uint8_t h, uint32_t color, uint32_t col2) { if (chr < 32 || chr > 126) return; // only ASCII 32-126 supported chr -= 32; // align with font table entries const uint16_t cols = virtualWidth(); const uint16_t rows = virtualHeight(); const int font = w*h; + CRGB col = CRGB(color); + CRGBPalette16 grad = CRGBPalette16(col, col2 ? CRGB(col2) : col); + //if (w<5 || w>6 || h!=8) return; for (int i = 0; i= 0 || x0 < cols) && ((bits>>(j+(8-w))) & 0x01)) { // bit set & drawing on-screen - addPixelColorXY(x0, y0, color); + addPixelColorXY(x0, y0, col); } } } diff --git a/wled00/wled.h b/wled00/wled.h index 1a50a3ed..6e25636a 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2301140 +#define VERSION 2301170 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG From 5d028b3d3f5427f1e62adaf76fe6e1a5a5b2861d Mon Sep 17 00:00:00 2001 From: Ewoud Date: Wed, 18 Jan 2023 12:04:01 +0100 Subject: [PATCH 02/13] Add 4LD to esp8266_4MB_max and D0-D8,RX,TX to pin dropdowns pio.ini: Add 4LD to esp8266_4MB_max Settings_um and xml.cpp: add D0-D8,RX,TX to pin dropdowns --- platformio.ini | 40 +++- wled00/data/settings_um.htm | 1 + wled00/html_settings.h | 384 ++++++++++++++++++------------------ wled00/xml.cpp | 8 + 4 files changed, 237 insertions(+), 196 deletions(-) diff --git a/platformio.ini b/platformio.ini index a9563b8e..3ec12823 100644 --- a/platformio.ini +++ b/platformio.ini @@ -819,7 +819,7 @@ build_flags = ${common.build_flags_esp8266} ; RAM: [====== ] 59.3% (used 48608 bytes from 81920 bytes) ; Flash: [======== ] 77.0% (used 804176 bytes from 1044464 bytes) -[env:esp8266_4MB_max] ;WLEDMM: WIP +[env:esp8266_4MB_max] extends = env:d1_mini upload_speed = 460800 ;115200 board_build.f_cpu = 160000000L ;; we want 160Mhz (default = 80Mhz) @@ -829,26 +829,56 @@ build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_ALEXA -D WLED_DISABLE_BLYNK -D WLED_DISABLE_HUESYNC + -D WLED_DISABLE_LOXONE ; -D USERMOD_AUDIOREACTIVE ; -D USERMOD_CUSTOMEFFECTS ; to be done ; -UWLED_USE_MY_CONFIG -D USERMOD_PIRSWITCH -D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S3 (autodetect broken?) -D USERMOD_MULTI_RELAY - ; -D USE_ALT_DISPLAY ; new versions of USERMOD_FOUR_LINE_DISPLAY and USERMOD_ROTARY_ENCODER_UI - ; -D USERMOD_FOUR_LINE_DISPLAY + -D USE_ALT_DISPLAY ; new versions of USERMOD_FOUR_LINE_DISPLAY and USERMOD_ROTARY_ENCODER_UI + -D USERMOD_FOUR_LINE_DISPLAY -D USERMOD_MPU6050_IMU ; gyro/accelero for USERMOD_GAMES (ONLY WORKS IF USERMOD_FOUR_LINE_DISPLAY NOT INCLUDED - I2C SHARING BUG) -D USERMOD_GAMES ; WLEDMM usermod -D WLED_DEBUG ; monitor_filters = esp8266_exception_decoder lib_deps = ${esp8266.lib_deps} OneWire@~2.3.5 ; used for USERMOD_FOUR_LINE_DISPLAY and USERMOD_DALLASTEMPERATURE - ; olikraus/U8g2 @ ^2.28.8 ; used for USERMOD_FOUR_LINE_DISPLAY - ; olikraus/U8g2@ ^2.34.5 ; used for USERMOD_FOUR_LINE_DISPLAY -> need newer version with bugfixes for arduino-esp32 v2.0.4 (Wire inititialization) + olikraus/U8g2 @ ^2.28.8 ; used for USERMOD_FOUR_LINE_DISPLAY ElectronicCats/MPU6050 @ 0.6.0 ; used for USERMOD_MPU6050_IMU ; RAM: [====== ] 61.5% (used 50344 bytes from 81920 bytes) ; Flash: [======== ] 81.8% (used 854444 bytes from 1044464 bytes) +; Blaz env (for reference purposes) +[env:d1_mini_temp] +extends = env:d1_mini +board_build.filesystem = littlefs +build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 + -D WLED_DISABLE_ALEXA + -D WLED_DISABLE_BLYNK + -D WLED_DISABLE_HUESYNC + -D WLED_DISABLE_LOXONE + -D WLED_DISABLE_AUDIO ;WLEDMM not used anywhere + -D WLED_ENABLE_SIMPLE_UI + -D USERMOD_FOUR_LINE_DISPLAY + -D USE_ALT_DISPlAY + -D USERMOD_DALLASTEMPERATURE + -D TEMPERATURE_PIN=13 # (D7) + -D LEDPIN=2 # (D4) + -D RLYPIN=12 # (D6) + -D BTNPIN=0 # (D3) + -D IRPIN=14 # (D5) + -D USERMOD_MULTI_RELAY + -D MULTI_RELAY_MAX_RELAYS=2 + -D USERMOD_PIRSWITCH + -D PIR_SENSOR_PIN=16 + -D PIR_SENSOR_OFF_SEC=60 + -UWLED_USE_MY_CONFIG +lib_deps = ${esp8266.lib_deps} + paulstoffregen/OneWire@~2.3.7 ;WLEDMM Softhack, we need this as well (instead of 2.3.5)? + olikraus/U8g2 # @~2.33.15 + Wire ; WLEDMM needed? + [env:esp8266pro_16MB_min] extends = env:d1_mini board = d1_mini_pro ;; "D1 mini pro": ESP8266EX, 160MHz, 80KB RAM, 16MB Flash diff --git a/wled00/data/settings_um.htm b/wled00/data/settings_um.htm index d1eb4df6..93dc6c9f 100644 --- a/wled00/data/settings_um.htm +++ b/wled00/data/settings_um.htm @@ -252,6 +252,7 @@ //https://www.javascripttutorial.net/javascript-dom/javascript-add-remove-options/ //https://www.javascripttutorial.net/javascript-dom/javascript-remove-items-from-a-select-conditionally/ if (c.text.length <= 2) c.text += " 🟢"; + for (let jj=0; jj Date: Wed, 18 Jan 2023 13:43:33 +0100 Subject: [PATCH 03/13] Optimizing / clean up of d.max_gpio, d.um_p, d.rsvd, d.ro_pins --- platformio.ini | 2 +- wled00/data/settings_leds.htm | 1 + wled00/data/settings_um.htm | 19 +- wled00/html_settings.h | 385 +++++++++++++++++----------------- wled00/xml.cpp | 2 +- 5 files changed, 203 insertions(+), 206 deletions(-) diff --git a/platformio.ini b/platformio.ini index 3ec12823..fae506eb 100644 --- a/platformio.ini +++ b/platformio.ini @@ -840,7 +840,7 @@ build_flags = ${common.build_flags_esp8266} -D USERMOD_FOUR_LINE_DISPLAY -D USERMOD_MPU6050_IMU ; gyro/accelero for USERMOD_GAMES (ONLY WORKS IF USERMOD_FOUR_LINE_DISPLAY NOT INCLUDED - I2C SHARING BUG) -D USERMOD_GAMES ; WLEDMM usermod - -D WLED_DEBUG + ; -D WLED_DEBUG ; monitor_filters = esp8266_exception_decoder lib_deps = ${esp8266.lib_deps} OneWire@~2.3.5 ; used for USERMOD_FOUR_LINE_DISPLAY and USERMOD_DALLASTEMPERATURE diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 4f92080e..f7a37f68 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -24,6 +24,7 @@ // success event scE.addEventListener("load", () => { //console.log("File loaded"); + //WLEDMM: d. var decl can be removed as set in GetV through appendGPIOinfo d.um_p = []; d.rsvd = []; d.ro_pins = []; diff --git a/wled00/data/settings_um.htm b/wled00/data/settings_um.htm index 93dc6c9f..d01bd1a6 100644 --- a/wled00/data/settings_um.htm +++ b/wled00/data/settings_um.htm @@ -7,10 +7,7 @@ Usermod Settings