diff --git a/platformio.ini b/platformio.ini index d32b7917..3eb79632 100644 --- a/platformio.ini +++ b/platformio.ini @@ -78,12 +78,15 @@ default_envs = esp32_pico_4MB_V4_S ;; PICO D4 board esp32_4MB_V4_S_HUB75 ;; esp32 4MB - HUB75 supported esp32_4MB_V4_HUB75_forum ;; esp32 4MB - HUB75 supported (forum pinout) + esp32_4MB_V4_S ;; without HUB75 driver - might work better with I2S microphones esp32_4MB_M_eth ;; esp32 4MB with ethernet support esp32_4MB_V4_S_eth ;; esp32 4MB "V4" build with ethernet support ; esp32_4MB_PSRAM_REV3_S ;; WROVER-E experimental, optimized for WROVER-E with "revision3" chip esp32_4MB_PSRAM_S ;; esp32 WROVER with PSRAM; HUB75 supported - esp32_16MB_V4_S ;; esp32 16MB - HUB75 supported, optimized for speed - esp32_16MB_V4_M ;; esp32 16MB - HUB75 supported + esp32_16MB_V4_S ;; esp32 16MB - without HUB75 driver, optimized for speed + esp32_16MB_V4_M ;; esp32 16MB - without HUB75 driver + esp32_16MB_V4_S_HUB75 ;; esp32 16MB - HUB75 supported, optimized for speed + ; esp32_16MB_V4_M_HUB75 ;; esp32 16MB - HUB75 supported esp32_16MB_V4_M_debug ;; esp32 16MB - for out-of-the-box debugging ;; esp32S3_4MB_S ;; experimental, for HD-WF2 (HUB75 supported) @@ -1852,8 +1855,35 @@ lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compila ; RAM: [=== ] 25.5% (used 83396 bytes from 327680 bytes) ; Flash: [==========] 98.2% (used 1543949 bytes from 1572864 bytes) -[env:esp32_4MB_V4_S] ;; legacy alias -extends = env:esp32_4MB_V4_S_HUB75 +[env:esp32_4MB_V4_S] ;; without HUB75 driver - might work better with I2S microphones +extends = esp32_4MB_V4_S_base +;; board_build.partitions = ${esp32.default_partitions} ;; compatible with upstream +build_unflags = ${esp32_4MB_V4_S_base.build_unflags} + ${common_mm.DMXin_build_flags} ;; exceeds flash size limits +build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} + -D WLED_RELEASE_NAME=esp32_4MB_V4_S + -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET + -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup + -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions. + -D WLEDMM_SAVE_FLASH + -D WLED_DISABLE_LOXONE + -D WLED_DISABLE_ALEXA + -D WLED_DISABLE_HUESYNC + -D WLED_DISABLE_MQTT + -D WLED_DISABLE_INFRARED + -D WLED_DISABLE_ESPNOW ;; might help in case of WiFi connectivity problems + -D WLED_ENABLE_PIXELFORGE + -D WLEDMM_SAVE_FLASH + ; -D WLED_DEBUG + ; -D SR_DEBUG + ; -D MIC_LOGGER + ;; -D SR_DMTYPE=254 ;; HUB75 driver needs the I2S unit - this sets AR default mode to 'Network Receive Only' to prevent driver conflicts. + ;; -D WLED_DISABLE_PARTICLESYSTEM1D + ;; -D WLED_DISABLE_PARTICLESYSTEM2D +lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps} +lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation + ${common_mm.DMXin_lib_ignore} + ${common_mm.HUB75_lib_ignore} ; standard MM build for classic esp32; HUB75 not included [env:esp32_4MB_V4_M] @@ -2012,13 +2042,13 @@ board_build.flash_mode = qio ; (dio = dual i/o; more compatible than qio = quad ; Flash: [==========] 98.1% (used 1863653 bytes from 1900544 bytes) ;; V4 build for 16MB flash, optimized for speed; HUB75 supported -[env:esp32_16MB_V4_S] +[env:esp32_16MB_V4_S_HUB75] extends = esp32_4MB_V4_S_base build_unflags = ${esp32_4MB_V4_S_base.build_unflags} ${Speed_Flags.build_unflags} ;; to override -Os build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} ${Speed_Flags.build_flags_V4} ;; optimize for speed instead of size - -D WLED_RELEASE_NAME=esp32_16MB_V4_S + -D WLED_RELEASE_NAME=esp32_16MB_V4_S_HUB75 -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions. @@ -2041,11 +2071,27 @@ board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB f ; RAM: [== ] 23.7% (used 77704 bytes from 327680 bytes) ; Flash: [======== ] 84.4% (used 1770341 bytes from 2097152 bytes) +;; same as above, but without HUB75 driver - better for I2S audio input +[env:esp32_16MB_V4_S] +extends = env:esp32_16MB_V4_S_HUB75 +build_unflags = ${env:esp32_16MB_V4_S_HUB75.build_unflags} + -D WLED_RELEASE_NAME=esp32_16MB_V4_S_HUB75 + -D WLED_ENABLE_HUB75MATRIX ;; remove HUB driver + -D WLEDMM_SLOWPATH ;; not necessary without HUB75 + -D SR_DMTYPE=254 ;; not necessary without HUB75 +build_flags = ${env:esp32_16MB_V4_S_HUB75.build_flags} + -D WLED_RELEASE_NAME=esp32_16MB_V4_S +lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps} + ${common_mm.animartrix_lib_deps} +lib_ignore = + ${common_mm.HUB75_lib_ignore} ;; remove HUB driver dependancy + + ; compiled with ESP-IDF 4.4.1; HUB75 included (may have PIN conflicts) -[env:esp32_16MB_V4_M] +[env:esp32_16MB_V4_M_HUB75] extends = esp32_4MB_V4_M_base build_flags = ${esp32_4MB_V4_M_base.esp32_build_flags} - -D WLED_RELEASE_NAME=esp32_16MB_V4_M + -D WLED_RELEASE_NAME=esp32_16MB_V4_M_HUB75 -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup ;; -D WLED_ENABLE_DMX ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX) @@ -2070,6 +2116,22 @@ board_build.partitions = ${esp32.extreme_partitions} ;; WLED extended for 16MB f ; RAM: [=== ] 25.7% (used 84104 bytes from 327680 bytes) ; Flash: [======== ] 80.7% (used 1692269 bytes from 2097152 bytes) +;; same as above, but without HUB75 driver - better for I2S audio input +[env:esp32_16MB_V4_M] +extends = env:esp32_16MB_V4_M_HUB75 +build_unflags = ${env:esp32_16MB_V4_M_HUB75.build_unflags} + -D WLED_RELEASE_NAME=esp32_16MB_V4_M_HUB75 + -D WLED_ENABLE_HUB75MATRIX ;; remove HUB driver + -D WLEDMM_SLOWPATH ;; not necessary without HUB75 + -D SR_DMTYPE=254 ;; not necessary without HUB75 +build_flags = ${env:esp32_16MB_V4_M_HUB75.build_flags} + -D WLED_RELEASE_NAME=esp32_16MB_V4_M +lib_deps = ${esp32_4MB_V4_M_base.esp32_lib_deps} + ${common_mm.animartrix_lib_deps} +lib_ignore = + ${common_mm.HUB75_lib_ignore} ;; remove HUB driver dependancy + + [env:esp32_16MB_V4_M_debug] extends = esp32_4MB_V4_M_base build_unflags = ${common.build_unflags} diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 9a1a6100..e9f57850 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -3012,24 +3012,29 @@ static const char _data_FX_MODE_TRI_STATIC_PATTERN[] PROGMEM = "Solid Pattern Tr uint16_t spots_base(uint16_t threshold) { - if (SEGLEN == 1) return mode_oops(); + if (SEGLEN <= 1) return mode_oops(); if (!SEGMENT.check2) SEGMENT.fill(SEGCOLOR(1)); - uint16_t maxZones = SEGLEN >> 2; - uint16_t zones = 1 + ((SEGMENT.intensity * maxZones) >> 8); - uint16_t zoneLen = SEGLEN / zones; - uint16_t offset = (SEGLEN - zones * zoneLen) >> 1; + // constants for fixed point scaling + constexpr uint8_t ZONELEN_FP_SHIFT = 3; + constexpr uint32_t ZONELEN_FP_SCALE = 1U << ZONELEN_FP_SHIFT; - for (int z = 0; z < zones; z++) + unsigned maxZones = max(1, SEGLEN >> 2); // prevents "0 zones" + unsigned zones = 1U + ((uint32_t(SEGMENT.intensity) * maxZones) >> 8); + unsigned zoneLen = uint32_t(SEGLEN) / zones; + unsigned zoneLen8 = (uint32_t(SEGLEN) * ZONELEN_FP_SCALE) / zones; // zoneLength * 8 (fixed‑point) -> avoids gaps at right/left sides + unsigned offset = (uint32_t(SEGLEN) - ((zones * zoneLen8) >> ZONELEN_FP_SHIFT)) >> 1; + + for (unsigned z = 0; z < zones; z++) { - uint16_t pos = offset + z * zoneLen; - for (int i = 0; i < zoneLen; i++) + unsigned pos = offset + ((z * zoneLen8) >> ZONELEN_FP_SHIFT); + for (unsigned i = 0; i < zoneLen; i++) { - uint16_t wave = triwave16((i * 0xFFFF) / zoneLen); + unsigned wave = triwave16((i * 0xFFFF) / zoneLen); if (wave > threshold) { - uint16_t index = 0 + pos + i; - uint8_t s = (wave - threshold)*255 / (0xFFFF - threshold); - SEGMENT.setPixelColor(index, color_blend(SEGMENT.color_from_palette(index, true, PALETTE_SOLID_WRAP, 0), SEGCOLOR(1), 255-s)); + int index = pos + i; + unsigned s = ((wave - threshold)*255 / (0xFFFF - threshold)) & 0xFF; // & 0xFF prevents overflow in next line + SEGMENT.setPixelColor(index, color_blend(SEGMENT.color_from_palette(index, true, PALETTE_SOLID_WRAP, 0), SEGCOLOR(1), uint8_t(255-s))); } } } @@ -3054,7 +3059,7 @@ uint16_t mode_spots_fade() uint16_t tr = (t >> 1) + (t >> 2); return spots_base(tr); } -static const char _data_FX_MODE_SPOTS_FADE[] PROGMEM = "Spots Fade@Spread,Width,,,,,Overlay;!,!;!"; +static const char _data_FX_MODE_SPOTS_FADE[] PROGMEM = "Spots Fade@Speed,Width,,,,,Overlay;!,!;!"; //each needs 12 bytes @@ -9455,7 +9460,7 @@ uint16_t mode_particlefireworks(void) { return FRAMETIME; } #undef NUMBEROFSOURCES -static const char _data_FX_MODE_PARTICLEFIREWORKS[] PROGMEM = "PS Fireworks@Launches,Explosion Size,Fuse,Blur,Gravity,Cylinder,Ground,Fast;;!;2;pal=11,ix=200,sx=180,c1=196,c2=0,c3=10,o3=1"; +static const char _data_FX_MODE_PARTICLEFIREWORKS[] PROGMEM = "PS Fireworks@Launches,Explosion Size,Fuse,Blur,Gravity,Cylinder,Ground,Fast;;!;2;pal=11,ix=200,sx=180,c1=196,c2=220,c3=10,o3=1"; /* Particle Volcano diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 069b303a..653da685 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -67,7 +67,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { //int ap_pskl = ap[F("pskl")]; CJSON(apChannel, ap[F("chan")]); - if (apChannel > 13 || apChannel < 1) apChannel = 1; + if (apChannel > 13 || apChannel < 1) apChannel = 6; // reset to default if invalid CJSON(apHide, ap[F("hide")]); if (apHide > 1) apHide = 1; diff --git a/wled00/data/peek.js b/wled00/data/peek.js index 24ee7ee7..7578bcf6 100644 --- a/wled00/data/peek.js +++ b/wled00/data/peek.js @@ -30,13 +30,15 @@ function peek(c) { ctx.clearRect(0, 0, c.width, c.height); //WLEDMM function colorAmp(color) { if (color == 0) return 0; - return 25+225*color/255; + //return color; // no enhancement + //return 25+225*color/255; // legacy WLEDMM. problem: strong jump from 0 to 25 -> wrong colors + return Math.sqrt(color/255) * 255; // Square root provides gentle and jump-free enhancement of lower brightness pixels } //WLEDMM in range 55 - 205 for (y=0.5;y 0.45 ctx.fill(); } i+=3; diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 1bde6fbc..c2775ac4 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -17,6 +17,7 @@ function gId(n){return d.getElementById(n);} function hideNoIR(){gId("irOnOff2").style.display="none";} //WLEDMM function hideHub75() { + window.hub75Hidden = true; // Track that Hub75 should be hidden var s = d.getElementsByTagName("select"); for (i=0; i
Auto-calculate white channel from RGB:
  `; f.insertAdjacentHTML("beforeend", cn); + if (window.hub75Hidden) hideHub75(); // remove Hub75 options if not supported } if (n==-1) { o[--i].remove();--i; diff --git a/wled00/data/settings_um.htm b/wled00/data/settings_um.htm index d0dd98f3..a2d867be 100644 --- a/wled00/data/settings_um.htm +++ b/wled00/data/settings_um.htm @@ -10,6 +10,8 @@ d.um_p = []; d.rsvd = []; d.ro_gpio = []; + d.h_pins = []; + d.x_pins = []; var umCfg = {}; var pins = [], pinO = [], owner; var loc = false, locip; @@ -56,6 +58,8 @@ // function check(o,k) {} //WLEDMM not needed as we use dropdowns function getPins(o) { if (isO(o)) { + // If this object is a bus instance, extract the "type" field + let busType = o.type !== undefined ? o.type : -1; for (const [k,v] of Object.entries(o)) { if (isO(v)) { owner = k; @@ -63,6 +67,10 @@ continue; } if (k.replace("[]","").substr(-3)=="pin") { + // Skip pin arrays for special bus types where pin array doesn't contain GPIO numbers, but allow all other entries + if (busType >= 80 && busType < 96) continue; // Network buses - pin array stores IP address + if (busType >= 100 && busType <= 110) continue; // HUB75 buses - pin array stores chain length + if (Array.isArray(v)) { for (var i=0; i=0) { pins.push(v[i]); pinO.push(owner); } } else { @@ -269,6 +277,8 @@ // console.log("pinPost option", c, c.value, d.ro_gpio.includes(c.value)); for (let j=0; j max_gpio if (c.value > d.max_gpio) { select.removeChild(c); @@ -278,7 +288,7 @@ //https://www.javascripttutorial.net/javascript-dom/javascript-remove-items-from-a-select-conditionally/ if (c.text.length <= 4) c.text += " 🟢"; //2 digit number space and ⍼/⎌. If no reserved/read only/other um, then pin can be freely used (green) for (let jj=0; jj