mirror of
https://github.com/wled/WLED.git
synced 2025-07-09 20:06:33 +00:00
Merge branch '0_15' into GitHub-Actions
This commit is contained in:
commit
7fe6541b7c
16
.github/workflows/wled-ci.yml
vendored
16
.github/workflows/wled-ci.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: PlatformIO CI
|
||||
name: WLED CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
@ -78,3 +78,17 @@ jobs:
|
||||
files: |
|
||||
*.bin
|
||||
*.bin.gz
|
||||
|
||||
|
||||
testCdata:
|
||||
name: Test cdata.js
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '20.x'
|
||||
cache: 'npm'
|
||||
- run: npm ci
|
||||
- run: npm test
|
||||
|
22
CHANGELOG.md
22
CHANGELOG.md
@ -1,7 +1,27 @@
|
||||
## WLED changelog
|
||||
|
||||
#### Build 2309120 till build 2201060
|
||||
#### Build 2309120 till build 2401270
|
||||
- WLED version 0.15.0-a0
|
||||
- BREAKING: Effect: updated Palette effect to support 2D (#3683 by @TripleWhy)
|
||||
- "SuperSync" from WLED MM (by @MoonModules)
|
||||
- Effect: DNA Spiral Effect Speed Fix (#3723 by @Derek4aty1)
|
||||
- Fix for #3693
|
||||
- Orange flash fix (#3196) for transitions
|
||||
- Add own background image upload (#3596 by @WoodyLetsCode)
|
||||
- WLED time overrides (`WLED_NTP_ENABLED`, `WLED_TIMEZONE`, `WLED_UTC_OFFSET`, `WLED_LAT` and `WLED_LON`)
|
||||
- Better sorting and naming of static palettes (by @WoodyLetsCode)
|
||||
- ANIMartRIX usermod and effects (#3673 by @netmindz)
|
||||
- Use canvas instead of CSS gradient for liveview (#3621 by @zanhecht)
|
||||
- Fix for #3672
|
||||
- ColoOrderMap W channel swap (color order overrides now have W swap)
|
||||
- En-/disable LED maps when receiving realtime data (#3554 by @ezcGman)
|
||||
- Added PWM frequency selection to UI (Settings)
|
||||
- Automatically build UI before compiling (#3598, #3666 by @WoodyLetsCode)
|
||||
- Internal: Added *suspend* API to `strip` (`WS2812FX class`)
|
||||
- Possible fix for #3589 & partial fix for #3605
|
||||
- MPU6050 upgrade (#3654 by @willmmiles)
|
||||
- UI internals (#3656 by @WoodyLetsCode)
|
||||
- ColorPicker fix (#3658 by @WoodyLetsCode)
|
||||
- Global JSON buffer guarding (#3648 by @willmmiles, resolves #3641, #3312, #3367, #3637, #3646, #3447)
|
||||
- Effect: Fireworks 1D (fix for matrix trailing strip)
|
||||
- BREAKING: Reduced number of segments (12) on ESP8266 due to less available RAM
|
||||
|
2282
package-lock.json
generated
2282
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node tools/cdata.js",
|
||||
"test": "node --test",
|
||||
"dev": "nodemon -e js,html,htm,css,png,jpg,gif,ico,js -w tools/ -w wled00/data/ -x node tools/cdata.js"
|
||||
},
|
||||
"repository": {
|
||||
@ -22,10 +23,10 @@
|
||||
},
|
||||
"homepage": "https://github.com/Aircoookie/WLED#readme",
|
||||
"dependencies": {
|
||||
"clean-css": "^4.2.3",
|
||||
"html-minifier-terser": "^5.1.1",
|
||||
"clean-css": "^5.3.3",
|
||||
"html-minifier-terser": "^7.2.0",
|
||||
"inliner": "^1.13.1",
|
||||
"nodemon": "^2.0.20",
|
||||
"nodemon": "^3.0.2",
|
||||
"zlib": "^1.0.5"
|
||||
}
|
||||
}
|
||||
|
433
platformio.ini
433
platformio.ini
@ -9,39 +9,8 @@
|
||||
# (use `platformio_override.ini` when building for your own board; see `platformio_override.ini.sample` for an example)
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# CI binaries
|
||||
; default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth # ESP32 variant builds are temporarily excluded from CI due to toolchain issues on the GitHub Actions Linux environment
|
||||
default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, esp32dev_audioreactive, lolin_s2_mini, esp32c3dev, esp32s3dev_8MB, esp32s3dev_8MB_PSRAM_opi
|
||||
|
||||
# Release binaries
|
||||
; default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, lolin_s2_mini, esp32c3dev, esp32s3dev_8MB
|
||||
|
||||
# Build everything
|
||||
; default_envs = esp32dev, esp8285_4CH_MagicHome, codm-controller-0_6-rev2, codm-controller-0_6, esp32s2_saola, d1_mini_5CH_Shojo_PCB, d1_mini, sp501e, nodemcuv2, esp32_eth, anavi_miracle_controller, esp07, esp01_1m_full, m5atom, h803wf, d1_mini_ota, heltec_wifi_kit_8, esp8285_H801, d1_mini_debug, wemos_shield_esp32, elekstube_ips
|
||||
|
||||
# Single binaries (uncomment your board)
|
||||
; default_envs = elekstube_ips
|
||||
; default_envs = nodemcuv2
|
||||
; default_envs = esp8266_2m
|
||||
; default_envs = esp01_1m_full
|
||||
; default_envs = esp07
|
||||
; default_envs = d1_mini
|
||||
; default_envs = heltec_wifi_kit_8
|
||||
; default_envs = h803wf
|
||||
; default_envs = d1_mini_debug
|
||||
; default_envs = d1_mini_ota
|
||||
; default_envs = esp32dev
|
||||
; default_envs = esp8285_4CH_MagicHome
|
||||
; default_envs = esp8285_H801
|
||||
; default_envs = d1_mini_5CH_Shojo_PCB
|
||||
; default_envs = wemos_shield_esp32
|
||||
; default_envs = m5atom
|
||||
; default_envs = esp32_eth
|
||||
; default_envs = esp32dev_qio80
|
||||
; default_envs = esp32_eth_ota1mapp
|
||||
; default_envs = esp32s2_saola
|
||||
; default_envs = esp32c3dev
|
||||
; default_envs = lolin_s2_mini
|
||||
# CI/release binaries
|
||||
default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, esp32dev_audioreactive, lolin_s2_mini, esp32c3dev, esp32s3dev_8MB, esp32s3dev_8MB_PSRAM_opi, esp32_wrover
|
||||
|
||||
src_dir = ./wled00
|
||||
data_dir = ./wled00/data
|
||||
@ -60,9 +29,9 @@ extra_configs =
|
||||
arduino_core_2_6_3 = espressif8266@2.3.3
|
||||
arduino_core_2_7_4 = espressif8266@2.6.2
|
||||
arduino_core_3_0_0 = espressif8266@3.0.0
|
||||
arduino_core_3_2_0 = espressif8266@3.2.0
|
||||
arduino_core_4_1_0 = espressif8266@4.1.0
|
||||
arduino_core_3_1_2 = espressif8266@4.2.0
|
||||
arduino_core_3_0_2 = espressif8266@3.2.0
|
||||
arduino_core_3_1_0 = espressif8266@4.1.0
|
||||
arduino_core_3_1_2 = espressif8266@4.2.1
|
||||
|
||||
# Development platforms
|
||||
arduino_core_develop = https://github.com/platformio/platform-espressif8266#develop
|
||||
@ -132,12 +101,7 @@ build_flags =
|
||||
-D DECODE_SONY=true
|
||||
-D DECODE_SAMSUNG=true
|
||||
-D DECODE_LG=true
|
||||
;-Dregister= # remove warnings in C++17 due to use of deprecated register keyword by the FastLED library ;; warning: this breaks framework code on ESP32-C3 and ESP32-S2
|
||||
-DWLED_USE_MY_CONFIG
|
||||
; -D USERMOD_SENSORSTOMQTT
|
||||
#For ADS1115 sensor uncomment following
|
||||
; -D USERMOD_ADS1115
|
||||
; -D USERMOD_ANIMARTRIX
|
||||
|
||||
build_unflags =
|
||||
|
||||
@ -165,10 +129,8 @@ extra_scripts =
|
||||
framework = arduino
|
||||
board_build.flash_mode = dout
|
||||
monitor_speed = 115200
|
||||
# slow upload speed (comment this out with a ';' when building for development use)
|
||||
# slow upload speed but most compatible (use platformio_override.ini to use faster speed)
|
||||
upload_speed = 115200
|
||||
# fast upload speed (remove ';' when building for development use)
|
||||
; upload_speed = 921600
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# LIBRARIES: required dependencies
|
||||
@ -183,28 +145,34 @@ lib_deps =
|
||||
IRremoteESP8266 @ 2.8.2
|
||||
makuna/NeoPixelBus @ 2.7.5
|
||||
https://github.com/Aircoookie/ESPAsyncWebServer.git @ ~2.0.7
|
||||
# for I2C interface
|
||||
;Wire
|
||||
# ESP-NOW library (includes mandatory QuickDebug library)
|
||||
; gmag11/QuickESPNow @ 0.6.2
|
||||
;gmag11/QuickESPNow @ 0.6.2
|
||||
https://github.com/blazoncek/QuickESPNow.git#optional-debug
|
||||
#For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line
|
||||
#TFT_eSPI
|
||||
#For compatible OLED display uncomment following
|
||||
#U8g2 #@ ~2.33.15
|
||||
#olikraus/U8g2 #@ ~2.33.15
|
||||
#For Dallas sensor uncomment following
|
||||
#OneWire @ ~2.3.7
|
||||
#paulstoffregen/OneWire @ ~2.3.8
|
||||
#For BME280 sensor uncomment following
|
||||
#BME280 @ ~3.0.0
|
||||
; adafruit/Adafruit BMP280 Library @ 2.1.0
|
||||
; adafruit/Adafruit CCS811 Library @ 1.0.4
|
||||
; adafruit/Adafruit Si7021 Library @ 1.4.0
|
||||
;adafruit/Adafruit BMP280 Library @ 2.1.0
|
||||
;adafruit/Adafruit CCS811 Library @ 1.0.4
|
||||
;adafruit/Adafruit Si7021 Library @ 1.4.0
|
||||
#For ADS1115 sensor uncomment following
|
||||
; adafruit/Adafruit BusIO @ 1.13.2
|
||||
; adafruit/Adafruit ADS1X15 @ 2.4.0
|
||||
;adafruit/Adafruit BusIO @ 1.13.2
|
||||
;adafruit/Adafruit ADS1X15 @ 2.4.0
|
||||
#For MPU6050 IMU uncomment follwoing
|
||||
; electroniccats/MPU6050 @1.0.1
|
||||
# For -D USERMOD_ANIMARTRIX
|
||||
# CC BY-NC 3.0 licensed effects by Stefan Petrick, include this usermod only if you accept the terms!
|
||||
; https://github.com/netmindz/animartrix.git#18bf17389e57c69f11bc8d04ebe1d215422c7fb7
|
||||
;electroniccats/MPU6050 @1.0.1
|
||||
# For -D USERMOD_ANIMARTRIX
|
||||
# CC BY-NC 3.0 licensed effects by Stefan Petrick, include this usermod only if you accept the terms!
|
||||
;https://github.com/netmindz/animartrix.git#18bf17389e57c69f11bc8d04ebe1d215422c7fb7
|
||||
# SHT85
|
||||
;robtillaart/SHT85@~0.3.3
|
||||
# Audioreactive usermod
|
||||
;https://github.com/kosme/arduinoFFT#develop @ ^1.9.2
|
||||
|
||||
extra_scripts = ${scripts_defaults.extra_scripts}
|
||||
|
||||
@ -280,6 +248,7 @@ lib_deps =
|
||||
;; generic definitions for all ESP32-S2 boards
|
||||
platform = espressif32@5.3.0
|
||||
platform_packages =
|
||||
default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
|
||||
build_flags = -g
|
||||
-DARDUINO_ARCH_ESP32
|
||||
-DARDUINO_ARCH_ESP32S2
|
||||
@ -290,7 +259,6 @@ build_flags = -g
|
||||
-DARDUINO_USB_MODE=0 ;; this flag is mandatory for ESP32-S2 !
|
||||
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
|
||||
;; ARDUINO_USB_CDC_ON_BOOT
|
||||
|
||||
lib_deps =
|
||||
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
|
||||
${env.lib_deps}
|
||||
@ -308,7 +276,6 @@ build_flags = -g
|
||||
-DARDUINO_USB_MODE=1 ;; this flag is mandatory for ESP32-C3
|
||||
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
|
||||
;; ARDUINO_USB_CDC_ON_BOOT
|
||||
|
||||
lib_deps =
|
||||
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0
|
||||
${env.lib_deps}
|
||||
@ -366,44 +333,6 @@ build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01 -D WLED_D
|
||||
; -D WLED_USE_UNREAL_MATH ;; may cause wrong sunset/sunrise times, but saves 7064 bytes FLASH and 975 bytes RAM
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:esp07]
|
||||
board = esp07
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:d1_mini]
|
||||
board = d1_mini
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
upload_speed = 921600
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
monitor_filters = esp8266_exception_decoder
|
||||
|
||||
[env:heltec_wifi_kit_8]
|
||||
board = d1_mini
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:h803wf]
|
||||
board = d1_mini
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D LEDPIN=1 -D WLED_DISABLE_INFRARED
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:esp32dev]
|
||||
board = esp32dev
|
||||
platform = ${esp32.platform}
|
||||
@ -428,33 +357,6 @@ board_build.partitions = ${esp32.default_partitions}
|
||||
; board_build.f_flash = 80000000L
|
||||
; board_build.flash_mode = dio
|
||||
|
||||
[env:esp32dev_qio80]
|
||||
board = esp32dev
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_qio80 #-D WLED_DISABLE_BROWNOUT_DET
|
||||
lib_deps = ${esp32.lib_deps}
|
||||
monitor_filters = esp32_exception_decoder
|
||||
board_build.partitions = ${esp32.default_partitions}
|
||||
board_build.f_flash = 80000000L
|
||||
board_build.flash_mode = qio
|
||||
|
||||
[env:esp32dev_V4_dio80]
|
||||
;; experimental ESP32 env using ESP-IDF V4.4.x
|
||||
;; Warning: this build environment is not stable!!
|
||||
;; please erase your device before installing.
|
||||
board = esp32dev
|
||||
platform = ${esp32_idf_V4.platform}
|
||||
platform_packages = ${esp32_idf_V4.platform_packages}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=ESP32_V4_qio80 #-D WLED_DISABLE_BROWNOUT_DET
|
||||
lib_deps = ${esp32_idf_V4.lib_deps}
|
||||
monitor_filters = esp32_exception_decoder
|
||||
board_build.partitions = ${esp32_idf_V4.default_partitions}
|
||||
board_build.f_flash = 80000000L
|
||||
board_build.flash_mode = dio
|
||||
|
||||
[env:esp32_eth]
|
||||
board = esp32-poe
|
||||
platform = ${esp32.platform}
|
||||
@ -466,19 +368,18 @@ build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_Ethernet -D
|
||||
lib_deps = ${esp32.lib_deps}
|
||||
board_build.partitions = ${esp32.default_partitions}
|
||||
|
||||
[env:esp32s2_saola]
|
||||
board = esp32-s2-saola-1
|
||||
platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.2/platform-tasmota-espressif32-2.0.2.zip
|
||||
platform_packages =
|
||||
framework = arduino
|
||||
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
|
||||
[env:esp32_wrover]
|
||||
platform = ${esp32.platform}
|
||||
board = ttgo-t7-v14-mini32
|
||||
board_build.f_flash = 80000000L
|
||||
board_build.flash_mode = qio
|
||||
upload_speed = 460800
|
||||
board_build.partitions = ${esp32.default_partitions}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags} ${esp32s2.build_flags} #-D WLED_RELEASE_NAME=S2_saola
|
||||
;-DLOLIN_WIFI_FIX ;; try this in case Wifi does not work
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
lib_deps = ${esp32s2.lib_deps}
|
||||
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_WROVER
|
||||
-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
|
||||
-D WLED_USE_PSRAM
|
||||
-D LEDPIN=25
|
||||
lib_deps = ${esp32.lib_deps}
|
||||
|
||||
[env:esp32c3dev]
|
||||
extends = esp32c3
|
||||
@ -535,95 +436,24 @@ board_build.f_flash = 80000000L
|
||||
board_build.flash_mode = qio
|
||||
monitor_filters = esp32_exception_decoder
|
||||
|
||||
[env:esp32s3dev_8MB_PSRAM_qspi]
|
||||
;; ESP32-TinyS3 development board, with 8MB FLASH and PSRAM (memory_type: qio_qspi)
|
||||
extends = env:esp32s3dev_8MB_PSRAM_opi
|
||||
;board = um_tinys3 ; -> needs workaround from https://github.com/Aircoookie/WLED/pull/2905#issuecomment-1328049860
|
||||
board = esp32-s3-devkitc-1 ;; generic dev board; the next line adds PSRAM support
|
||||
board_build.arduino.memory_type = qio_qspi ;; use with PSRAM: 2MB or 4MB
|
||||
|
||||
[env:esp8285_4CH_MagicHome]
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_1m128k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:esp8285_H801]
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_1m128k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:d1_mini_5CH_Shojo_PCB]
|
||||
board = d1_mini
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_USE_SHOJO_PCB
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# DEVELOPMENT BOARDS
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[env:d1_mini_debug]
|
||||
board = d1_mini
|
||||
build_type = debug
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} ${common.debug_flags}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:d1_mini_ota]
|
||||
board = d1_mini
|
||||
upload_protocol = espota
|
||||
# exchange for your WLED IP
|
||||
upload_port = "10.10.1.27"
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:anavi_miracle_controller]
|
||||
board = d1_mini
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D LEDPIN=12 -D IRPIN=-1 -D RLYPIN=2
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:lolin_s2_mini]
|
||||
platform = ${esp32s2.platform}
|
||||
platform_packages = ${esp32s2.platform_packages}
|
||||
board = lolin_s2_mini
|
||||
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
|
||||
build_unflags = ${common.build_unflags} #-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
;board_build.flash_mode = qio
|
||||
;board_build.f_flash = 80000000L
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=ESP32-S2
|
||||
-DBOARD_HAS_PSRAM
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1 # try disabling and enabling unflag above in case of board-specific issues, will disable Serial
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DARDUINO_USB_MSC_ON_BOOT=0
|
||||
-DARDUINO_USB_DFU_ON_BOOT=0
|
||||
-DLOLIN_WIFI_FIX ; seems to work much better with this
|
||||
-D WLED_USE_PSRAM
|
||||
; -D WLED_USE_UNREAL_MATH ;; may cause wrong sunset/sunrise times, but saves 6792 bytes FLASH
|
||||
-D WLED_WATCHDOG_TIMEOUT=0
|
||||
-D CONFIG_ASYNC_TCP_USE_WDT=0
|
||||
-D LEDPIN=16
|
||||
-D BTNPIN=18
|
||||
-D RLYPIN=9
|
||||
-D IRPIN=7
|
||||
-D HW_PIN_SCL=35
|
||||
-D HW_PIN_SDA=33
|
||||
-D HW_PIN_CLOCKSPI=7
|
||||
@ -631,188 +461,3 @@ build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=
|
||||
-D HW_PIN_MISOSPI=9
|
||||
; -D STATUSLED=15
|
||||
lib_deps = ${esp32s2.lib_deps}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# custom board configurations
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[env:esp32c3dev_2MB]
|
||||
;; for ESP32-C3 boards with 2MB flash (instead of 4MB).
|
||||
;; this board need a specific partition file. OTA not possible.
|
||||
extends = esp32c3
|
||||
platform = ${esp32c3.platform}
|
||||
platform_packages = ${esp32c3.platform_packages}
|
||||
board = esp32-c3-devkitm-1
|
||||
build_flags = ${common.build_flags} ${esp32c3.build_flags} #-D WLED_RELEASE_NAME=ESP32-C3
|
||||
-D WLED_WATCHDOG_TIMEOUT=0
|
||||
-D WLED_DISABLE_OTA
|
||||
; -DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual CDC USB
|
||||
-DARDUINO_USB_CDC_ON_BOOT=0 ;; for serial-to-USB chip
|
||||
build_unflags = ${common.build_unflags}
|
||||
upload_speed = 115200
|
||||
lib_deps = ${esp32c3.lib_deps}
|
||||
board_build.partitions = tools/WLED_ESP32_2MB_noOTA.csv
|
||||
board_build.flash_mode = dio
|
||||
|
||||
[env:wemos_shield_esp32]
|
||||
board = esp32dev
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
upload_speed = 460800
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp32}
|
||||
-D LEDPIN=16
|
||||
-D RLYPIN=19
|
||||
-D BTNPIN=17
|
||||
-D IRPIN=18
|
||||
-D UWLED_USE_MY_CONFIG
|
||||
-D USERMOD_DALLASTEMPERATURE
|
||||
-D USERMOD_FOUR_LINE_DISPLAY
|
||||
-D TEMPERATURE_PIN=23
|
||||
-D USE_ALT_DISPlAY ; new versions of USERMOD_FOUR_LINE_DISPLAY and USERMOD_ROTARY_ENCODER_UI
|
||||
-D USERMOD_AUDIOREACTIVE
|
||||
lib_deps = ${esp32.lib_deps}
|
||||
OneWire@~2.3.5
|
||||
olikraus/U8g2 @ ^2.28.8
|
||||
https://github.com/blazoncek/arduinoFFT.git
|
||||
board_build.partitions = ${esp32.default_partitions}
|
||||
|
||||
[env:m5atom]
|
||||
board = esp32dev
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp32} -D LEDPIN=27 -D BTNPIN=39
|
||||
lib_deps = ${esp32.lib_deps}
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
board_build.partitions = ${esp32.default_partitions}
|
||||
|
||||
[env:sp501e]
|
||||
board = esp_wroom_02
|
||||
platform = ${common.platform_wled_default}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 -D BTNPIN=1
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:sp511e]
|
||||
board = esp_wroom_02
|
||||
platform = ${common.platform_wled_default}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 -D BTNPIN=2 -D IRPIN=5 -D WLED_MAX_BUTTONS=3
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:Athom_RGBCW] ;7w and 5w(GU10) bulbs
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=-1 -D RLYPIN=-1 -D DATA_PINS=4,12,14,13,5
|
||||
-D DEFAULT_LED_TYPE=TYPE_ANALOG_5CH -D WLED_DISABLE_INFRARED -D WLED_MAX_CCT_BLEND=0
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
|
||||
[env:Athom_15w_RGBCW] ;15w bulb
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=-1 -D RLYPIN=-1 -D DATA_PINS=4,12,14,5,13
|
||||
-D DEFAULT_LED_TYPE=TYPE_ANALOG_5CH -D WLED_DISABLE_INFRARED -D WLED_MAX_CCT_BLEND=0 -D WLED_USE_IC_CCT
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
|
||||
[env:Athom_3Pin_Controller] ;small controller with only data
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=0 -D RLYPIN=-1 -D LEDPIN=1 -D WLED_DISABLE_INFRARED
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
|
||||
[env:Athom_4Pin_Controller] ; With clock and data interface
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=0 -D RLYPIN=12 -D LEDPIN=1 -D WLED_DISABLE_INFRARED
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
|
||||
[env:Athom_5Pin_Controller] ;Analog light strip controller
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=0 -D RLYPIN=-1 DATA_PINS=4,12,14,13 -D WLED_DISABLE_INFRARED
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
|
||||
[env:MY9291]
|
||||
board = esp01_1m
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_1m128k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01 -D WLED_DISABLE_OTA -D USERMOD_MY9291
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# codm pixel controller board configurations
|
||||
# codm-controller-0_6 can also be used for the TYWE3S controller
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[env:codm-controller-0_6]
|
||||
board = esp_wroom_02
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:codm-controller-0_6-rev2]
|
||||
board = esp_wroom_02
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# EleksTube-IPS
|
||||
# ------------------------------------------------------------------------------
|
||||
[env:elekstube_ips]
|
||||
board = esp32dev
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
upload_speed = 921600
|
||||
build_flags = ${common.build_flags_esp32} -D WLED_DISABLE_BROWNOUT_DET -D WLED_DISABLE_INFRARED
|
||||
-D USERMOD_RTC
|
||||
-D USERMOD_ELEKSTUBE_IPS
|
||||
-D LEDPIN=12
|
||||
-D RLYPIN=27
|
||||
-D BTNPIN=34
|
||||
-D DEFAULT_LED_COUNT=6
|
||||
# Display config
|
||||
-D ST7789_DRIVER
|
||||
-D TFT_WIDTH=135
|
||||
-D TFT_HEIGHT=240
|
||||
-D CGRAM_OFFSET
|
||||
-D TFT_SDA_READ
|
||||
-D TFT_MOSI=23
|
||||
-D TFT_SCLK=18
|
||||
-D TFT_DC=25
|
||||
-D TFT_RST=26
|
||||
-D SPI_FREQUENCY=40000000
|
||||
-D USER_SETUP_LOADED
|
||||
monitor_filters = esp32_exception_decoder
|
||||
lib_deps =
|
||||
${esp32.lib_deps}
|
||||
TFT_eSPI @ ^2.3.70
|
||||
board_build.partitions = ${esp32.default_partitions}
|
||||
|
@ -1,65 +0,0 @@
|
||||
# Example PlatformIO Project Configuration Override
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copy to platformio_override.ini to activate overrides
|
||||
# ------------------------------------------------------------------------------
|
||||
# Please visit documentation: https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[platformio]
|
||||
default_envs = WLED_tasmota_1M
|
||||
|
||||
[env:WLED_tasmota_1M]
|
||||
board = esp01_1m
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_1m128k}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
; *********************************************************************
|
||||
; *** Use custom settings from file my_config.h
|
||||
-DWLED_USE_MY_CONFIG
|
||||
; *********************************************************************
|
||||
;
|
||||
;
|
||||
; *** To use the below defines/overrides, copy and paste each onto it's own line just below build_flags in the section above.
|
||||
;
|
||||
; disable specific features
|
||||
; -D WLED_DISABLE_OTA
|
||||
; -D WLED_DISABLE_ALEXA
|
||||
; -D WLED_DISABLE_HUESYNC
|
||||
; -D WLED_DISABLE_INFRARED
|
||||
; -D WLED_DISABLE_WEBSOCKETS
|
||||
; PIN defines - uncomment and change, if needed:
|
||||
; -D LEDPIN=2
|
||||
; -D BTNPIN=0
|
||||
; -D TOUCHPIN=T0
|
||||
; -D IRPIN=4
|
||||
; -D RLYPIN=12
|
||||
; -D RLYMDE=1
|
||||
; digital LED strip types - uncomment only one ! - this will disable WS281x / SK681x support
|
||||
; -D USE_APA102
|
||||
; -D USE_WS2801
|
||||
; -D USE_LPD8806
|
||||
; PIN defines for 2 wire LEDs
|
||||
-D CLKPIN=0
|
||||
-D DATAPIN=2
|
||||
; to drive analog LED strips (aka 5050) hardware configuration is no longer necessary
|
||||
; configure the settings in the UI as follows (hard):
|
||||
; for the Magic Home LED Controller use PWM pins 5,12,13,15
|
||||
; for the H801 controller use PINs 15,13,12,14 (W2 = 04)
|
||||
; for the BW-LT11 controller use PINs 12,4,14,5
|
||||
;
|
||||
; set the name of the module - make sure there is a quote-backslash-quote before the name and a backslash-quote-quote after the name
|
||||
; -D SERVERNAME="\"WLED\""
|
||||
;
|
||||
; set the number of LEDs
|
||||
; -D DEFAULT_LED_COUNT=30
|
||||
;
|
||||
; set milliampere limit when using ESP pin to power leds
|
||||
; -D ABL_MILLIAMPS_DEFAULT=850
|
||||
;
|
||||
; enable IR by setting remote type
|
||||
; -D IRTYPE=0 ;0 Remote disabled | 1 24-key RGB | 2 24-key with CT | 3 40-key blue | 4 40-key RGB | 5 21-key RGB | 6 6-key black | 7 9-key red | 8 JSON remote
|
||||
;
|
||||
; set default color order of your led strip
|
||||
; -D DEFAULT_LED_COLOR_ORDER=COL_ORDER_GRB
|
495
platformio_override.sample.ini
Normal file
495
platformio_override.sample.ini
Normal file
@ -0,0 +1,495 @@
|
||||
# Example PlatformIO Project Configuration Override
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copy to platformio_override.ini to activate overrides
|
||||
# ------------------------------------------------------------------------------
|
||||
# Please visit documentation: https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[platformio]
|
||||
default_envs = WLED_tasmota_1M # define as many as you need
|
||||
|
||||
#----------
|
||||
# SAMPLE
|
||||
#----------
|
||||
[env:WLED_tasmota_1M]
|
||||
extends = env:esp01_1m_full # when you want to extend the existing environment (define only updated options)
|
||||
; board = esp01_1m # uncomment when ou need different board
|
||||
; platform = ${common.platform_wled_default} # uncomment and change when you want particular platform
|
||||
; platform_packages = ${common.platform_packages}
|
||||
; board_build.ldscript = ${common.ldscript_1m128k}
|
||||
; upload_speed = 921600 # fast upload speed (remove ';' if your board supports fast upload speed)
|
||||
# Sample libraries used for various usermods. Uncomment when using particular usermod.
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
; olikraus/U8g2 # @~2.33.15
|
||||
; paulstoffregen/OneWire@~2.3.8
|
||||
; adafruit/Adafruit Unified Sensor@^1.1.4
|
||||
; adafruit/DHT sensor library@^1.4.1
|
||||
; adafruit/Adafruit BME280 Library@^2.2.2
|
||||
; Wire
|
||||
; robtillaart/SHT85@~0.3.3
|
||||
; gmag11/QuickESPNow ;@ 0.6.2
|
||||
; https://github.com/blazoncek/QuickESPNow.git#optional-debug ;; exludes debug library
|
||||
; https://github.com/kosme/arduinoFFT#develop @ 1.9.2+sha.419d7b0 ;; used for USERMOD_AUDIOREACTIVE - using "known working" hash
|
||||
; build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
;
|
||||
; *** To use the below defines/overrides, copy and paste each onto it's own line just below build_flags in the section above.
|
||||
;
|
||||
; disable specific features
|
||||
; -D WLED_DISABLE_OTA
|
||||
; -D WLED_DISABLE_ALEXA
|
||||
; -D WLED_DISABLE_HUESYNC
|
||||
; -D WLED_DISABLE_LOXONE
|
||||
; -D WLED_DISABLE_INFRARED
|
||||
; -D WLED_DISABLE_WEBSOCKETS
|
||||
; -D WLED_DISABLE_MQTT
|
||||
; -D WLED_DISABLE_ADALIGHT
|
||||
; -D WLED_DISABLE_2D
|
||||
; -D WLED_DISABLE_PXMAGIC
|
||||
; -D WLED_DISABLE_ESPNOW
|
||||
; -D WLED_DISABLE_BROWNOUT_DET
|
||||
;
|
||||
; PIN defines - uncomment and change, if needed:
|
||||
; -D LEDPIN=2
|
||||
; or use this for multiple outputs
|
||||
; -D DATA_PINS=1,3
|
||||
; -D BTNPIN=0
|
||||
; -D IRPIN=4
|
||||
; -D RLYPIN=12
|
||||
; -D RLYMDE=1
|
||||
; -D LED_BUILTIN=2 # GPIO of built-in LED
|
||||
;
|
||||
; Limit max buses
|
||||
; -D WLED_MAX_BUSSES=2
|
||||
;
|
||||
; Configure default WiFi
|
||||
; -D CLIENT_SSID='"MyNetwork"'
|
||||
; -D CLIENT_PASS='"Netw0rkPassw0rd"'
|
||||
;
|
||||
; Configure and use Ethernet
|
||||
; -D WLED_USE_ETHERNET
|
||||
; -D WLED_ETH_DEFAULT=5
|
||||
; do not use pins 5, (16,) 17, 18, 19, 21, 22, 23, 25, 26, 27 for anything but ethernet
|
||||
; -D PHY_ADDR=0 -D ETH_PHY_POWER=5 -D ETH_PHY_MDC=23 -D ETH_PHY_MDIO=18
|
||||
; -D ETH_CLK_MODE=ETH_CLOCK_GPIO17_OUT
|
||||
;
|
||||
; NTP time configuration
|
||||
; -D WLED_NTP_ENABLED=true
|
||||
; -D WLED_TIMEZONE=2
|
||||
; -D WLED_LAT=48.86
|
||||
; -D WLED_LON=2.33
|
||||
;
|
||||
; Use Watchdog timer with 10s guard
|
||||
; -D WLED_WATCHDOG_TIMEOUT=10
|
||||
;
|
||||
; Create debug build (with remote debug)
|
||||
; -D WLED_DEBUG
|
||||
; -D WLED_DEBUG_HOST='"192.168.0.100"'
|
||||
; -D WLED_DEBUG_PORT=7868
|
||||
;
|
||||
; Use Autosave usermod and set it to do save after 90s
|
||||
; -D USERMOD_AUTO_SAVE
|
||||
; -D AUTOSAVE_AFTER_SEC=90
|
||||
;
|
||||
; Use 4 Line Display usermod with SPI display
|
||||
; -D USERMOD_FOUR_LINE_DISPLAY
|
||||
; -D USE_ALT_DISPlAY # mandatory
|
||||
; -DFLD_SPI_DEFAULT
|
||||
; -D FLD_TYPE=SSD1306_SPI64
|
||||
; -D FLD_PIN_CLOCKSPI=14
|
||||
; -D FLD_PIN_DATASPI=13
|
||||
; -D FLD_PIN_DC=26
|
||||
; -D FLD_PIN_CS=15
|
||||
; -D FLD_PIN_RESET=27
|
||||
;
|
||||
; Use Rotary encoder usermod (in conjunction with 4LD)
|
||||
; -D USERMOD_ROTARY_ENCODER_UI
|
||||
; -D ENCODER_DT_PIN=5
|
||||
; -D ENCODER_CLK_PIN=18
|
||||
; -D ENCODER_SW_PIN=19
|
||||
;
|
||||
; Use Dallas DS18B20 temperature sensor usermod and configure it to use GPIO13
|
||||
; -D USERMOD_DALLASTEMPERATURE
|
||||
; -D TEMPERATURE_PIN=13
|
||||
;
|
||||
; Use Multi Relay usermod and configure it to use 6 relays and appropriate GPIO
|
||||
; -D USERMOD_MULTI_RELAY
|
||||
; -D MULTI_RELAY_MAX_RELAYS=6
|
||||
; -D MULTI_RELAY_PINS=12,23,22,21,24,25
|
||||
;
|
||||
; Use PIR sensor usermod and configure it to use GPIO4 and timer of 60s
|
||||
; -D USERMOD_PIRSWITCH
|
||||
; -D PIR_SENSOR_PIN=4
|
||||
; -D PIR_SENSOR_OFF_SEC=60
|
||||
;
|
||||
; Use Audioreactive usermod and configure I2S microphone
|
||||
; -D USERMOD_AUDIOREACTIVE
|
||||
; -D UM_AUDIOREACTIVE_USE_NEW_FFT
|
||||
; -D AUDIOPIN=-1
|
||||
; -D DMTYPE=1 # 0-analog/disabled, 1-I2S generic, 2-ES7243, 3-SPH0645, 4-I2S+mclk, 5-I2S PDM
|
||||
; -D I2S_SDPIN=36
|
||||
; -D I2S_WSPIN=23
|
||||
; -D I2S_CKPIN=19
|
||||
;
|
||||
; Use PWM fan usermod
|
||||
; -D USERMOD_PWM_FAN
|
||||
; -D TACHO_PIN=33
|
||||
; -D PWM_PIN=32
|
||||
;
|
||||
; Use built-in or custom LED as a status indicator (assumes LED is connected to GPIO16)
|
||||
; -D STATUSLED=16
|
||||
;
|
||||
; set the name of the module - make sure there is a quote-backslash-quote before the name and a backslash-quote-quote after the name
|
||||
; -D SERVERNAME="\"WLED\""
|
||||
;
|
||||
; set the number of LEDs
|
||||
; -D DEFAULT_LED_COUNT=30
|
||||
; or this for multiple outputs
|
||||
; -D PIXEL_COUNTS=30,30
|
||||
;
|
||||
; set milliampere limit when using ESP pin to power leds
|
||||
; -D ABL_MILLIAMPS_DEFAULT=850
|
||||
;
|
||||
; enable IR by setting remote type
|
||||
; -D IRTYPE=0 ;0 Remote disabled | 1 24-key RGB | 2 24-key with CT | 3 40-key blue | 4 40-key RGB | 5 21-key RGB | 6 6-key black | 7 9-key red | 8 JSON remote
|
||||
;
|
||||
; set default color order of your led strip
|
||||
; -D DEFAULT_LED_COLOR_ORDER=COL_ORDER_GRB
|
||||
;
|
||||
; use PSRAM if a device (ESP) has one
|
||||
; -DBOARD_HAS_PSRAM
|
||||
; -D WLED_USE_PSRAM
|
||||
;
|
||||
; configure I2C and SPI interface (for various hardware)
|
||||
; -D I2CSDAPIN=33 # initialise interface
|
||||
; -D I2CSCLPIN=35 # initialise interface
|
||||
; -D HW_PIN_SCL=35
|
||||
; -D HW_PIN_SDA=33
|
||||
; -D HW_PIN_CLOCKSPI=7
|
||||
; -D HW_PIN_DATASPI=11
|
||||
; -D HW_PIN_MISOSPI=9
|
||||
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# PRE-CONFIGURED DEVELOPMENT BOARDS AND CONTROLLERS
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[env:esp07]
|
||||
board = esp07
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:d1_mini]
|
||||
board = d1_mini
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
upload_speed = 921600
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
monitor_filters = esp8266_exception_decoder
|
||||
|
||||
[env:heltec_wifi_kit_8]
|
||||
board = d1_mini
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:h803wf]
|
||||
board = d1_mini
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D LEDPIN=1 -D WLED_DISABLE_INFRARED
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:esp32dev_qio80]
|
||||
board = esp32dev
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_qio80 #-D WLED_DISABLE_BROWNOUT_DET
|
||||
lib_deps = ${esp32.lib_deps}
|
||||
monitor_filters = esp32_exception_decoder
|
||||
board_build.partitions = ${esp32.default_partitions}
|
||||
board_build.f_flash = 80000000L
|
||||
board_build.flash_mode = qio
|
||||
|
||||
[env:esp32dev_V4_dio80]
|
||||
;; experimental ESP32 env using ESP-IDF V4.4.x
|
||||
;; Warning: this build environment is not stable!!
|
||||
;; please erase your device before installing.
|
||||
board = esp32dev
|
||||
platform = ${esp32_idf_V4.platform}
|
||||
platform_packages = ${esp32_idf_V4.platform_packages}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=ESP32_V4_qio80 #-D WLED_DISABLE_BROWNOUT_DET
|
||||
lib_deps = ${esp32_idf_V4.lib_deps}
|
||||
monitor_filters = esp32_exception_decoder
|
||||
board_build.partitions = ${esp32_idf_V4.default_partitions}
|
||||
board_build.f_flash = 80000000L
|
||||
board_build.flash_mode = dio
|
||||
|
||||
[env:esp32s2_saola]
|
||||
board = esp32-s2-saola-1
|
||||
platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.2/platform-tasmota-espressif32-2.0.2.zip
|
||||
platform_packages =
|
||||
framework = arduino
|
||||
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
|
||||
board_build.flash_mode = qio
|
||||
upload_speed = 460800
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags} ${esp32s2.build_flags} #-D WLED_RELEASE_NAME=S2_saola
|
||||
;-DLOLIN_WIFI_FIX ;; try this in case Wifi does not work
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
lib_deps = ${esp32s2.lib_deps}
|
||||
|
||||
[env:esp32s3dev_8MB_PSRAM_qspi]
|
||||
;; ESP32-TinyS3 development board, with 8MB FLASH and PSRAM (memory_type: qio_qspi)
|
||||
extends = env:esp32s3dev_8MB_PSRAM_opi
|
||||
;board = um_tinys3 ; -> needs workaround from https://github.com/Aircoookie/WLED/pull/2905#issuecomment-1328049860
|
||||
board = esp32-s3-devkitc-1 ;; generic dev board; the next line adds PSRAM support
|
||||
board_build.arduino.memory_type = qio_qspi ;; use with PSRAM: 2MB or 4MB
|
||||
|
||||
[env:esp8285_4CH_MagicHome]
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_1m128k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:esp8285_H801]
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_1m128k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:d1_mini_5CH_Shojo_PCB]
|
||||
board = d1_mini
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_USE_SHOJO_PCB
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:d1_mini_debug]
|
||||
board = d1_mini
|
||||
build_type = debug
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} ${common.debug_flags}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:d1_mini_ota]
|
||||
board = d1_mini
|
||||
upload_protocol = espota
|
||||
# exchange for your WLED IP
|
||||
upload_port = "10.10.1.27"
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:anavi_miracle_controller]
|
||||
board = d1_mini
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D LEDPIN=12 -D IRPIN=-1 -D RLYPIN=2
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:esp32c3dev_2MB]
|
||||
;; for ESP32-C3 boards with 2MB flash (instead of 4MB).
|
||||
;; this board need a specific partition file. OTA not possible.
|
||||
extends = esp32c3
|
||||
platform = ${esp32c3.platform}
|
||||
platform_packages = ${esp32c3.platform_packages}
|
||||
board = esp32-c3-devkitm-1
|
||||
build_flags = ${common.build_flags} ${esp32c3.build_flags} #-D WLED_RELEASE_NAME=ESP32-C3
|
||||
-D WLED_WATCHDOG_TIMEOUT=0
|
||||
-D WLED_DISABLE_OTA
|
||||
; -DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual CDC USB
|
||||
-DARDUINO_USB_CDC_ON_BOOT=0 ;; for serial-to-USB chip
|
||||
build_unflags = ${common.build_unflags}
|
||||
upload_speed = 115200
|
||||
lib_deps = ${esp32c3.lib_deps}
|
||||
board_build.partitions = tools/WLED_ESP32_2MB_noOTA.csv
|
||||
board_build.flash_mode = dio
|
||||
|
||||
[env:wemos_shield_esp32]
|
||||
board = esp32dev
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
upload_speed = 460800
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp32}
|
||||
-D LEDPIN=16
|
||||
-D RLYPIN=19
|
||||
-D BTNPIN=17
|
||||
-D IRPIN=18
|
||||
-D UWLED_USE_MY_CONFIG
|
||||
-D USERMOD_DALLASTEMPERATURE
|
||||
-D USERMOD_FOUR_LINE_DISPLAY
|
||||
-D TEMPERATURE_PIN=23
|
||||
-D USE_ALT_DISPlAY ; new versions of USERMOD_FOUR_LINE_DISPLAY and USERMOD_ROTARY_ENCODER_UI
|
||||
-D USERMOD_AUDIOREACTIVE
|
||||
lib_deps = ${esp32.lib_deps}
|
||||
OneWire@~2.3.5
|
||||
olikraus/U8g2 @ ^2.28.8
|
||||
https://github.com/blazoncek/arduinoFFT.git
|
||||
board_build.partitions = ${esp32.default_partitions}
|
||||
|
||||
[env:m5atom]
|
||||
board = esp32dev
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp32} -D LEDPIN=27 -D BTNPIN=39
|
||||
lib_deps = ${esp32.lib_deps}
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
board_build.partitions = ${esp32.default_partitions}
|
||||
|
||||
[env:sp501e]
|
||||
board = esp_wroom_02
|
||||
platform = ${common.platform_wled_default}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 -D BTNPIN=1
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:sp511e]
|
||||
board = esp_wroom_02
|
||||
platform = ${common.platform_wled_default}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_flags = ${common.build_flags_esp8266} -D LEDPIN=3 -D BTNPIN=2 -D IRPIN=5 -D WLED_MAX_BUTTONS=3
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:Athom_RGBCW] ;7w and 5w(GU10) bulbs
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=-1 -D RLYPIN=-1 -D DATA_PINS=4,12,14,13,5
|
||||
-D DEFAULT_LED_TYPE=TYPE_ANALOG_5CH -D WLED_DISABLE_INFRARED -D WLED_MAX_CCT_BLEND=0
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:Athom_15w_RGBCW] ;15w bulb
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=-1 -D RLYPIN=-1 -D DATA_PINS=4,12,14,5,13
|
||||
-D DEFAULT_LED_TYPE=TYPE_ANALOG_5CH -D WLED_DISABLE_INFRARED -D WLED_MAX_CCT_BLEND=0 -D WLED_USE_IC_CCT
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:Athom_3Pin_Controller] ;small controller with only data
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=0 -D RLYPIN=-1 -D LEDPIN=1 -D WLED_DISABLE_INFRARED
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:Athom_4Pin_Controller] ; With clock and data interface
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=0 -D RLYPIN=12 -D LEDPIN=1 -D WLED_DISABLE_INFRARED
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:Athom_5Pin_Controller] ;Analog light strip controller
|
||||
board = esp8285
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D BTNPIN=0 -D RLYPIN=-1 DATA_PINS=4,12,14,13 -D WLED_DISABLE_INFRARED
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:MY9291]
|
||||
board = esp01_1m
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_1m128k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01 -D WLED_DISABLE_OTA -D USERMOD_MY9291
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# codm pixel controller board configurations
|
||||
# codm-controller-0_6 can also be used for the TYWE3S controller
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
[env:codm-controller-0_6]
|
||||
board = esp_wroom_02
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_2m512k}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
[env:codm-controller-0_6-rev2]
|
||||
board = esp_wroom_02
|
||||
platform = ${common.platform_wled_default}
|
||||
platform_packages = ${common.platform_packages}
|
||||
board_build.ldscript = ${common.ldscript_4m1m}
|
||||
build_unflags = ${common.build_unflags}
|
||||
build_flags = ${common.build_flags_esp8266}
|
||||
lib_deps = ${esp8266.lib_deps}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# EleksTube-IPS
|
||||
# ------------------------------------------------------------------------------
|
||||
[env:elekstube_ips]
|
||||
board = esp32dev
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
upload_speed = 921600
|
||||
build_flags = ${common.build_flags_esp32} -D WLED_DISABLE_BROWNOUT_DET -D WLED_DISABLE_INFRARED
|
||||
-D USERMOD_RTC
|
||||
-D USERMOD_ELEKSTUBE_IPS
|
||||
-D LEDPIN=12
|
||||
-D RLYPIN=27
|
||||
-D BTNPIN=34
|
||||
-D DEFAULT_LED_COUNT=6
|
||||
# Display config
|
||||
-D ST7789_DRIVER
|
||||
-D TFT_WIDTH=135
|
||||
-D TFT_HEIGHT=240
|
||||
-D CGRAM_OFFSET
|
||||
-D TFT_SDA_READ
|
||||
-D TFT_MOSI=23
|
||||
-D TFT_SCLK=18
|
||||
-D TFT_DC=25
|
||||
-D TFT_RST=26
|
||||
-D SPI_FREQUENCY=40000000
|
||||
-D USER_SETUP_LOADED
|
||||
monitor_filters = esp32_exception_decoder
|
||||
lib_deps =
|
||||
${esp32.lib_deps}
|
||||
TFT_eSPI @ ^2.3.70
|
||||
board_build.partitions = ${esp32.default_partitions}
|
205
tools/cdata-test.js
Normal file
205
tools/cdata-test.js
Normal file
@ -0,0 +1,205 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('node:assert');
|
||||
const { describe, it, before, after } = require('node:test');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const child_process = require('child_process');
|
||||
const util = require('util');
|
||||
const execPromise = util.promisify(child_process.exec);
|
||||
|
||||
process.env.NODE_ENV = 'test'; // Set the environment to testing
|
||||
const cdata = require('./cdata.js');
|
||||
|
||||
describe('Function', () => {
|
||||
const testFolderPath = path.join(__dirname, 'testFolder');
|
||||
const oldFilePath = path.join(testFolderPath, 'oldFile.txt');
|
||||
const newFilePath = path.join(testFolderPath, 'newFile.txt');
|
||||
|
||||
// Create a temporary file before the test
|
||||
before(() => {
|
||||
// Create test folder
|
||||
if (!fs.existsSync(testFolderPath)) {
|
||||
fs.mkdirSync(testFolderPath);
|
||||
}
|
||||
|
||||
// Create an old file
|
||||
fs.writeFileSync(oldFilePath, 'This is an old file.');
|
||||
// Modify the 'mtime' to simulate an old file
|
||||
const oldTime = new Date();
|
||||
oldTime.setFullYear(oldTime.getFullYear() - 1);
|
||||
fs.utimesSync(oldFilePath, oldTime, oldTime);
|
||||
|
||||
// Create a new file
|
||||
fs.writeFileSync(newFilePath, 'This is a new file.');
|
||||
});
|
||||
|
||||
// delete the temporary files after the test
|
||||
after(() => {
|
||||
fs.rmSync(testFolderPath, { recursive: true });
|
||||
});
|
||||
|
||||
describe('isFileNewerThan', async () => {
|
||||
it('should return true if the file is newer than the provided time', async () => {
|
||||
const pastTime = Date.now() - 10000; // 10 seconds ago
|
||||
assert.strictEqual(cdata.isFileNewerThan(newFilePath, pastTime), true);
|
||||
});
|
||||
|
||||
it('should return false if the file is older than the provided time', async () => {
|
||||
assert.strictEqual(cdata.isFileNewerThan(oldFilePath, Date.now()), false);
|
||||
});
|
||||
|
||||
it('should throw an exception if the file does not exist', async () => {
|
||||
assert.throws(() => {
|
||||
cdata.isFileNewerThan('nonexistent.txt', Date.now());
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('isAnyFileInFolderNewerThan', async () => {
|
||||
it('should return true if a file in the folder is newer than the given time', async () => {
|
||||
const time = fs.statSync(path.join(testFolderPath, 'oldFile.txt')).mtime;
|
||||
assert.strictEqual(cdata.isAnyFileInFolderNewerThan(testFolderPath, time), true);
|
||||
});
|
||||
|
||||
it('should return false if no files in the folder are newer than the given time', async () => {
|
||||
assert.strictEqual(cdata.isAnyFileInFolderNewerThan(testFolderPath, new Date()), false);
|
||||
});
|
||||
|
||||
it('should throw an exception if the folder does not exist', async () => {
|
||||
assert.throws(() => {
|
||||
cdata.isAnyFileInFolderNewerThan('nonexistent', new Date());
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Script', () => {
|
||||
const folderPath = 'wled00';
|
||||
const dataPath = path.join(folderPath, 'data');
|
||||
|
||||
before(() => {
|
||||
process.env.NODE_ENV = 'production';
|
||||
// Backup files
|
||||
fs.cpSync("wled00/data", "wled00Backup", { recursive: true });
|
||||
fs.cpSync("tools/cdata.js", "cdata.bak.js");
|
||||
});
|
||||
after(() => {
|
||||
// Restore backup
|
||||
fs.rmSync("wled00/data", { recursive: true });
|
||||
fs.renameSync("wled00Backup", "wled00/data");
|
||||
fs.rmSync("tools/cdata.js");
|
||||
fs.renameSync("cdata.bak.js", "tools/cdata.js");
|
||||
});
|
||||
|
||||
// delete all html_*.h files
|
||||
async function deleteBuiltFiles() {
|
||||
const files = await fs.promises.readdir(folderPath);
|
||||
await Promise.all(files.map(file => {
|
||||
if (file.startsWith('html_') && path.extname(file) === '.h') {
|
||||
return fs.promises.unlink(path.join(folderPath, file));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
// check if html_*.h files were created
|
||||
async function checkIfBuiltFilesExist() {
|
||||
const files = await fs.promises.readdir(folderPath);
|
||||
const htmlFiles = files.filter(file => file.startsWith('html_') && path.extname(file) === '.h');
|
||||
assert(htmlFiles.length > 0, 'html_*.h files were not created');
|
||||
}
|
||||
|
||||
async function runAndCheckIfBuiltFilesExist() {
|
||||
await execPromise('node tools/cdata.js');
|
||||
await checkIfBuiltFilesExist();
|
||||
}
|
||||
|
||||
async function checkIfFileWasNewlyCreated(file) {
|
||||
const modifiedTime = fs.statSync(file).mtimeMs;
|
||||
assert(Date.now() - modifiedTime < 500, file + ' was not modified');
|
||||
}
|
||||
|
||||
async function testFileModification(sourceFilePath, resultFile) {
|
||||
// run cdata.js to ensure html_*.h files are created
|
||||
await execPromise('node tools/cdata.js');
|
||||
|
||||
// modify file
|
||||
fs.appendFileSync(sourceFilePath, ' ');
|
||||
// delay for 1 second to ensure the modified time is different
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
// run script cdata.js again and wait for it to finish
|
||||
await execPromise('node tools/cdata.js');
|
||||
|
||||
checkIfFileWasNewlyCreated(path.join(folderPath, resultFile));
|
||||
}
|
||||
|
||||
describe('should build if', () => {
|
||||
it('html_*.h files are missing', async () => {
|
||||
await deleteBuiltFiles();
|
||||
await runAndCheckIfBuiltFilesExist();
|
||||
});
|
||||
|
||||
it('only one html_*.h file is missing', async () => {
|
||||
// run script cdata.js and wait for it to finish
|
||||
await execPromise('node tools/cdata.js');
|
||||
|
||||
// delete a random html_*.h file
|
||||
let files = await fs.promises.readdir(folderPath);
|
||||
let htmlFiles = files.filter(file => file.startsWith('html_') && path.extname(file) === '.h');
|
||||
const randomFile = htmlFiles[Math.floor(Math.random() * htmlFiles.length)];
|
||||
await fs.promises.unlink(path.join(folderPath, randomFile));
|
||||
|
||||
await runAndCheckIfBuiltFilesExist();
|
||||
});
|
||||
|
||||
it('script was executed with -f or --force', async () => {
|
||||
await execPromise('node tools/cdata.js');
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
await execPromise('node tools/cdata.js --force');
|
||||
await checkIfFileWasNewlyCreated(path.join(folderPath, 'html_ui.h'));
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
await execPromise('node tools/cdata.js -f');
|
||||
await checkIfFileWasNewlyCreated(path.join(folderPath, 'html_ui.h'));
|
||||
});
|
||||
|
||||
it('a file changes', async () => {
|
||||
await testFileModification(path.join(dataPath, 'index.htm'), 'html_ui.h');
|
||||
});
|
||||
|
||||
it('a inlined file changes', async () => {
|
||||
await testFileModification(path.join(dataPath, 'index.js'), 'html_ui.h');
|
||||
});
|
||||
|
||||
it('a settings file changes', async () => {
|
||||
await testFileModification(path.join(dataPath, 'settings_leds.htm'), 'html_ui.h');
|
||||
});
|
||||
|
||||
it('the favicon changes', async () => {
|
||||
await testFileModification(path.join(dataPath, 'favicon.ico'), 'html_ui.h');
|
||||
});
|
||||
|
||||
it('cdata.js changes', async () => {
|
||||
await testFileModification('tools/cdata.js', 'html_ui.h');
|
||||
});
|
||||
});
|
||||
|
||||
describe('should not build if', () => {
|
||||
it('the files are already built', async () => {
|
||||
await deleteBuiltFiles();
|
||||
|
||||
// run script cdata.js and wait for it to finish
|
||||
let startTime = Date.now();
|
||||
await execPromise('node tools/cdata.js');
|
||||
const firstRunTime = Date.now() - startTime;
|
||||
|
||||
// run script cdata.js and wait for it to finish
|
||||
startTime = Date.now();
|
||||
await execPromise('node tools/cdata.js');
|
||||
const secondRunTime = Date.now() - startTime;
|
||||
|
||||
// check if second run was faster than the first (must be at least 2x faster)
|
||||
assert(secondRunTime < firstRunTime / 2, 'html_*.h files were rebuilt');
|
||||
});
|
||||
});
|
||||
});
|
279
tools/cdata.js
279
tools/cdata.js
@ -16,28 +16,59 @@
|
||||
*/
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require('path');
|
||||
const path = require("path");
|
||||
const inliner = require("inliner");
|
||||
const zlib = require("zlib");
|
||||
const CleanCSS = require("clean-css");
|
||||
const MinifyHTML = require("html-minifier-terser").minify;
|
||||
const minifyHtml = require("html-minifier-terser").minify;
|
||||
const packageJson = require("../package.json");
|
||||
|
||||
// Export functions for testing
|
||||
module.exports = { isFileNewerThan, isAnyFileInFolderNewerThan };
|
||||
|
||||
const output = ["wled00/html_ui.h", "wled00/html_pixart.h", "wled00/html_cpal.h", "wled00/html_pxmagic.h", "wled00/html_settings.h", "wled00/html_other.h"]
|
||||
|
||||
/**
|
||||
*
|
||||
// \x1b[34m is blue, \x1b[36m is cyan, \x1b[0m is reset
|
||||
const wledBanner = `
|
||||
\t\x1b[34m## ## ## ######## ########
|
||||
\t\x1b[34m## ## ## ## ## ## ##
|
||||
\t\x1b[34m## ## ## ## ## ## ##
|
||||
\t\x1b[34m## ## ## ## ###### ## ##
|
||||
\t\x1b[34m## ## ## ## ## ## ##
|
||||
\t\x1b[34m## ## ## ## ## ## ##
|
||||
\t\x1b[34m ### ### ######## ######## ########
|
||||
\t\t\x1b[36mbuild script for web UI
|
||||
\x1b[0m`;
|
||||
|
||||
const singleHeader = `/*
|
||||
* Binary array for the Web UI.
|
||||
* gzip is used for smaller size and improved speeds.
|
||||
*
|
||||
* Please see https://kno.wled.ge/advanced/custom-features/#changing-web-ui
|
||||
* to find out how to easily modify the web UI source!
|
||||
*/
|
||||
function hexdump(buffer,isHex=false) {
|
||||
|
||||
`;
|
||||
|
||||
const multiHeader = `/*
|
||||
* More web UI HTML source arrays.
|
||||
* This file is auto generated, please don't make any changes manually.
|
||||
*
|
||||
* Instead, see https://kno.wled.ge/advanced/custom-features/#changing-web-ui
|
||||
* to find out how to easily modify the web UI source!
|
||||
*/
|
||||
`;
|
||||
|
||||
function hexdump(buffer, isHex = false) {
|
||||
let lines = [];
|
||||
|
||||
for (let i = 0; i < buffer.length; i +=(isHex?32:16)) {
|
||||
for (let i = 0; i < buffer.length; i += (isHex ? 32 : 16)) {
|
||||
var block;
|
||||
let hexArray = [];
|
||||
if (isHex) {
|
||||
block = buffer.slice(i, i + 32)
|
||||
for (let j = 0; j < block.length; j +=2 ) {
|
||||
hexArray.push("0x" + block.slice(j,j+2))
|
||||
for (let j = 0; j < block.length; j += 2) {
|
||||
hexArray.push("0x" + block.slice(j, j + 2))
|
||||
}
|
||||
} else {
|
||||
block = buffer.slice(i, i + 16); // cut buffer into blocks of 16
|
||||
@ -54,183 +85,112 @@ function hexdump(buffer,isHex=false) {
|
||||
return lines.join(",\n");
|
||||
}
|
||||
|
||||
function strReplace(str, search, replacement) {
|
||||
return str.split(search).join(replacement);
|
||||
}
|
||||
|
||||
function adoptVersionAndRepo(html) {
|
||||
let repoUrl = packageJson.repository ? packageJson.repository.url : undefined;
|
||||
if (repoUrl) {
|
||||
repoUrl = repoUrl.replace(/^git\+/, "");
|
||||
repoUrl = repoUrl.replace(/\.git$/, "");
|
||||
// Replace we
|
||||
html = strReplace(html, "https://github.com/atuline/WLED", repoUrl);
|
||||
html = strReplace(html, "https://github.com/Aircoookie/WLED", repoUrl);
|
||||
html = html.replaceAll("https://github.com/atuline/WLED", repoUrl);
|
||||
html = html.replaceAll("https://github.com/Aircoookie/WLED", repoUrl);
|
||||
}
|
||||
let version = packageJson.version;
|
||||
if (version) {
|
||||
html = strReplace(html, "##VERSION##", version);
|
||||
html = html.replaceAll("##VERSION##", version);
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
function filter(str, type) {
|
||||
str = adoptVersionAndRepo(str);
|
||||
if (type === undefined) {
|
||||
async function minify(str, type = "plain") {
|
||||
const options = {
|
||||
collapseWhitespace: true,
|
||||
collapseBooleanAttributes: true,
|
||||
collapseInlineTagWhitespace: true,
|
||||
minifyCSS: true,
|
||||
minifyJS: true,
|
||||
removeAttributeQuotes: true,
|
||||
removeComments: true,
|
||||
sortAttributes: true,
|
||||
sortClassName: true,
|
||||
};
|
||||
|
||||
if (type == "plain") {
|
||||
return str;
|
||||
} else if (type == "css-minify") {
|
||||
return new CleanCSS({}).minify(str).styles;
|
||||
} else if (type == "js-minify") {
|
||||
return MinifyHTML('<script>' + str + '</script>', {
|
||||
collapseWhitespace: true,
|
||||
minifyJS: true,
|
||||
continueOnParseError: false,
|
||||
removeComments: true,
|
||||
}).replace(/<[\/]*script>/g,'');
|
||||
return await minifyHtml('<script>' + str + '</script>', options).replace(/<[\/]*script>/g, '');
|
||||
} else if (type == "html-minify") {
|
||||
return MinifyHTML(str, {
|
||||
collapseWhitespace: true,
|
||||
maxLineLength: 80,
|
||||
minifyCSS: true,
|
||||
minifyJS: true,
|
||||
continueOnParseError: false,
|
||||
removeComments: true,
|
||||
});
|
||||
} else if (type == "html-minify-ui") {
|
||||
return MinifyHTML(str, {
|
||||
collapseWhitespace: true,
|
||||
conservativeCollapse: true,
|
||||
maxLineLength: 80,
|
||||
minifyCSS: true,
|
||||
minifyJS: true,
|
||||
continueOnParseError: false,
|
||||
removeComments: true,
|
||||
});
|
||||
} else {
|
||||
console.warn("Unknown filter: " + type);
|
||||
return str;
|
||||
return await minifyHtml(str, options);
|
||||
}
|
||||
|
||||
throw new Error("Unknown filter: " + type);
|
||||
}
|
||||
|
||||
function writeHtmlGzipped(sourceFile, resultFile, page) {
|
||||
async function writeHtmlGzipped(sourceFile, resultFile, page) {
|
||||
console.info("Reading " + sourceFile);
|
||||
new inliner(sourceFile, function (error, html) {
|
||||
console.info("Inlined " + html.length + " characters");
|
||||
html = filter(html, "html-minify-ui");
|
||||
console.info("Minified to " + html.length + " characters");
|
||||
|
||||
if (error) {
|
||||
console.warn(error);
|
||||
throw error;
|
||||
}
|
||||
new inliner(sourceFile, async function (error, html) {
|
||||
if (error) throw error;
|
||||
|
||||
html = adoptVersionAndRepo(html);
|
||||
zlib.gzip(html, { level: zlib.constants.Z_BEST_COMPRESSION }, function (error, result) {
|
||||
if (error) {
|
||||
console.warn(error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
console.info("Compressed " + result.length + " bytes");
|
||||
const array = hexdump(result);
|
||||
const src = `/*
|
||||
* Binary array for the Web UI.
|
||||
* gzip is used for smaller size and improved speeds.
|
||||
*
|
||||
* Please see https://kno.wled.ge/advanced/custom-features/#changing-web-ui
|
||||
* to find out how to easily modify the web UI source!
|
||||
*/
|
||||
|
||||
// Autogenerated from ${sourceFile}, do not edit!!
|
||||
const uint16_t PAGE_${page}_L = ${result.length};
|
||||
const uint8_t PAGE_${page}[] PROGMEM = {
|
||||
${array}
|
||||
};
|
||||
`;
|
||||
console.info("Writing " + resultFile);
|
||||
fs.writeFileSync(resultFile, src);
|
||||
});
|
||||
const originalLength = html.length;
|
||||
html = await minify(html, "html-minify");
|
||||
const result = zlib.gzipSync(html, { level: zlib.constants.Z_BEST_COMPRESSION });
|
||||
console.info("Minified and compressed " + sourceFile + " from " + originalLength + " to " + result.length + " bytes");
|
||||
const array = hexdump(result);
|
||||
let src = singleHeader;
|
||||
src += `const uint16_t PAGE_${page}_L = ${result.length};\n`;
|
||||
src += `const uint8_t PAGE_${page}[] PROGMEM = {\n${array}\n};\n\n`;
|
||||
console.info("Writing " + resultFile);
|
||||
fs.writeFileSync(resultFile, src);
|
||||
});
|
||||
}
|
||||
|
||||
function specToChunk(srcDir, s) {
|
||||
if (s.method == "plaintext") {
|
||||
const buf = fs.readFileSync(srcDir + "/" + s.file);
|
||||
const str = buf.toString("utf-8");
|
||||
const chunk = `
|
||||
// Autogenerated from ${srcDir}/${s.file}, do not edit!!
|
||||
const char ${s.name}[] PROGMEM = R"${s.prepend || ""}${filter(str, s.filter)}${
|
||||
s.append || ""
|
||||
}";
|
||||
async function specToChunk(srcDir, s) {
|
||||
const buf = fs.readFileSync(srcDir + "/" + s.file);
|
||||
let chunk = `\n// Autogenerated from ${srcDir}/${s.file}, do not edit!!\n`
|
||||
|
||||
`;
|
||||
return s.mangle ? s.mangle(chunk) : chunk;
|
||||
} else if (s.method == "gzip") {
|
||||
const buf = fs.readFileSync(srcDir + "/" + s.file);
|
||||
var str = buf.toString('utf-8');
|
||||
if (s.mangle) str = s.mangle(str);
|
||||
const zip = zlib.gzipSync(filter(str, s.filter), { level: zlib.constants.Z_BEST_COMPRESSION });
|
||||
const result = hexdump(zip.toString('hex'), true);
|
||||
const chunk = `
|
||||
// Autogenerated from ${srcDir}/${s.file}, do not edit!!
|
||||
const uint16_t ${s.name}_length = ${zip.length};
|
||||
const uint8_t ${s.name}[] PROGMEM = {
|
||||
${result}
|
||||
};
|
||||
|
||||
`;
|
||||
return chunk;
|
||||
} else if (s.method == "binary") {
|
||||
const buf = fs.readFileSync(srcDir + "/" + s.file);
|
||||
const result = hexdump(buf);
|
||||
const chunk = `
|
||||
// Autogenerated from ${srcDir}/${s.file}, do not edit!!
|
||||
const uint16_t ${s.name}_length = ${buf.length};
|
||||
const uint8_t ${s.name}[] PROGMEM = {
|
||||
${result}
|
||||
};
|
||||
|
||||
`;
|
||||
return chunk;
|
||||
} else {
|
||||
console.warn("Unknown method: " + s.method);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function writeChunks(srcDir, specs, resultFile) {
|
||||
let src = `/*
|
||||
* More web UI HTML source arrays.
|
||||
* This file is auto generated, please don't make any changes manually.
|
||||
* Instead, see https://kno.wled.ge/advanced/custom-features/#changing-web-ui
|
||||
* to find out how to easily modify the web UI source!
|
||||
*/
|
||||
`;
|
||||
specs.forEach((s) => {
|
||||
const file = srcDir + "/" + s.file;
|
||||
try {
|
||||
console.info("Reading " + file + " as " + s.name);
|
||||
src += specToChunk(srcDir, s);
|
||||
} catch (e) {
|
||||
console.warn(
|
||||
"Failed " + s.name + " from " + file,
|
||||
e.message.length > 60 ? e.message.substring(0, 60) : e.message
|
||||
);
|
||||
if (s.method == "plaintext" || s.method == "gzip") {
|
||||
let str = buf.toString("utf-8");
|
||||
str = adoptVersionAndRepo(str);
|
||||
const originalLength = str.length;
|
||||
if (s.method == "gzip") {
|
||||
if (s.mangle) str = s.mangle(str);
|
||||
const zip = zlib.gzipSync(await minify(str, s.filter), { level: zlib.constants.Z_BEST_COMPRESSION });
|
||||
console.info("Minified and compressed " + s.file + " from " + originalLength + " to " + zip.length + " bytes");
|
||||
const result = hexdump(zip);
|
||||
chunk += `const uint16_t ${s.name}_length = ${zip.length};\n`;
|
||||
chunk += `const uint8_t ${s.name}[] PROGMEM = {\n${result}\n};\n\n`;
|
||||
return chunk;
|
||||
} else {
|
||||
const minified = await minify(str, s.filter);
|
||||
console.info("Minified " + s.file + " from " + originalLength + " to " + minified.length + " bytes");
|
||||
chunk += `const char ${s.name}[] PROGMEM = R"${s.prepend || ""}${minified}${s.append || ""}";\n\n`;
|
||||
return s.mangle ? s.mangle(chunk) : chunk;
|
||||
}
|
||||
});
|
||||
} else if (s.method == "binary") {
|
||||
const result = hexdump(buf);
|
||||
chunk += `const uint16_t ${s.name}_length = ${buf.length};\n`;
|
||||
chunk += `const uint8_t ${s.name}[] PROGMEM = {\n${result}\n};\n\n`;
|
||||
return chunk;
|
||||
}
|
||||
|
||||
throw new Error("Unknown method: " + s.method);
|
||||
}
|
||||
|
||||
async function writeChunks(srcDir, specs, resultFile) {
|
||||
let src = multiHeader;
|
||||
for (const s of specs) {
|
||||
console.info("Reading " + srcDir + "/" + s.file + " as " + s.name);
|
||||
src += await specToChunk(srcDir, s);
|
||||
}
|
||||
console.info("Writing " + src.length + " characters into " + resultFile);
|
||||
fs.writeFileSync(resultFile, src);
|
||||
}
|
||||
|
||||
// Check if a file is newer than a given time
|
||||
function isFileNewerThan(filePath, time) {
|
||||
try {
|
||||
const stats = fs.statSync(filePath);
|
||||
return stats.mtimeMs > time;
|
||||
} catch (e) {
|
||||
console.error(`Failed to get stats for file ${filePath}:`, e);
|
||||
return false;
|
||||
}
|
||||
const stats = fs.statSync(filePath);
|
||||
return stats.mtimeMs > time;
|
||||
}
|
||||
|
||||
// Check if any file in a folder (or its subfolders) is newer than a given time
|
||||
@ -248,21 +208,30 @@ function isAnyFileInFolderNewerThan(folderPath, time) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the web UI is already built
|
||||
function isAlreadyBuilt(folderPath) {
|
||||
let lastBuildTime = Infinity;
|
||||
|
||||
for (const file of output) {
|
||||
try {
|
||||
lastBuildTime = Math.min(lastBuildTime, fs.statSync(file).mtimeMs);
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
if (e.code !== 'ENOENT') throw e;
|
||||
console.info("File " + file + " does not exist. Rebuilding...");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return !isAnyFileInFolderNewerThan(folderPath, lastBuildTime);
|
||||
return !isAnyFileInFolderNewerThan(folderPath, lastBuildTime) && !isFileNewerThan("tools/cdata.js", lastBuildTime);
|
||||
}
|
||||
|
||||
// Don't run this script if we're in a test environment
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
return;
|
||||
}
|
||||
|
||||
console.info(wledBanner);
|
||||
|
||||
if (isAlreadyBuilt("wled00/data") && process.argv[2] !== '--force' && process.argv[2] !== '-f') {
|
||||
console.info("Web UI is already built");
|
||||
return;
|
||||
@ -283,7 +252,7 @@ writeChunks(
|
||||
filter: "css-minify",
|
||||
mangle: (str) =>
|
||||
str
|
||||
.replace("%%","%")
|
||||
.replace("%%", "%")
|
||||
},
|
||||
{
|
||||
file: "settings.htm",
|
||||
|
@ -445,7 +445,7 @@ void BobLightUsermod::pollBob() {
|
||||
//strip.setPixelColor(light_id, RGBW32(red, green, blue, 0));
|
||||
setRealtimePixel(light_id, red, green, blue, 0);
|
||||
} // currently no support for interpolation or speed, we just ignore this
|
||||
} else if (input.startsWith(F("sync"))) {
|
||||
} else if (input.startsWith("sync")) {
|
||||
BobSync();
|
||||
} else {
|
||||
// Client sent gibberish
|
||||
|
@ -67,8 +67,8 @@ class WireguardUsermod : public Usermod {
|
||||
JsonObject top = root.createNestedObject(F("WireGuard"));
|
||||
top[F("host")] = endpoint_address;
|
||||
top[F("port")] = endpoint_port;
|
||||
top[F("ip")] = local_ip.toString();
|
||||
top[F("psk")] = preshared_key;
|
||||
top["ip"] = local_ip.toString();
|
||||
top["psk"] = preshared_key;
|
||||
top[F("pem")] = private_key;
|
||||
top[F("pub")] = public_key;
|
||||
top[F("tz")] = posix_tz;
|
||||
@ -77,11 +77,11 @@ class WireguardUsermod : public Usermod {
|
||||
bool readFromConfig(JsonObject& root) {
|
||||
JsonObject top = root[F("WireGuard")];
|
||||
|
||||
if (top["host"].isNull() || top["port"].isNull() || top["ip"].isNull() || top["pem"].isNull() || top["pub"].isNull() || top["tz"].isNull()) {
|
||||
if (top[F("host")].isNull() || top[F("port")].isNull() || top["ip"].isNull() || top[F("pem")].isNull() || top[F("pub")].isNull() || top[F("tz")].isNull()) {
|
||||
is_enabled = false;
|
||||
return false;
|
||||
} else {
|
||||
const char* host = top["host"];
|
||||
const char* host = top[F("host")];
|
||||
strncpy(endpoint_address, host, 100);
|
||||
|
||||
const char* ip_s = top["ip"];
|
||||
@ -89,16 +89,16 @@ class WireguardUsermod : public Usermod {
|
||||
sscanf(ip_s, "%u.%u.%u.%u", &ip[0], &ip[1], &ip[2], &ip[3]);
|
||||
local_ip = IPAddress(ip[0], ip[1], ip[2], ip[3]);
|
||||
|
||||
const char* pem = top["pem"];
|
||||
const char* pem = top[F("pem")];
|
||||
strncpy(private_key, pem, 45);
|
||||
|
||||
const char* pub = top["pub"];
|
||||
const char* pub = top[F("pub")];
|
||||
strncpy(public_key, pub, 45);
|
||||
|
||||
const char* tz = top["tz"];
|
||||
const char* tz = top[F("tz")];
|
||||
strncpy(posix_tz, tz, 150);
|
||||
|
||||
endpoint_port = top["port"];
|
||||
endpoint_port = top[F("port")];
|
||||
|
||||
if (!top["psk"].isNull()) {
|
||||
const char* psk = top["psk"];
|
||||
|
@ -325,8 +325,8 @@ public:
|
||||
void addToConfig(JsonObject& root)
|
||||
{
|
||||
JsonObject modName = root.createNestedObject("id");
|
||||
modName["mdns"] = "wled-word-clock";
|
||||
modName["name"] = "WLED WORD CLOCK";
|
||||
modName[F("mdns")] = "wled-word-clock";
|
||||
modName[F("name")] = "WLED WORD CLOCK";
|
||||
}
|
||||
|
||||
uint16_t getId()
|
||||
|
313
wled00/FX.cpp
313
wled00/FX.cpp
@ -1848,10 +1848,10 @@ uint16_t mode_lightning(void) {
|
||||
}
|
||||
SEGENV.aux1--;
|
||||
|
||||
SEGENV.step = millis();
|
||||
SEGENV.step = strip.now;
|
||||
//return random8(4, 10); // each flash only lasts one frame/every 24ms... originally 4-10 milliseconds
|
||||
} else {
|
||||
if (millis() - SEGENV.step > SEGENV.aux0) {
|
||||
if (strip.now - SEGENV.step > SEGENV.aux0) {
|
||||
SEGENV.aux1--;
|
||||
if (SEGENV.aux1 < 2) SEGENV.aux1 = 0;
|
||||
|
||||
@ -1859,7 +1859,7 @@ uint16_t mode_lightning(void) {
|
||||
if (SEGENV.aux1 == 2) {
|
||||
SEGENV.aux0 = (random8(255 - SEGMENT.speed) * 100); // delay between strikes
|
||||
}
|
||||
SEGENV.step = millis();
|
||||
SEGENV.step = strip.now;
|
||||
}
|
||||
}
|
||||
return FRAMETIME;
|
||||
@ -1929,22 +1929,102 @@ static const char _data_FX_MODE_JUGGLE[] PROGMEM = "Juggle@!,Trail;;!;;sx=64,ix=
|
||||
|
||||
|
||||
uint16_t mode_palette() {
|
||||
uint16_t counter = 0;
|
||||
if (SEGMENT.speed != 0)
|
||||
{
|
||||
counter = (strip.now * ((SEGMENT.speed >> 3) +1)) & 0xFFFF;
|
||||
counter = counter >> 8;
|
||||
}
|
||||
// Set up some compile time constants so that we can handle integer and float based modes using the same code base.
|
||||
#ifdef ESP8266
|
||||
using mathType = int32_t;
|
||||
using wideMathType = int64_t;
|
||||
using angleType = uint16_t;
|
||||
constexpr mathType sInt16Scale = 0x7FFF;
|
||||
constexpr mathType maxAngle = 0x8000;
|
||||
constexpr mathType staticRotationScale = 256;
|
||||
constexpr mathType animatedRotationScale = 1;
|
||||
constexpr int16_t (*sinFunction)(uint16_t) = &sin16;
|
||||
constexpr int16_t (*cosFunction)(uint16_t) = &cos16;
|
||||
#else
|
||||
using mathType = float;
|
||||
using wideMathType = float;
|
||||
using angleType = float;
|
||||
constexpr mathType sInt16Scale = 1.0f;
|
||||
constexpr mathType maxAngle = M_PI / 256.0;
|
||||
constexpr mathType staticRotationScale = 1.0f;
|
||||
constexpr mathType animatedRotationScale = M_TWOPI / double(0xFFFF);
|
||||
constexpr float (*sinFunction)(float) = &sin_t;
|
||||
constexpr float (*cosFunction)(float) = &cos_t;
|
||||
#endif
|
||||
const bool isMatrix = strip.isMatrix;
|
||||
const int cols = SEGMENT.virtualWidth();
|
||||
const int rows = isMatrix ? SEGMENT.virtualHeight() : strip.getActiveSegmentsNum();
|
||||
|
||||
for (int i = 0; i < SEGLEN; i++)
|
||||
{
|
||||
uint8_t colorIndex = (i * 255 / SEGLEN) - counter;
|
||||
SEGMENT.setPixelColor(i, SEGMENT.color_from_palette(colorIndex, false, PALETTE_MOVING_WRAP, 255));
|
||||
}
|
||||
const int inputShift = SEGMENT.speed;
|
||||
const int inputSize = SEGMENT.intensity;
|
||||
const int inputRotation = SEGMENT.custom1;
|
||||
const bool inputAnimateShift = SEGMENT.check1;
|
||||
const bool inputAnimateRotation = SEGMENT.check2;
|
||||
const bool inputAssumeSquare = SEGMENT.check3;
|
||||
|
||||
const angleType theta = (!inputAnimateRotation) ? (inputRotation * maxAngle / staticRotationScale) : (((strip.now * ((inputRotation >> 4) +1)) & 0xFFFF) * animatedRotationScale);
|
||||
const mathType sinTheta = sinFunction(theta);
|
||||
const mathType cosTheta = cosFunction(theta);
|
||||
|
||||
const mathType maxX = std::max(1, cols-1);
|
||||
const mathType maxY = std::max(1, rows-1);
|
||||
// Set up some parameters according to inputAssumeSquare, so that we can handle anamorphic mode using the same code base.
|
||||
const mathType maxXIn = inputAssumeSquare ? maxX : mathType(1);
|
||||
const mathType maxYIn = inputAssumeSquare ? maxY : mathType(1);
|
||||
const mathType maxXOut = !inputAssumeSquare ? maxX : mathType(1);
|
||||
const mathType maxYOut = !inputAssumeSquare ? maxY : mathType(1);
|
||||
const mathType centerX = sInt16Scale * maxXOut / mathType(2);
|
||||
const mathType centerY = sInt16Scale * maxYOut / mathType(2);
|
||||
// The basic idea for this effect is to rotate a rectangle that is filled with the palette along one axis, then map our
|
||||
// display to it, to find what color a pixel should have.
|
||||
// However, we want a) no areas of solid color (in front of or behind the palette), and b) we want to make use of the full palette.
|
||||
// So the rectangle needs to have exactly the right size. That size depends on the rotation.
|
||||
// This scale computation here only considers one dimension. You can think of it like the rectangle is always scaled so that
|
||||
// the left and right most points always match the left and right side of the display.
|
||||
const mathType scale = std::abs(sinTheta) + (std::abs(cosTheta) * maxYOut / maxXOut);
|
||||
// 2D simulation:
|
||||
// If we are dealing with a 1D setup, we assume that each segment represents one line on a 2-dimensional display.
|
||||
// The function is called once per segments, so we need to handle one line at a time.
|
||||
const int yFrom = isMatrix ? 0 : strip.getCurrSegmentId();
|
||||
const int yTo = isMatrix ? maxY : yFrom;
|
||||
for (int y = yFrom; y <= yTo; ++y) {
|
||||
// translate, scale, rotate
|
||||
const mathType ytCosTheta = mathType((wideMathType(cosTheta) * wideMathType(y * sInt16Scale - centerY * maxYIn))/wideMathType(maxYIn * scale));
|
||||
for (int x = 0; x < cols; ++x) {
|
||||
// translate, scale, rotate
|
||||
const mathType xtSinTheta = mathType((wideMathType(sinTheta) * wideMathType(x * sInt16Scale - centerX * maxXIn))/wideMathType(maxXIn * scale));
|
||||
// Map the pixel coordinate to an imaginary-rectangle-coordinate.
|
||||
// The y coordinate doesn't actually matter, as our imaginary rectangle is filled with the palette from left to right,
|
||||
// so all points at a given x-coordinate have the same color.
|
||||
const mathType sourceX = xtSinTheta + ytCosTheta + centerX;
|
||||
// The computation was scaled just right so that the result should always be in range [0, maxXOut], but enforce this anyway
|
||||
// to account for imprecision. Then scale it so that the range is [0, 255], which we can use with the palette.
|
||||
int colorIndex = (std::min(std::max(sourceX, mathType(0)), maxXOut * sInt16Scale) * 255) / (sInt16Scale * maxXOut);
|
||||
// inputSize determines by how much we want to scale the palette:
|
||||
// values < 128 display a fraction of a palette,
|
||||
// values > 128 display multiple palettes.
|
||||
if (inputSize <= 128) {
|
||||
colorIndex = (colorIndex * inputSize) / 128;
|
||||
} else {
|
||||
// Linear function that maps colorIndex 128=>1, 256=>9.
|
||||
// With this function every full palette repetition is exactly 16 configuration steps wide.
|
||||
// That allows displaying exactly 2 repetitions for example.
|
||||
colorIndex = ((inputSize - 112) * colorIndex) / 16;
|
||||
}
|
||||
// Finally, shift the palette a bit.
|
||||
const int paletteOffset = (!inputAnimateShift) ? (inputShift-128) : (((strip.now * ((inputShift >> 3) +1)) & 0xFFFF) >> 8);
|
||||
colorIndex += paletteOffset;
|
||||
const uint32_t color = SEGMENT.color_wheel((uint8_t)colorIndex);
|
||||
if (isMatrix) {
|
||||
SEGMENT.setPixelColorXY(x, y, color);
|
||||
} else {
|
||||
SEGMENT.setPixelColor(x, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
return FRAMETIME;
|
||||
}
|
||||
static const char _data_FX_MODE_PALETTE[] PROGMEM = "Palette@Cycle speed;;!;;c3=0,o2=0";
|
||||
static const char _data_FX_MODE_PALETTE[] PROGMEM = "Palette@Shift,Size,Rotation,,,Animate Shift,Animate Rotation,Anamorphic;;!;12;c1=128,c2=128,c3=128,o1=1,o2=1,o3=0";
|
||||
|
||||
|
||||
// WLED limitation: Analog Clock overlay will NOT work when Fire2012 is active
|
||||
@ -2899,7 +2979,7 @@ uint16_t mode_bouncing_balls(void) {
|
||||
uint16_t numBalls = (SEGMENT.intensity * (maxNumBalls - 1)) / 255 + 1; // minimum 1 ball
|
||||
const float gravity = -9.81f; // standard value of gravity
|
||||
const bool hasCol2 = SEGCOLOR(2);
|
||||
const unsigned long time = millis();
|
||||
const unsigned long time = strip.now;
|
||||
|
||||
if (SEGENV.call == 0) {
|
||||
for (size_t i = 0; i < maxNumBalls; i++) balls[i].lastBounceTime = time;
|
||||
@ -3336,7 +3416,7 @@ uint16_t mode_starburst(void) {
|
||||
|
||||
if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed
|
||||
|
||||
uint32_t it = millis();
|
||||
uint32_t it = strip.now;
|
||||
|
||||
star* stars = reinterpret_cast<star*>(SEGENV.data);
|
||||
|
||||
@ -3692,7 +3772,7 @@ uint16_t mode_tetrix(void) {
|
||||
// initialize dropping on first call or segment full
|
||||
if (SEGENV.call == 0) {
|
||||
drop->stack = 0; // reset brick stack size
|
||||
drop->step = millis() + 2000; // start by fading out strip
|
||||
drop->step = strip.now + 2000; // start by fading out strip
|
||||
if (SEGMENT.check1) drop->col = 0;// use only one color from palette
|
||||
}
|
||||
|
||||
@ -3726,13 +3806,13 @@ uint16_t mode_tetrix(void) {
|
||||
} else { // we hit bottom
|
||||
drop->step = 0; // proceed with next brick, go back to init
|
||||
drop->stack += drop->brick; // increase the stack size
|
||||
if (drop->stack >= SEGLEN) drop->step = millis() + 2000; // fade out stack
|
||||
if (drop->stack >= SEGLEN) drop->step = strip.now + 2000; // fade out stack
|
||||
}
|
||||
}
|
||||
|
||||
if (drop->step > 2) { // fade strip
|
||||
drop->brick = 0; // reset brick size (no more growing)
|
||||
if (drop->step > millis()) {
|
||||
if (drop->step > strip.now) {
|
||||
// allow fading of virtual strip
|
||||
for (int i = 0; i < SEGLEN; i++) SEGMENT.blendPixelColor(indexToVStrip(i, stripNr), SEGCOLOR(1), 25); // 10% blend
|
||||
} else {
|
||||
@ -3991,7 +4071,7 @@ uint16_t mode_sunrise() {
|
||||
//speed 60 - 120 : sunset time in minutes - 60;
|
||||
//speed above: "breathing" rise and set
|
||||
if (SEGENV.call == 0 || SEGMENT.speed != SEGENV.aux0) {
|
||||
SEGENV.step = millis(); //save starting time, millis() because now can change from sync
|
||||
SEGENV.step = millis(); //save starting time, millis() because strip.now can change from sync
|
||||
SEGENV.aux0 = SEGMENT.speed;
|
||||
}
|
||||
|
||||
@ -4104,9 +4184,9 @@ uint16_t mode_noisepal(void) { // Slow noise
|
||||
CRGBPalette16* palettes = reinterpret_cast<CRGBPalette16*>(SEGENV.data);
|
||||
|
||||
uint16_t changePaletteMs = 4000 + SEGMENT.speed *10; //between 4 - 6.5sec
|
||||
if (millis() - SEGENV.step > changePaletteMs)
|
||||
if (strip.now - SEGENV.step > changePaletteMs)
|
||||
{
|
||||
SEGENV.step = millis();
|
||||
SEGENV.step = strip.now;
|
||||
|
||||
uint8_t baseI = random8();
|
||||
palettes[1] = CRGBPalette16(CHSV(baseI+random8(64), 255, random8(128,255)), CHSV(baseI+128, 255, random8(128,255)), CHSV(baseI+random8(92), 192, random8(128,255)), CHSV(baseI+random8(92), 255, random8(128,255)));
|
||||
@ -4261,7 +4341,7 @@ uint16_t mode_dancing_shadows(void)
|
||||
|
||||
SEGMENT.fill(BLACK);
|
||||
|
||||
unsigned long time = millis();
|
||||
unsigned long time = strip.now;
|
||||
bool respawn = false;
|
||||
|
||||
for (size_t i = 0; i < numSpotlights; i++) {
|
||||
@ -4455,8 +4535,8 @@ uint16_t mode_tv_simulator(void) {
|
||||
}
|
||||
|
||||
// create a new sceene
|
||||
if (((millis() - tvSimulator->sceeneStart) >= tvSimulator->sceeneDuration) || SEGENV.aux1 == 0) {
|
||||
tvSimulator->sceeneStart = millis(); // remember the start of the new sceene
|
||||
if (((strip.now - tvSimulator->sceeneStart) >= tvSimulator->sceeneDuration) || SEGENV.aux1 == 0) {
|
||||
tvSimulator->sceeneStart = strip.now; // remember the start of the new sceene
|
||||
tvSimulator->sceeneDuration = random16(60* 250* colorSpeed, 60* 750 * colorSpeed); // duration of a "movie sceene" which has similar colors (5 to 15 minutes with max speed slider)
|
||||
tvSimulator->sceeneColorHue = random16( 0, 768); // random start color-tone for the sceene
|
||||
tvSimulator->sceeneColorSat = random8 ( 100, 130 + colorIntensity); // random start color-saturation for the sceene
|
||||
@ -4507,11 +4587,11 @@ uint16_t mode_tv_simulator(void) {
|
||||
tvSimulator->fadeTime = random16(0, tvSimulator->totalTime); // Pixel-to-pixel transition time
|
||||
if (random8(10) < 3) tvSimulator->fadeTime = 0; // Force scene cut 30% of time
|
||||
|
||||
tvSimulator->startTime = millis();
|
||||
tvSimulator->startTime = strip.now;
|
||||
} // end of initialization
|
||||
|
||||
// how much time is elapsed ?
|
||||
tvSimulator->elapsed = millis() - tvSimulator->startTime;
|
||||
tvSimulator->elapsed = strip.now - tvSimulator->startTime;
|
||||
|
||||
// fade from prev volor to next color
|
||||
if (tvSimulator->elapsed < tvSimulator->fadeTime) {
|
||||
@ -4715,7 +4795,7 @@ uint16_t mode_perlinmove(void) {
|
||||
if (SEGLEN == 1) return mode_static();
|
||||
SEGMENT.fade_out(255-SEGMENT.custom1);
|
||||
for (int i = 0; i < SEGMENT.intensity/16 + 1; i++) {
|
||||
uint16_t locn = inoise16(millis()*128/(260-SEGMENT.speed)+i*15000, millis()*128/(260-SEGMENT.speed)); // Get a new pixel location from moving noise.
|
||||
uint16_t locn = inoise16(strip.now*128/(260-SEGMENT.speed)+i*15000, strip.now*128/(260-SEGMENT.speed)); // Get a new pixel location from moving noise.
|
||||
uint16_t pixloc = map(locn, 50*256, 192*256, 0, SEGLEN-1); // Map that to the length of the strand, and ensure we don't go over.
|
||||
SEGMENT.setPixelColor(pixloc, SEGMENT.color_from_palette(pixloc%255, false, PALETTE_SOLID_WRAP, 0));
|
||||
}
|
||||
@ -4732,7 +4812,7 @@ static const char _data_FX_MODE_PERLINMOVE[] PROGMEM = "Perlin Move@!,# of pixel
|
||||
uint16_t mode_wavesins(void) {
|
||||
|
||||
for (int i = 0; i < SEGLEN; i++) {
|
||||
uint8_t bri = sin8(millis()/4 + i * SEGMENT.intensity);
|
||||
uint8_t bri = sin8(strip.now/4 + i * SEGMENT.intensity);
|
||||
uint8_t index = beatsin8(SEGMENT.speed, SEGMENT.custom1, SEGMENT.custom1+SEGMENT.custom2, 0, i * (SEGMENT.custom3<<3)); // custom3 is reduced resolution slider
|
||||
//SEGMENT.setPixelColor(i, ColorFromPalette(SEGPALETTE, index, bri, LINEARBLEND));
|
||||
SEGMENT.setPixelColor(i, SEGMENT.color_from_palette(index, false, PALETTE_SOLID_WRAP, 0, bri));
|
||||
@ -4750,8 +4830,8 @@ static const char _data_FX_MODE_WAVESINS[] PROGMEM = "Wavesins@!,Brightness vari
|
||||
uint16_t mode_FlowStripe(void) {
|
||||
|
||||
const uint16_t hl = SEGLEN * 10 / 13;
|
||||
uint8_t hue = millis() / (SEGMENT.speed+1);
|
||||
uint32_t t = millis() / (SEGMENT.intensity/8+1);
|
||||
uint8_t hue = strip.now / (SEGMENT.speed+1);
|
||||
uint32_t t = strip.now / (SEGMENT.intensity/8+1);
|
||||
|
||||
for (int i = 0; i < SEGLEN; i++) {
|
||||
int c = (abs(i - hl) / hl) * 127;
|
||||
@ -4781,7 +4861,7 @@ uint16_t mode_2DBlackHole(void) { // By: Stepko https://editor.soulma
|
||||
uint16_t x, y;
|
||||
|
||||
SEGMENT.fadeToBlackBy(16 + (SEGMENT.speed>>3)); // create fading trails
|
||||
unsigned long t = millis()/128; // timebase
|
||||
unsigned long t = strip.now/128; // timebase
|
||||
// outer stars
|
||||
for (size_t i = 0; i < 8; i++) {
|
||||
x = beatsin8(SEGMENT.custom1>>3, 0, cols - 1, 0, ((i % 2) ? 128 : 0) + t * i);
|
||||
@ -4867,8 +4947,8 @@ uint16_t mode_2Ddna(void) { // dna originally by by ldirko at https://pa
|
||||
|
||||
SEGMENT.fadeToBlackBy(64);
|
||||
for (int i = 0; i < cols; i++) {
|
||||
SEGMENT.setPixelColorXY(i, beatsin8(SEGMENT.speed/8, 0, rows-1, 0, i*4 ), ColorFromPalette(SEGPALETTE, i*5+millis()/17, beatsin8(5, 55, 255, 0, i*10), LINEARBLEND));
|
||||
SEGMENT.setPixelColorXY(i, beatsin8(SEGMENT.speed/8, 0, rows-1, 0, i*4+128), ColorFromPalette(SEGPALETTE, i*5+128+millis()/17, beatsin8(5, 55, 255, 0, i*10+128), LINEARBLEND));
|
||||
SEGMENT.setPixelColorXY(i, beatsin8(SEGMENT.speed/8, 0, rows-1, 0, i*4 ), ColorFromPalette(SEGPALETTE, i*5+strip.now/17, beatsin8(5, 55, 255, 0, i*10), LINEARBLEND));
|
||||
SEGMENT.setPixelColorXY(i, beatsin8(SEGMENT.speed/8, 0, rows-1, 0, i*4+128), ColorFromPalette(SEGPALETTE, i*5+128+strip.now/17, beatsin8(5, 55, 255, 0, i*10+128), LINEARBLEND));
|
||||
}
|
||||
SEGMENT.blur(SEGMENT.intensity>>3);
|
||||
|
||||
@ -4880,7 +4960,7 @@ static const char _data_FX_MODE_2DDNA[] PROGMEM = "DNA@Scroll speed,Blur;;!;2";
|
||||
/////////////////////////
|
||||
// 2D DNA Spiral //
|
||||
/////////////////////////
|
||||
uint16_t mode_2DDNASpiral() { // By: ldirko https://editor.soulmatelights.com/gallery/810 , modified by: Andrew Tuline
|
||||
uint16_t mode_2DDNASpiral() { // By: ldirko https://editor.soulmatelights.com/gallery/512-dna-spiral-variation , modified by: Andrew Tuline
|
||||
if (!strip.isMatrix || !SEGMENT.is2D()) return mode_static(); // not a 2D set-up
|
||||
|
||||
const uint16_t cols = SEGMENT.virtualWidth();
|
||||
@ -4890,10 +4970,10 @@ uint16_t mode_2DDNASpiral() { // By: ldirko https://editor.soulma
|
||||
SEGMENT.fill(BLACK);
|
||||
}
|
||||
|
||||
uint8_t speeds = SEGMENT.speed/2 + 1;
|
||||
uint8_t speeds = SEGMENT.speed/2 + 7;
|
||||
uint8_t freq = SEGMENT.intensity/8;
|
||||
|
||||
uint32_t ms = millis() / 20;
|
||||
uint32_t ms = strip.now / 20;
|
||||
SEGMENT.fadeToBlackBy(135);
|
||||
|
||||
for (int i = 0; i < rows; i++) {
|
||||
@ -4933,7 +5013,7 @@ uint16_t mode_2DDrift() { // By: Stepko https://editor.soulmateli
|
||||
|
||||
SEGMENT.fadeToBlackBy(128);
|
||||
const uint16_t maxDim = MAX(cols, rows)/2;
|
||||
unsigned long t = millis() / (32 - (SEGMENT.speed>>3));
|
||||
unsigned long t = strip.now / (32 - (SEGMENT.speed>>3));
|
||||
unsigned long t_20 = t/20; // softhack007: pre-calculating this gives about 10% speedup
|
||||
for (float i = 1; i < maxDim; i += 0.25) {
|
||||
float angle = radians(t * (maxDim - i));
|
||||
@ -4972,7 +5052,7 @@ uint16_t mode_2Dfirenoise(void) { // firenoise2d. By Andrew Tuline
|
||||
|
||||
for (int j=0; j < cols; j++) {
|
||||
for (int i=0; i < rows; i++) {
|
||||
indexx = inoise8(j*yscale*rows/255, i*xscale+millis()/4); // We're moving along our Perlin map.
|
||||
indexx = inoise8(j*yscale*rows/255, i*xscale+strip.now/4); // We're moving along our Perlin map.
|
||||
SEGMENT.setPixelColorXY(j, i, ColorFromPalette(SEGPALETTE, min(i*(indexx)>>4, 255), i*255/cols, LINEARBLEND)); // With that value, look up the 8 bit colour palette value and assign it to the current LED.
|
||||
} // for i
|
||||
} // for j
|
||||
@ -5203,8 +5283,8 @@ uint16_t mode_2DJulia(void) { // An animated Julia set
|
||||
reAl = -0.94299f; // PixelBlaze example
|
||||
imAg = 0.3162f;
|
||||
|
||||
reAl += sin_t((float)millis()/305.f)/20.f;
|
||||
imAg += sin_t((float)millis()/405.f)/20.f;
|
||||
reAl += sin_t((float)strip.now/305.f)/20.f;
|
||||
imAg += sin_t((float)strip.now/405.f)/20.f;
|
||||
|
||||
dx = (xmax - xmin) / (cols); // Scale the delta x and y values to our matrix size.
|
||||
dy = (ymax - ymin) / (rows);
|
||||
@ -5263,7 +5343,7 @@ uint16_t mode_2DLissajous(void) { // By: Andrew Tuline
|
||||
const uint16_t rows = SEGMENT.virtualHeight();
|
||||
|
||||
SEGMENT.fadeToBlackBy(SEGMENT.intensity);
|
||||
uint_fast16_t phase = (millis() * (1 + SEGENV.custom3)) /32; // allow user to control rotation speed
|
||||
uint_fast16_t phase = (strip.now * (1 + SEGENV.custom3)) /32; // allow user to control rotation speed
|
||||
|
||||
//for (int i=0; i < 4*(cols+rows); i ++) {
|
||||
for (int i=0; i < 256; i ++) {
|
||||
@ -5273,7 +5353,7 @@ uint16_t mode_2DLissajous(void) { // By: Andrew Tuline
|
||||
uint_fast8_t ylocn = cos8(phase/2 + i*2);
|
||||
xlocn = (cols < 2) ? 1 : (map(2*xlocn, 0,511, 0,2*(cols-1)) +1) /2; // softhack007: "(2* ..... +1) /2" for proper rounding
|
||||
ylocn = (rows < 2) ? 1 : (map(2*ylocn, 0,511, 0,2*(rows-1)) +1) /2; // "rows > 1" is needed to avoid div/0 in map()
|
||||
SEGMENT.setPixelColorXY((uint8_t)xlocn, (uint8_t)ylocn, SEGMENT.color_from_palette(millis()/100+i, false, PALETTE_SOLID_WRAP, 0));
|
||||
SEGMENT.setPixelColorXY((uint8_t)xlocn, (uint8_t)ylocn, SEGMENT.color_from_palette(strip.now/100+i, false, PALETTE_SOLID_WRAP, 0));
|
||||
}
|
||||
|
||||
return FRAMETIME;
|
||||
@ -5423,7 +5503,7 @@ uint16_t mode_2Dnoise(void) { // By Andrew Tuline
|
||||
|
||||
for (int y = 0; y < rows; y++) {
|
||||
for (int x = 0; x < cols; x++) {
|
||||
uint8_t pixelHue8 = inoise8(x * scale, y * scale, millis() / (16 - SEGMENT.speed/16));
|
||||
uint8_t pixelHue8 = inoise8(x * scale, y * scale, strip.now / (16 - SEGMENT.speed/16));
|
||||
SEGMENT.setPixelColorXY(x, y, ColorFromPalette(SEGPALETTE, pixelHue8));
|
||||
}
|
||||
}
|
||||
@ -5443,7 +5523,7 @@ uint16_t mode_2DPlasmaball(void) { // By: Stepko https://edito
|
||||
const uint16_t rows = SEGMENT.virtualHeight();
|
||||
|
||||
SEGMENT.fadeToBlackBy(SEGMENT.custom1>>2);
|
||||
uint_fast32_t t = (millis() * 8) / (256 - SEGMENT.speed); // optimized to avoid float
|
||||
uint_fast32_t t = (strip.now * 8) / (256 - SEGMENT.speed); // optimized to avoid float
|
||||
for (int i = 0; i < cols; i++) {
|
||||
uint16_t thisVal = inoise8(i * 30, t, t);
|
||||
uint16_t thisMax = map(thisVal, 0, 255, 0, cols-1);
|
||||
@ -5561,7 +5641,7 @@ uint16_t mode_2DSindots(void) { // By: ldirko http
|
||||
|
||||
SEGMENT.fadeToBlackBy(SEGMENT.custom1>>3);
|
||||
|
||||
byte t1 = millis() / (257 - SEGMENT.speed); // 20;
|
||||
byte t1 = strip.now / (257 - SEGMENT.speed); // 20;
|
||||
byte t2 = sin8(t1) / 4 * 2;
|
||||
for (int i = 0; i < 13; i++) {
|
||||
byte x = sin8(t1 + i * SEGMENT.intensity/8)*(cols-1)/255; // max index now 255x15/255=15!
|
||||
@ -5600,11 +5680,9 @@ uint16_t mode_2Dsquaredswirl(void) { // By: Mark Kriegsman. https://g
|
||||
uint8_t n = beatsin8(15, kBorderWidth, rows-kBorderWidth);
|
||||
uint8_t p = beatsin8(20, kBorderWidth, rows-kBorderWidth);
|
||||
|
||||
uint16_t ms = millis();
|
||||
|
||||
SEGMENT.addPixelColorXY(i, m, ColorFromPalette(SEGPALETTE, ms/29, 255, LINEARBLEND));
|
||||
SEGMENT.addPixelColorXY(j, n, ColorFromPalette(SEGPALETTE, ms/41, 255, LINEARBLEND));
|
||||
SEGMENT.addPixelColorXY(k, p, ColorFromPalette(SEGPALETTE, ms/73, 255, LINEARBLEND));
|
||||
SEGMENT.addPixelColorXY(i, m, ColorFromPalette(SEGPALETTE, strip.now/29, 255, LINEARBLEND));
|
||||
SEGMENT.addPixelColorXY(j, n, ColorFromPalette(SEGPALETTE, strip.now/41, 255, LINEARBLEND));
|
||||
SEGMENT.addPixelColorXY(k, p, ColorFromPalette(SEGPALETTE, strip.now/73, 255, LINEARBLEND));
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_2Dsquaredswirl()
|
||||
@ -5627,7 +5705,7 @@ uint16_t mode_2DSunradiation(void) { // By: ldirko https://edi
|
||||
SEGMENT.fill(BLACK);
|
||||
}
|
||||
|
||||
unsigned long t = millis() / 4;
|
||||
unsigned long t = strip.now / 4;
|
||||
int index = 0;
|
||||
uint8_t someVal = SEGMENT.speed/4; // Was 25.
|
||||
for (int j = 0; j < (rows + 2); j++) {
|
||||
@ -5759,14 +5837,14 @@ uint16_t mode_2Dcrazybees(void) {
|
||||
int8_t deltaX, deltaY, signX, signY, error;
|
||||
void aimed(uint16_t w, uint16_t h) {
|
||||
//random16_set_seed(millis());
|
||||
aimX = random8(0, w);
|
||||
aimY = random8(0, h);
|
||||
hue = random8();
|
||||
aimX = random8(0, w);
|
||||
aimY = random8(0, h);
|
||||
hue = random8();
|
||||
deltaX = abs(aimX - posX);
|
||||
deltaY = abs(aimY - posY);
|
||||
signX = posX < aimX ? 1 : -1;
|
||||
signY = posY < aimY ? 1 : -1;
|
||||
error = deltaX - deltaY;
|
||||
signX = posX < aimX ? 1 : -1;
|
||||
signY = posY < aimY ? 1 : -1;
|
||||
error = deltaX - deltaY;
|
||||
};
|
||||
} bee_t;
|
||||
|
||||
@ -5774,6 +5852,7 @@ uint16_t mode_2Dcrazybees(void) {
|
||||
bee_t *bee = reinterpret_cast<bee_t*>(SEGENV.data);
|
||||
|
||||
if (SEGENV.call == 0) {
|
||||
random16_set_seed(strip.now);
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
bee[i].posX = random8(0, cols);
|
||||
bee[i].posY = random8(0, rows);
|
||||
@ -5781,8 +5860,8 @@ uint16_t mode_2Dcrazybees(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (millis() > SEGENV.step) {
|
||||
SEGENV.step = millis() + (FRAMETIME * 16 / ((SEGMENT.speed>>4)+1));
|
||||
if (strip.now > SEGENV.step) {
|
||||
SEGENV.step = strip.now + (FRAMETIME * 16 / ((SEGMENT.speed>>4)+1));
|
||||
|
||||
SEGMENT.fadeToBlackBy(32);
|
||||
|
||||
@ -5859,8 +5938,8 @@ uint16_t mode_2Dghostrider(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (millis() > SEGENV.step) {
|
||||
SEGENV.step = millis() + 1024 / (cols+rows);
|
||||
if (strip.now > SEGENV.step) {
|
||||
SEGENV.step = strip.now + 1024 / (cols+rows);
|
||||
|
||||
SEGMENT.fadeToBlackBy((SEGMENT.speed>>2)+64);
|
||||
|
||||
@ -5948,7 +6027,7 @@ uint16_t mode_2Dfloatingblobs(void) {
|
||||
|
||||
// Bounce balls around
|
||||
for (size_t i = 0; i < Amount; i++) {
|
||||
if (SEGENV.step < millis()) blob->color[i] = add8(blob->color[i], 4); // slowly change color
|
||||
if (SEGENV.step < strip.now) blob->color[i] = add8(blob->color[i], 4); // slowly change color
|
||||
// change radius if needed
|
||||
if (blob->grow[i]) {
|
||||
// enlarge radius until it is >= 4
|
||||
@ -5995,7 +6074,7 @@ uint16_t mode_2Dfloatingblobs(void) {
|
||||
}
|
||||
SEGMENT.blur(SEGMENT.custom1>>2);
|
||||
|
||||
if (SEGENV.step < millis()) SEGENV.step = millis() + 2000; // change colors every 2 seconds
|
||||
if (SEGENV.step < strip.now) SEGENV.step = strip.now + 2000; // change colors every 2 seconds
|
||||
|
||||
return FRAMETIME;
|
||||
}
|
||||
@ -6059,13 +6138,12 @@ uint16_t mode_2Dscrollingtext(void) {
|
||||
}
|
||||
|
||||
const int numberOfLetters = strlen(text);
|
||||
const unsigned long now = millis(); // reduce millis() calls
|
||||
int width = (numberOfLetters * rotLW);
|
||||
int yoffset = map(SEGMENT.intensity, 0, 255, -rows/2, rows/2) + (rows-rotLH)/2;
|
||||
if (width <= cols) {
|
||||
// scroll vertically (e.g. ^^ Way out ^^) if it fits
|
||||
int speed = map(SEGMENT.speed, 0, 255, 5000, 1000);
|
||||
int frac = now % speed + 1;
|
||||
int frac = strip.now % speed + 1;
|
||||
if (SEGMENT.intensity == 255) {
|
||||
yoffset = (2 * frac * rows)/speed - rows;
|
||||
} else if (SEGMENT.intensity == 0) {
|
||||
@ -6073,7 +6151,7 @@ uint16_t mode_2Dscrollingtext(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (SEGENV.step < now) {
|
||||
if (SEGENV.step < strip.now) {
|
||||
// calculate start offset
|
||||
if (width > cols) {
|
||||
if (SEGMENT.check3) {
|
||||
@ -6082,7 +6160,7 @@ uint16_t mode_2Dscrollingtext(void) {
|
||||
} else ++SEGENV.aux0 %= width + cols;
|
||||
} else SEGENV.aux0 = (cols + width)/2;
|
||||
++SEGENV.aux1 &= 0xFF; // color shift
|
||||
SEGENV.step = now + map(SEGMENT.speed, 0, 255, 250, 50); // shift letters every ~250ms to ~50ms
|
||||
SEGENV.step = strip.now + map(SEGMENT.speed, 0, 255, 250, 50); // shift letters every ~250ms to ~50ms
|
||||
}
|
||||
|
||||
if (!SEGMENT.check2) SEGMENT.fade_out(255 - (SEGMENT.custom1>>4)); // trail
|
||||
@ -6130,6 +6208,51 @@ uint16_t mode_2Ddriftrose(void) {
|
||||
}
|
||||
static const char _data_FX_MODE_2DDRIFTROSE[] PROGMEM = "Drift Rose@Fade,Blur;;;2";
|
||||
|
||||
/////////////////////////////
|
||||
// 2D PLASMA ROTOZOOMER //
|
||||
/////////////////////////////
|
||||
// Plasma Rotozoomer by ldirko (c)2020 [https://editor.soulmatelights.com/gallery/457-plasma-rotozoomer], adapted for WLED by Blaz Kristan (AKA blazoncek)
|
||||
uint16_t mode_2Dplasmarotozoom() {
|
||||
if (!strip.isMatrix || !SEGMENT.is2D()) return mode_static(); // not a 2D set-up
|
||||
|
||||
const uint16_t cols = SEGMENT.virtualWidth();
|
||||
const uint16_t rows = SEGMENT.virtualHeight();
|
||||
|
||||
uint16_t dataSize = SEGMENT.length() + sizeof(float);
|
||||
if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed
|
||||
float *a = reinterpret_cast<float*>(SEGENV.data);
|
||||
byte *plasma = reinterpret_cast<byte*>(SEGENV.data+sizeof(float));
|
||||
|
||||
uint16_t ms = strip.now/15;
|
||||
|
||||
// plasma
|
||||
for (int j = 0; j < rows; j++) {
|
||||
int index = j*cols;
|
||||
for (int i = 0; i < cols; i++) {
|
||||
if (SEGMENT.check1) plasma[index+i] = (i * 4 ^ j * 4) + ms / 6;
|
||||
else plasma[index+i] = inoise8(i * 40, j * 40, ms);
|
||||
}
|
||||
}
|
||||
|
||||
// rotozoom
|
||||
float f = (sin_t(*a/2)+((128-SEGMENT.intensity)/128.0f)+1.1f)/1.5f; // scale factor
|
||||
float kosinus = cos_t(*a) * f;
|
||||
float sinus = sin_t(*a) * f;
|
||||
for (int i = 0; i < cols; i++) {
|
||||
float u1 = i * kosinus;
|
||||
float v1 = i * sinus;
|
||||
for (int j = 0; j < rows; j++) {
|
||||
byte u = abs8(u1 - j * sinus) % cols;
|
||||
byte v = abs8(v1 + j * kosinus) % rows;
|
||||
SEGMENT.setPixelColorXY(i, j, SEGMENT.color_from_palette(plasma[v*cols+u], false, PALETTE_SOLID_WRAP, 0));
|
||||
}
|
||||
}
|
||||
*a -= 0.03f + float(SEGENV.speed-128)*0.0002f; // rotation speed
|
||||
|
||||
return FRAMETIME;
|
||||
}
|
||||
static const char _data_FX_MODE_2DPLASMAROTOZOOM[] PROGMEM = "Rotozoomer@!,Scale,,,,Alt;;!;2;pal=54";
|
||||
|
||||
#endif // WLED_DISABLE_2D
|
||||
|
||||
|
||||
@ -6280,7 +6403,6 @@ uint16_t mode_2DSwirl(void) {
|
||||
uint8_t j = beatsin8( 41*SEGMENT.speed/255, borderWidth, rows - borderWidth);
|
||||
uint8_t ni = (cols - 1) - i;
|
||||
uint8_t nj = (cols - 1) - j;
|
||||
uint16_t ms = millis();
|
||||
|
||||
um_data_t *um_data;
|
||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||
@ -6290,12 +6412,12 @@ uint16_t mode_2DSwirl(void) {
|
||||
float volumeSmth = *(float*) um_data->u_data[0]; //ewowi: use instead of sampleAvg???
|
||||
int16_t volumeRaw = *(int16_t*) um_data->u_data[1];
|
||||
|
||||
SEGMENT.addPixelColorXY( i, j, ColorFromPalette(SEGPALETTE, (ms / 11 + volumeSmth*4), volumeRaw * SEGMENT.intensity / 64, LINEARBLEND)); //CHSV( ms / 11, 200, 255);
|
||||
SEGMENT.addPixelColorXY( j, i, ColorFromPalette(SEGPALETTE, (ms / 13 + volumeSmth*4), volumeRaw * SEGMENT.intensity / 64, LINEARBLEND)); //CHSV( ms / 13, 200, 255);
|
||||
SEGMENT.addPixelColorXY(ni,nj, ColorFromPalette(SEGPALETTE, (ms / 17 + volumeSmth*4), volumeRaw * SEGMENT.intensity / 64, LINEARBLEND)); //CHSV( ms / 17, 200, 255);
|
||||
SEGMENT.addPixelColorXY(nj,ni, ColorFromPalette(SEGPALETTE, (ms / 29 + volumeSmth*4), volumeRaw * SEGMENT.intensity / 64, LINEARBLEND)); //CHSV( ms / 29, 200, 255);
|
||||
SEGMENT.addPixelColorXY( i,nj, ColorFromPalette(SEGPALETTE, (ms / 37 + volumeSmth*4), volumeRaw * SEGMENT.intensity / 64, LINEARBLEND)); //CHSV( ms / 37, 200, 255);
|
||||
SEGMENT.addPixelColorXY(ni, j, ColorFromPalette(SEGPALETTE, (ms / 41 + volumeSmth*4), volumeRaw * SEGMENT.intensity / 64, LINEARBLEND)); //CHSV( ms / 41, 200, 255);
|
||||
SEGMENT.addPixelColorXY( i, j, ColorFromPalette(SEGPALETTE, (strip.now / 11 + volumeSmth*4), volumeRaw * SEGMENT.intensity / 64, LINEARBLEND)); //CHSV( ms / 11, 200, 255);
|
||||
SEGMENT.addPixelColorXY( j, i, ColorFromPalette(SEGPALETTE, (strip.now / 13 + volumeSmth*4), volumeRaw * SEGMENT.intensity / 64, LINEARBLEND)); //CHSV( ms / 13, 200, 255);
|
||||
SEGMENT.addPixelColorXY(ni,nj, ColorFromPalette(SEGPALETTE, (strip.now / 17 + volumeSmth*4), volumeRaw * SEGMENT.intensity / 64, LINEARBLEND)); //CHSV( ms / 17, 200, 255);
|
||||
SEGMENT.addPixelColorXY(nj,ni, ColorFromPalette(SEGPALETTE, (strip.now / 29 + volumeSmth*4), volumeRaw * SEGMENT.intensity / 64, LINEARBLEND)); //CHSV( ms / 29, 200, 255);
|
||||
SEGMENT.addPixelColorXY( i,nj, ColorFromPalette(SEGPALETTE, (strip.now / 37 + volumeSmth*4), volumeRaw * SEGMENT.intensity / 64, LINEARBLEND)); //CHSV( ms / 37, 200, 255);
|
||||
SEGMENT.addPixelColorXY(ni, j, ColorFromPalette(SEGPALETTE, (strip.now / 41 + volumeSmth*4), volumeRaw * SEGMENT.intensity / 64, LINEARBLEND)); //CHSV( ms / 41, 200, 255);
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_2DSwirl()
|
||||
@ -6321,7 +6443,7 @@ uint16_t mode_2DWaverly(void) {
|
||||
|
||||
SEGMENT.fadeToBlackBy(SEGMENT.speed);
|
||||
|
||||
long t = millis() / 2;
|
||||
long t = strip.now / 2;
|
||||
for (int i = 0; i < cols; i++) {
|
||||
uint16_t thisVal = (1 + SEGMENT.intensity/64) * inoise8(i * 45 , t , t)/2;
|
||||
// use audio if available
|
||||
@ -6383,7 +6505,7 @@ uint16_t mode_gravcenter(void) { // Gravcenter. By Andrew Tuline.
|
||||
uint8_t gravity = 8 - SEGMENT.speed/32;
|
||||
|
||||
for (int i=0; i<tempsamp; i++) {
|
||||
uint8_t index = inoise8(i*segmentSampleAvg+millis(), 5000+i*segmentSampleAvg);
|
||||
uint8_t index = inoise8(i*segmentSampleAvg+strip.now, 5000+i*segmentSampleAvg);
|
||||
SEGMENT.setPixelColor(i+SEGLEN/2, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(index, false, PALETTE_SOLID_WRAP, 0), segmentSampleAvg*8));
|
||||
SEGMENT.setPixelColor(SEGLEN/2-i-1, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(index, false, PALETTE_SOLID_WRAP, 0), segmentSampleAvg*8));
|
||||
}
|
||||
@ -6394,8 +6516,8 @@ uint16_t mode_gravcenter(void) { // Gravcenter. By Andrew Tuline.
|
||||
gravcen->topLED--;
|
||||
|
||||
if (gravcen->topLED >= 0) {
|
||||
SEGMENT.setPixelColor(gravcen->topLED+SEGLEN/2, SEGMENT.color_from_palette(millis(), false, PALETTE_SOLID_WRAP, 0));
|
||||
SEGMENT.setPixelColor(SEGLEN/2-1-gravcen->topLED, SEGMENT.color_from_palette(millis(), false, PALETTE_SOLID_WRAP, 0));
|
||||
SEGMENT.setPixelColor(gravcen->topLED+SEGLEN/2, SEGMENT.color_from_palette(strip.now, false, PALETTE_SOLID_WRAP, 0));
|
||||
SEGMENT.setPixelColor(SEGLEN/2-1-gravcen->topLED, SEGMENT.color_from_palette(strip.now, false, PALETTE_SOLID_WRAP, 0));
|
||||
}
|
||||
gravcen->gravityCounter = (gravcen->gravityCounter + 1) % gravity;
|
||||
|
||||
@ -6435,7 +6557,7 @@ uint16_t mode_gravcentric(void) { // Gravcentric. By Andrew
|
||||
uint8_t gravity = 8 - SEGMENT.speed/32;
|
||||
|
||||
for (int i=0; i<tempsamp; i++) {
|
||||
uint8_t index = segmentSampleAvg*24+millis()/200;
|
||||
uint8_t index = segmentSampleAvg*24+strip.now/200;
|
||||
SEGMENT.setPixelColor(i+SEGLEN/2, SEGMENT.color_from_palette(index, false, PALETTE_SOLID_WRAP, 0));
|
||||
SEGMENT.setPixelColor(SEGLEN/2-1-i, SEGMENT.color_from_palette(index, false, PALETTE_SOLID_WRAP, 0));
|
||||
}
|
||||
@ -6484,7 +6606,7 @@ uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
|
||||
uint8_t gravity = 8 - SEGMENT.speed/32;
|
||||
|
||||
for (int i=0; i<tempsamp; i++) {
|
||||
uint8_t index = inoise8(i*segmentSampleAvg+millis(), 5000+i*segmentSampleAvg);
|
||||
uint8_t index = inoise8(i*segmentSampleAvg+strip.now, 5000+i*segmentSampleAvg);
|
||||
SEGMENT.setPixelColor(i, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(index, false, PALETTE_SOLID_WRAP, 0), segmentSampleAvg*8));
|
||||
}
|
||||
|
||||
@ -6494,7 +6616,7 @@ uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
|
||||
gravcen->topLED--;
|
||||
|
||||
if (gravcen->topLED > 0) {
|
||||
SEGMENT.setPixelColor(gravcen->topLED, SEGMENT.color_from_palette(millis(), false, PALETTE_SOLID_WRAP, 0));
|
||||
SEGMENT.setPixelColor(gravcen->topLED, SEGMENT.color_from_palette(strip.now, false, PALETTE_SOLID_WRAP, 0));
|
||||
}
|
||||
gravcen->gravityCounter = (gravcen->gravityCounter + 1) % gravity;
|
||||
|
||||
@ -6519,7 +6641,7 @@ uint16_t mode_juggles(void) { // Juggles. By Andrew Tuline.
|
||||
uint16_t my_sampleAgc = fmax(fmin(volumeSmth, 255.0), 0);
|
||||
|
||||
for (size_t i=0; i<SEGMENT.intensity/32+1U; i++) {
|
||||
SEGMENT.setPixelColor(beatsin16(SEGMENT.speed/4+i*2,0,SEGLEN-1), color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(millis()/4+i*2, false, PALETTE_SOLID_WRAP, 0), my_sampleAgc));
|
||||
SEGMENT.setPixelColor(beatsin16(SEGMENT.speed/4+i*2,0,SEGLEN-1), color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(strip.now/4+i*2, false, PALETTE_SOLID_WRAP, 0), my_sampleAgc));
|
||||
}
|
||||
|
||||
return FRAMETIME;
|
||||
@ -6551,7 +6673,7 @@ uint16_t mode_matripix(void) { // Matripix. By Andrew Tuline.
|
||||
|
||||
int pixBri = volumeRaw * SEGMENT.intensity / 64;
|
||||
for (int i = 0; i < SEGLEN-1; i++) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i+1)); // shift left
|
||||
SEGMENT.setPixelColor(SEGLEN-1, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(millis(), false, PALETTE_SOLID_WRAP, 0), pixBri));
|
||||
SEGMENT.setPixelColor(SEGLEN-1, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(strip.now, false, PALETTE_SOLID_WRAP, 0), pixBri));
|
||||
}
|
||||
|
||||
return FRAMETIME;
|
||||
@ -6615,7 +6737,7 @@ uint16_t mode_noisefire(void) { // Noisefire. By Andrew Tuline.
|
||||
if (SEGENV.call == 0) SEGMENT.fill(BLACK);
|
||||
|
||||
for (int i = 0; i < SEGLEN; i++) {
|
||||
uint16_t index = inoise8(i*SEGMENT.speed/64,millis()*SEGMENT.speed/64*SEGLEN/255); // X location is constant, but we move along the Y at the rate of millis(). By Andrew Tuline.
|
||||
uint16_t index = inoise8(i*SEGMENT.speed/64,strip.now*SEGMENT.speed/64*SEGLEN/255); // X location is constant, but we move along the Y at the rate of millis(). By Andrew Tuline.
|
||||
index = (255 - i*256/SEGLEN) * index/(256-SEGMENT.intensity); // Now we need to scale index so that it gets blacker as we get close to one of the ends.
|
||||
// This is a simple y=mx+b equation that's been scaled. index/128 is another scaling.
|
||||
|
||||
@ -6687,7 +6809,7 @@ uint16_t mode_pixelwave(void) { // Pixelwave. By Andrew Tuline.
|
||||
|
||||
int pixBri = volumeRaw * SEGMENT.intensity / 64;
|
||||
|
||||
SEGMENT.setPixelColor(SEGLEN/2, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(millis(), false, PALETTE_SOLID_WRAP, 0), pixBri));
|
||||
SEGMENT.setPixelColor(SEGLEN/2, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(strip.now, false, PALETTE_SOLID_WRAP, 0), pixBri));
|
||||
for (int i = SEGLEN - 1; i > SEGLEN/2; i--) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i-1)); //move to the left
|
||||
for (int i = 0; i < SEGLEN/2; i++) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i+1)); // move to the right
|
||||
}
|
||||
@ -6775,7 +6897,7 @@ uint16_t mode_puddlepeak(void) { // Puddlepeak. By Andrew Tuline.
|
||||
}
|
||||
|
||||
for (int i=0; i<size; i++) { // Flash the LED's.
|
||||
SEGMENT.setPixelColor(pos+i, SEGMENT.color_from_palette(millis(), false, PALETTE_SOLID_WRAP, 0));
|
||||
SEGMENT.setPixelColor(pos+i, SEGMENT.color_from_palette(strip.now, false, PALETTE_SOLID_WRAP, 0));
|
||||
}
|
||||
|
||||
return FRAMETIME;
|
||||
@ -6807,7 +6929,7 @@ uint16_t mode_puddles(void) { // Puddles. By Andrew Tuline.
|
||||
}
|
||||
|
||||
for (int i=0; i<size; i++) { // Flash the LED's.
|
||||
SEGMENT.setPixelColor(pos+i, SEGMENT.color_from_palette(millis(), false, PALETTE_SOLID_WRAP, 0));
|
||||
SEGMENT.setPixelColor(pos+i, SEGMENT.color_from_palette(strip.now, false, PALETTE_SOLID_WRAP, 0));
|
||||
}
|
||||
|
||||
return FRAMETIME;
|
||||
@ -6830,7 +6952,7 @@ uint16_t mode_pixels(void) { // Pixels. By Andrew Tuline.
|
||||
}
|
||||
float volumeSmth = *(float*) um_data->u_data[0];
|
||||
|
||||
myVals[millis()%32] = volumeSmth; // filling values semi randomly
|
||||
myVals[strip.now%32] = volumeSmth; // filling values semi randomly
|
||||
|
||||
SEGMENT.fade_out(64+(SEGMENT.speed>>1));
|
||||
|
||||
@ -7188,7 +7310,7 @@ uint16_t mode_noisemove(void) { // Noisemove. By: Andrew Tuli
|
||||
|
||||
uint8_t numBins = map(SEGMENT.intensity,0,255,0,16); // Map slider to fftResult bins.
|
||||
for (int i=0; i<numBins; i++) { // How many active bins are we using.
|
||||
uint16_t locn = inoise16(millis()*SEGMENT.speed+i*50000, millis()*SEGMENT.speed); // Get a new pixel location from moving noise.
|
||||
uint16_t locn = inoise16(strip.now*SEGMENT.speed+i*50000, strip.now*SEGMENT.speed); // Get a new pixel location from moving noise.
|
||||
locn = map(locn, 7500, 58000, 0, SEGLEN-1); // Map that to the length of the strand, and ensure we don't go over.
|
||||
SEGMENT.setPixelColor(locn, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(i*64, false, PALETTE_SOLID_WRAP, 0), fftResult[i % 16]*4));
|
||||
}
|
||||
@ -7313,8 +7435,8 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma.
|
||||
if (SEGENV.call == 0) for (int i=0; i<cols; i++) previousBarHeight[i] = 0;
|
||||
|
||||
bool rippleTime = false;
|
||||
if (millis() - SEGENV.step >= (256U - SEGMENT.intensity)) {
|
||||
SEGENV.step = millis();
|
||||
if (strip.now - SEGENV.step >= (256U - SEGMENT.intensity)) {
|
||||
SEGENV.step = strip.now;
|
||||
rippleTime = true;
|
||||
}
|
||||
|
||||
@ -7522,7 +7644,7 @@ uint16_t mode_2Ddistortionwaves() {
|
||||
|
||||
uint8_t w = 2;
|
||||
|
||||
uint16_t a = millis()/32;
|
||||
uint16_t a = strip.now/32;
|
||||
uint16_t a2 = a/2;
|
||||
uint16_t a3 = a/3;
|
||||
|
||||
@ -7740,7 +7862,7 @@ uint16_t mode_2Dwavingcell() {
|
||||
const uint16_t cols = SEGMENT.virtualWidth();
|
||||
const uint16_t rows = SEGMENT.virtualHeight();
|
||||
|
||||
uint32_t t = millis()/(257-SEGMENT.speed);
|
||||
uint32_t t = strip.now/(257-SEGMENT.speed);
|
||||
uint8_t aX = SEGMENT.custom1/16 + 9;
|
||||
uint8_t aY = SEGMENT.custom2/16 + 1;
|
||||
uint8_t aZ = SEGMENT.custom3 + 1;
|
||||
@ -7945,6 +8067,7 @@ void WS2812FX::setupEffectData() {
|
||||
|
||||
// --- 2D effects ---
|
||||
#ifndef WLED_DISABLE_2D
|
||||
addEffect(FX_MODE_2DPLASMAROTOZOOM, &mode_2Dplasmarotozoom, _data_FX_MODE_2DPLASMAROTOZOOM);
|
||||
addEffect(FX_MODE_2DSPACESHIPS, &mode_2Dspaceships, _data_FX_MODE_2DSPACESHIPS);
|
||||
addEffect(FX_MODE_2DCRAZYBEES, &mode_2Dcrazybees, _data_FX_MODE_2DCRAZYBEES);
|
||||
addEffect(FX_MODE_2DGHOSTRIDER, &mode_2Dghostrider, _data_FX_MODE_2DGHOSTRIDER);
|
||||
|
@ -241,7 +241,7 @@
|
||||
#define FX_MODE_CHUNCHUN 111
|
||||
#define FX_MODE_DANCING_SHADOWS 112
|
||||
#define FX_MODE_WASHING_MACHINE 113
|
||||
// #define FX_MODE_CANDY_CANE 114 // removed in 0.14!
|
||||
#define FX_MODE_2DPLASMAROTOZOOM 114 // was Candy Cane prior to 0.14 (use Chase 2)
|
||||
#define FX_MODE_BLENDS 115
|
||||
#define FX_MODE_TV_SIMULATOR 116
|
||||
#define FX_MODE_DYNAMIC_SMOOTH 117 // candidate for removal (check3 in dynamic)
|
||||
@ -802,8 +802,7 @@ class WS2812FX { // 96 bytes
|
||||
getActiveSegmentsNum(void),
|
||||
getFirstSelectedSegId(void),
|
||||
getLastActiveSegmentId(void),
|
||||
getActiveSegsLightCapabilities(bool selectedOnly = false),
|
||||
setPixelSegment(uint8_t n);
|
||||
getActiveSegsLightCapabilities(bool selectedOnly = false);
|
||||
|
||||
inline uint8_t getBrightness(void) { return _brightness; } // returns current strip brightness
|
||||
inline uint8_t getMaxSegments(void) { return MAX_NUM_SEGMENTS; } // returns maximum number of supported segments (fixed value)
|
||||
|
@ -440,6 +440,7 @@ uint8_t IRAM_ATTR Segment::currentMode() {
|
||||
}
|
||||
|
||||
uint32_t IRAM_ATTR Segment::currentColor(uint8_t slot) {
|
||||
if (slot >= NUM_COLORS) slot = 0;
|
||||
#ifndef WLED_DISABLE_MODE_BLEND
|
||||
return isInTransition() ? color_blend(_t->_segT._colorT[slot], colors[slot], progress(), true) : colors[slot];
|
||||
#else
|
||||
@ -1025,7 +1026,7 @@ void Segment::blur(uint8_t blur_amount) {
|
||||
* Inspired by the Adafruit examples.
|
||||
*/
|
||||
uint32_t Segment::color_wheel(uint8_t pos) {
|
||||
if (palette) return color_from_palette(pos, false, true, 0);
|
||||
if (palette) return color_from_palette(pos, false, true, 0); // perhaps "strip.paletteBlend < 2" should be better instead of "true"
|
||||
uint8_t w = W(currentColor(0));
|
||||
pos = 255 - pos;
|
||||
if (pos < 85) {
|
||||
@ -1056,6 +1057,7 @@ uint32_t Segment::color_from_palette(uint16_t i, bool mapping, bool wrap, uint8_
|
||||
|
||||
uint8_t paletteIndex = i;
|
||||
if (mapping && virtualLength() > 1) paletteIndex = (i*255)/(virtualLength() -1);
|
||||
// paletteBlend: 0 - wrap when moving, 1 - always wrap, 2 - never wrap, 3 - none (undefined)
|
||||
if (!wrap && strip.paletteBlend != 3) paletteIndex = scale8(paletteIndex, 240); //cut off blend at palette "end"
|
||||
CRGBPalette16 curPal;
|
||||
curPal = currentPalette(curPal, palette);
|
||||
@ -1140,7 +1142,7 @@ void WS2812FX::service() {
|
||||
|
||||
_isServicing = true;
|
||||
_segment_index = 0;
|
||||
Segment::handleRandomPalette(); // move it into for loop when each segment has individual random palette
|
||||
|
||||
for (segment &seg : _segments) {
|
||||
if (_suspend) return; // immediately stop processing segments if suspend requested during service()
|
||||
|
||||
@ -1203,6 +1205,7 @@ void WS2812FX::service() {
|
||||
#endif
|
||||
if (doShow) {
|
||||
yield();
|
||||
Segment::handleRandomPalette(); // slowly transtion random palette; move it into for loop when each segment has individual random palette
|
||||
show();
|
||||
}
|
||||
#ifdef WLED_DEBUG
|
||||
@ -1453,6 +1456,7 @@ void WS2812FX::resetSegments() {
|
||||
segment seg = Segment(0, _length);
|
||||
#endif
|
||||
_segments.push_back(seg);
|
||||
_segments.shrink_to_fit(); // just in case ...
|
||||
_mainSegment = 0;
|
||||
}
|
||||
|
||||
@ -1571,18 +1575,7 @@ bool WS2812FX::checkSegmentAlignment() {
|
||||
return true;
|
||||
}
|
||||
|
||||
//After this function is called, setPixelColor() will use that segment (offsets, grouping, ... will apply)
|
||||
//Note: If called in an interrupt (e.g. JSON API), original segment must be restored,
|
||||
//otherwise it can lead to a crash on ESP32 because _segment_index is modified while in use by the main thread
|
||||
uint8_t WS2812FX::setPixelSegment(uint8_t n) {
|
||||
uint8_t prevSegId = _segment_index;
|
||||
if (n < _segments.size()) {
|
||||
_segment_index = n;
|
||||
_virtualSegmentLength = _segments[_segment_index].virtualLength();
|
||||
}
|
||||
return prevSegId;
|
||||
}
|
||||
|
||||
// used by analog clock overlay
|
||||
void WS2812FX::setRange(uint16_t i, uint16_t i2, uint32_t col) {
|
||||
if (i2 < i) std::swap(i,i2);
|
||||
for (unsigned x = i; x <= i2; x++) setPixelColor(x, col);
|
||||
|
@ -63,6 +63,11 @@
|
||||
#define I_8266_U1_UCS_4 54
|
||||
#define I_8266_DM_UCS_4 55
|
||||
#define I_8266_BB_UCS_4 56
|
||||
//ESP8266 APA106
|
||||
#define I_8266_U0_APA106_3 81
|
||||
#define I_8266_U1_APA106_3 82
|
||||
#define I_8266_DM_APA106_3 83
|
||||
#define I_8266_BB_APA106_3 84
|
||||
|
||||
/*** ESP32 Neopixel methods ***/
|
||||
//RGB
|
||||
@ -100,6 +105,10 @@
|
||||
#define I_32_I0_UCS_4 61
|
||||
#define I_32_I1_UCS_4 62
|
||||
//Bit Bang theoratically possible, but very undesirable and not needed (no pin restrictions on RMT and I2S)
|
||||
#define I_32_RN_APA106_3 85
|
||||
#define I_32_I0_APA106_3 86
|
||||
#define I_32_I1_APA106_3 87
|
||||
#define I_32_BB_APA106_3 88 // bitbangging on ESP32 not recommended
|
||||
|
||||
//APA102
|
||||
#define I_HS_DOT_3 39 //hardware SPI
|
||||
@ -162,6 +171,11 @@
|
||||
#define B_8266_U1_UCS_4 NeoPixelBusLg<NeoRgbwUcs8904Feature, NeoEsp8266Uart1Ws2813Method, NeoGammaNullMethod> //4 chan, esp8266, gpio2
|
||||
#define B_8266_DM_UCS_4 NeoPixelBusLg<NeoRgbwUcs8904Feature, NeoEsp8266Dma800KbpsMethod, NeoGammaNullMethod> //4 chan, esp8266, gpio3
|
||||
#define B_8266_BB_UCS_4 NeoPixelBusLg<NeoRgbwUcs8904Feature, NeoEsp8266BitBang800KbpsMethod, NeoGammaNullMethod> //4 chan, esp8266, bb (any pin)
|
||||
//APA106
|
||||
#define B_8266_U0_APA106_3 NeoPixelBusLg<NeoRbgFeature, NeoEsp8266Uart0Apa106Method, NeoGammaNullMethod> //3 chan, esp8266, gpio1
|
||||
#define B_8266_U1_APA106_3 NeoPixelBusLg<NeoRbgFeature, NeoEsp8266Uart1Apa106Method, NeoGammaNullMethod> //3 chan, esp8266, gpio2
|
||||
#define B_8266_DM_APA106_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp8266DmaApa106Method, NeoGammaNullMethod> //3 chan, esp8266, gpio3
|
||||
#define B_8266_BB_APA106_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp8266BitBangApa106Method, NeoGammaNullMethod> //3 chan, esp8266, bb (any pin but 16)
|
||||
#endif
|
||||
|
||||
/*** ESP32 Neopixel methods ***/
|
||||
@ -229,6 +243,14 @@
|
||||
#define B_32_I1_UCS_4 NeoPixelBusLg<NeoRgbwUcs8904Feature, NeoEsp32I2s1800KbpsMethod, NeoGammaNullMethod>
|
||||
#endif
|
||||
//Bit Bang theoratically possible, but very undesirable and not needed (no pin restrictions on RMT and I2S)
|
||||
#define B_32_RN_APA106_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp32RmtNApa106Method, NeoGammaNullMethod>
|
||||
#ifndef WLED_NO_I2S0_PIXELBUS
|
||||
#define B_32_I0_APA106_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp32I2s0Apa106Method, NeoGammaNullMethod>
|
||||
#endif
|
||||
#ifndef WLED_NO_I2S1_PIXELBUS
|
||||
#define B_32_I1_APA106_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp32I2s1Apa106Method, NeoGammaNullMethod>
|
||||
#endif
|
||||
//#define B_32_BB_APA106_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp8266BitBangApa106Method, NeoGammaNullMethod> // NeoEsp8266BitBang800KbpsMethod
|
||||
|
||||
#endif
|
||||
|
||||
@ -327,6 +349,10 @@ class PolyBus {
|
||||
case I_8266_U1_UCS_4: (static_cast<B_8266_U1_UCS_4*>(busPtr))->Begin(); break;
|
||||
case I_8266_DM_UCS_4: (static_cast<B_8266_DM_UCS_4*>(busPtr))->Begin(); break;
|
||||
case I_8266_BB_UCS_4: (static_cast<B_8266_BB_UCS_4*>(busPtr))->Begin(); break;
|
||||
case I_8266_U0_APA106_3: (static_cast<B_8266_U0_APA106_3*>(busPtr))->Begin(); break;
|
||||
case I_8266_U1_APA106_3: (static_cast<B_8266_U1_APA106_3*>(busPtr))->Begin(); break;
|
||||
case I_8266_DM_APA106_3: (static_cast<B_8266_DM_APA106_3*>(busPtr))->Begin(); break;
|
||||
case I_8266_BB_APA106_3: (static_cast<B_8266_BB_APA106_3*>(busPtr))->Begin(); break;
|
||||
#endif
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
case I_32_RN_NEO_3: (static_cast<B_32_RN_NEO_3*>(busPtr))->Begin(); break;
|
||||
@ -379,6 +405,14 @@ class PolyBus {
|
||||
case I_32_I1_UCS_4: (static_cast<B_32_I1_UCS_4*>(busPtr))->Begin(); break;
|
||||
#endif
|
||||
// case I_32_BB_UCS_4: (static_cast<B_32_BB_UCS_4*>(busPtr))->Begin(); break;
|
||||
case I_32_RN_APA106_3: (static_cast<B_32_RN_APA106_3*>(busPtr))->Begin(); break;
|
||||
#ifndef WLED_NO_I2S0_PIXELBUS
|
||||
case I_32_I0_APA106_3: (static_cast<B_32_I0_APA106_3*>(busPtr))->Begin(); break;
|
||||
#endif
|
||||
#ifndef WLED_NO_I2S1_PIXELBUS
|
||||
case I_32_I1_APA106_3: (static_cast<B_32_I1_APA106_3*>(busPtr))->Begin(); break;
|
||||
#endif
|
||||
// case I_32_BB_APA106_3: (static_cast<B_32_BB_APA106_3*>(busPtr))->Begin(); break;
|
||||
// ESP32 can (and should, to avoid inadvertantly driving the chip select signal) specify the pins used for SPI, but only in begin()
|
||||
case I_HS_DOT_3: beginDotStar<B_HS_DOT_3*>(busPtr, pins[1], -1, pins[0], -1, clock_kHz); break;
|
||||
case I_HS_LPD_3: beginDotStar<B_HS_LPD_3*>(busPtr, pins[1], -1, pins[0], -1, clock_kHz); break;
|
||||
@ -427,6 +461,10 @@ class PolyBus {
|
||||
case I_8266_U1_UCS_4: busPtr = new B_8266_U1_UCS_4(len, pins[0]); break;
|
||||
case I_8266_DM_UCS_4: busPtr = new B_8266_DM_UCS_4(len, pins[0]); break;
|
||||
case I_8266_BB_UCS_4: busPtr = new B_8266_BB_UCS_4(len, pins[0]); break;
|
||||
case I_8266_U0_APA106_3: busPtr = new B_8266_U0_APA106_3(len, pins[0]); break;
|
||||
case I_8266_U1_APA106_3: busPtr = new B_8266_U1_APA106_3(len, pins[0]); break;
|
||||
case I_8266_DM_APA106_3: busPtr = new B_8266_DM_APA106_3(len, pins[0]); break;
|
||||
case I_8266_BB_APA106_3: busPtr = new B_8266_BB_APA106_3(len, pins[0]); break;
|
||||
#endif
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
case I_32_RN_NEO_3: busPtr = new B_32_RN_NEO_3(len, pins[0], (NeoBusChannel)channel); break;
|
||||
@ -479,6 +517,14 @@ class PolyBus {
|
||||
case I_32_I1_UCS_4: busPtr = new B_32_I1_UCS_4(len, pins[0]); break;
|
||||
#endif
|
||||
// case I_32_BB_UCS_4: busPtr = new B_32_BB_UCS_4(len, pins[0], (NeoBusChannel)channel); break;
|
||||
case I_32_RN_APA106_3: busPtr = new B_32_RN_APA106_3(len, pins[0], (NeoBusChannel)channel); break;
|
||||
#ifndef WLED_NO_I2S0_PIXELBUS
|
||||
case I_32_I0_APA106_3: busPtr = new B_32_I0_APA106_3(len, pins[0]); break;
|
||||
#endif
|
||||
#ifndef WLED_NO_I2S1_PIXELBUS
|
||||
case I_32_I1_APA106_3: busPtr = new B_32_I1_APA106_3(len, pins[0]); break;
|
||||
#endif
|
||||
// case I_32_BB_APA106_3: busPtr = new B_32_BB_APA106_3(len, pins[0], (NeoBusChannel)channel); break;
|
||||
#endif
|
||||
// for 2-wire: pins[1] is clk, pins[0] is dat. begin expects (len, clk, dat)
|
||||
case I_HS_DOT_3: busPtr = new B_HS_DOT_3(len, pins[1], pins[0]); break;
|
||||
@ -528,6 +574,10 @@ class PolyBus {
|
||||
case I_8266_U1_UCS_4: (static_cast<B_8266_U1_UCS_4*>(busPtr))->Show(consistent); break;
|
||||
case I_8266_DM_UCS_4: (static_cast<B_8266_DM_UCS_4*>(busPtr))->Show(consistent); break;
|
||||
case I_8266_BB_UCS_4: (static_cast<B_8266_BB_UCS_4*>(busPtr))->Show(consistent); break;
|
||||
case I_8266_U0_APA106_3: (static_cast<B_8266_U0_APA106_3*>(busPtr))->Show(consistent); break;
|
||||
case I_8266_U1_APA106_3: (static_cast<B_8266_U1_APA106_3*>(busPtr))->Show(consistent); break;
|
||||
case I_8266_DM_APA106_3: (static_cast<B_8266_DM_APA106_3*>(busPtr))->Show(consistent); break;
|
||||
case I_8266_BB_APA106_3: (static_cast<B_8266_BB_APA106_3*>(busPtr))->Show(consistent); break;
|
||||
#endif
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
case I_32_RN_NEO_3: (static_cast<B_32_RN_NEO_3*>(busPtr))->Show(consistent); break;
|
||||
@ -580,6 +630,14 @@ class PolyBus {
|
||||
case I_32_I1_UCS_4: (static_cast<B_32_I1_UCS_4*>(busPtr))->Show(consistent); break;
|
||||
#endif
|
||||
// case I_32_BB_UCS_4: (static_cast<B_32_BB_UCS_4*>(busPtr))->Show(consistent); break;
|
||||
case I_32_RN_APA106_3: (static_cast<B_32_RN_APA106_3*>(busPtr))->Show(consistent); break;
|
||||
#ifndef WLED_NO_I2S0_PIXELBUS
|
||||
case I_32_I0_APA106_3: (static_cast<B_32_I0_APA106_3*>(busPtr))->Show(consistent); break;
|
||||
#endif
|
||||
#ifndef WLED_NO_I2S1_PIXELBUS
|
||||
case I_32_I1_APA106_3: (static_cast<B_32_I1_APA106_3*>(busPtr))->Show(consistent); break;
|
||||
#endif
|
||||
// case I_32_BB_APA106_3: (static_cast<B_32_BB_APA106_3*>(busPtr))->Show(consistent); break;
|
||||
#endif
|
||||
case I_HS_DOT_3: (static_cast<B_HS_DOT_3*>(busPtr))->Show(consistent); break;
|
||||
case I_SS_DOT_3: (static_cast<B_SS_DOT_3*>(busPtr))->Show(consistent); break;
|
||||
@ -625,6 +683,10 @@ class PolyBus {
|
||||
case I_8266_U0_UCS_4: return (static_cast<B_8266_U0_UCS_4*>(busPtr))->CanShow(); break;
|
||||
case I_8266_U1_UCS_4: return (static_cast<B_8266_U1_UCS_4*>(busPtr))->CanShow(); break;
|
||||
case I_8266_DM_UCS_4: return (static_cast<B_8266_DM_UCS_4*>(busPtr))->CanShow(); break;
|
||||
case I_8266_U0_APA106_3: return (static_cast<B_8266_U0_APA106_3*>(busPtr))->CanShow(); break;
|
||||
case I_8266_U1_APA106_3: return (static_cast<B_8266_U1_APA106_3*>(busPtr))->CanShow(); break;
|
||||
case I_8266_DM_APA106_3: return (static_cast<B_8266_DM_APA106_3*>(busPtr))->CanShow(); break;
|
||||
case I_8266_BB_APA106_3: return (static_cast<B_8266_BB_APA106_3*>(busPtr))->CanShow(); break;
|
||||
#endif
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
case I_32_RN_NEO_3: return (static_cast<B_32_RN_NEO_3*>(busPtr))->CanShow(); break;
|
||||
@ -677,6 +739,14 @@ class PolyBus {
|
||||
case I_32_I1_UCS_4: return (static_cast<B_32_I1_UCS_4*>(busPtr))->CanShow(); break;
|
||||
#endif
|
||||
// case I_32_BB_UCS_4: return (static_cast<B_32_BB_UCS_4*>(busPtr))->CanShow(); break;
|
||||
case I_32_RN_APA106_3: return (static_cast<B_32_RN_APA106_3*>(busPtr))->CanShow(); break;
|
||||
#ifndef WLED_NO_I2S0_PIXELBUS
|
||||
case I_32_I0_APA106_3: return (static_cast<B_32_I0_APA106_3*>(busPtr))->CanShow(); break;
|
||||
#endif
|
||||
#ifndef WLED_NO_I2S1_PIXELBUS
|
||||
case I_32_I1_APA106_3: return (static_cast<B_32_I1_APA106_3*>(busPtr))->CanShow(); break;
|
||||
#endif
|
||||
// case I_32_BB_APA106_3: return (static_cast<B_32_BB_APA106_3*>(busPtr))->CanShow(); break;
|
||||
#endif
|
||||
case I_HS_DOT_3: return (static_cast<B_HS_DOT_3*>(busPtr))->CanShow(); break;
|
||||
case I_SS_DOT_3: return (static_cast<B_SS_DOT_3*>(busPtr))->CanShow(); break;
|
||||
@ -747,6 +817,10 @@ class PolyBus {
|
||||
case I_8266_U1_UCS_4: (static_cast<B_8266_U1_UCS_4*>(busPtr))->SetPixelColor(pix, Rgbw64Color(col)); break;
|
||||
case I_8266_DM_UCS_4: (static_cast<B_8266_DM_UCS_4*>(busPtr))->SetPixelColor(pix, Rgbw64Color(col)); break;
|
||||
case I_8266_BB_UCS_4: (static_cast<B_8266_BB_UCS_4*>(busPtr))->SetPixelColor(pix, Rgbw64Color(col)); break;
|
||||
case I_8266_U0_APA106_3: (static_cast<B_8266_U0_APA106_3*>(busPtr))->SetPixelColor(pix, RgbColor(col)); break;
|
||||
case I_8266_U1_APA106_3: (static_cast<B_8266_U1_APA106_3*>(busPtr))->SetPixelColor(pix, RgbColor(col)); break;
|
||||
case I_8266_DM_APA106_3: (static_cast<B_8266_DM_APA106_3*>(busPtr))->SetPixelColor(pix, RgbColor(col)); break;
|
||||
case I_8266_BB_APA106_3: (static_cast<B_8266_BB_APA106_3*>(busPtr))->SetPixelColor(pix, RgbColor(col)); break;
|
||||
#endif
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
case I_32_RN_NEO_3: (static_cast<B_32_RN_NEO_3*>(busPtr))->SetPixelColor(pix, RgbColor(col)); break;
|
||||
@ -799,6 +873,14 @@ class PolyBus {
|
||||
case I_32_I1_UCS_4: (static_cast<B_32_I1_UCS_4*>(busPtr))->SetPixelColor(pix, Rgbw64Color(col)); break;
|
||||
#endif
|
||||
// case I_32_BB_UCS_4: (static_cast<B_32_BB_UCS_4*>(busPtr))->SetPixelColor(pix, Rgbw64Color(col)); break;
|
||||
case I_32_RN_APA106_3: (static_cast<B_32_RN_APA106_3*>(busPtr))->SetPixelColor(pix, RgbColor(col)); break;
|
||||
#ifndef WLED_NO_I2S0_PIXELBUS
|
||||
case I_32_I0_APA106_3: (static_cast<B_32_I0_APA106_3*>(busPtr))->SetPixelColor(pix, RgbColor(col)); break;
|
||||
#endif
|
||||
#ifndef WLED_NO_I2S1_PIXELBUS
|
||||
case I_32_I1_APA106_3: (static_cast<B_32_I1_APA106_3*>(busPtr))->SetPixelColor(pix, RgbColor(col)); break;
|
||||
#endif
|
||||
// case I_32_BB_APA106_3: (static_cast<B_32_BB_APA106_3*>(busPtr))->SetPixelColor(pix, RgbColor(col)); break;
|
||||
#endif
|
||||
case I_HS_DOT_3: (static_cast<B_HS_DOT_3*>(busPtr))->SetPixelColor(pix, RgbColor(col)); break;
|
||||
case I_SS_DOT_3: (static_cast<B_SS_DOT_3*>(busPtr))->SetPixelColor(pix, RgbColor(col)); break;
|
||||
@ -845,6 +927,10 @@ class PolyBus {
|
||||
case I_8266_U1_UCS_4: (static_cast<B_8266_U1_UCS_4*>(busPtr))->SetLuminance(b); break;
|
||||
case I_8266_DM_UCS_4: (static_cast<B_8266_DM_UCS_4*>(busPtr))->SetLuminance(b); break;
|
||||
case I_8266_BB_UCS_4: (static_cast<B_8266_BB_UCS_4*>(busPtr))->SetLuminance(b); break;
|
||||
case I_8266_U0_APA106_3: (static_cast<B_8266_U0_APA106_3*>(busPtr))->SetLuminance(b); break;
|
||||
case I_8266_U1_APA106_3: (static_cast<B_8266_U1_APA106_3*>(busPtr))->SetLuminance(b); break;
|
||||
case I_8266_DM_APA106_3: (static_cast<B_8266_DM_APA106_3*>(busPtr))->SetLuminance(b); break;
|
||||
case I_8266_BB_APA106_3: (static_cast<B_8266_BB_APA106_3*>(busPtr))->SetLuminance(b); break;
|
||||
#endif
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
case I_32_RN_NEO_3: (static_cast<B_32_RN_NEO_3*>(busPtr))->SetLuminance(b); break;
|
||||
@ -897,6 +983,14 @@ class PolyBus {
|
||||
case I_32_I1_UCS_4: (static_cast<B_32_I1_UCS_4*>(busPtr))->SetLuminance(b); break;
|
||||
#endif
|
||||
// case I_32_BB_UCS_4: (static_cast<B_32_BB_UCS_4*>(busPtr))->SetLuminance(b); break;
|
||||
case I_32_RN_APA106_3: (static_cast<B_32_RN_APA106_3*>(busPtr))->SetLuminance(b); break;
|
||||
#ifndef WLED_NO_I2S0_PIXELBUS
|
||||
case I_32_I0_APA106_3: (static_cast<B_32_I0_APA106_3*>(busPtr))->SetLuminance(b); break;
|
||||
#endif
|
||||
#ifndef WLED_NO_I2S1_PIXELBUS
|
||||
case I_32_I1_APA106_3: (static_cast<B_32_I1_APA106_3*>(busPtr))->SetLuminance(b); break;
|
||||
#endif
|
||||
// case I_32_BB_APA106_3: (static_cast<B_32_BB_APA106_3*>(busPtr))->SetLuminance(b); break;
|
||||
#endif
|
||||
case I_HS_DOT_3: (static_cast<B_HS_DOT_3*>(busPtr))->SetLuminance(b); break;
|
||||
case I_SS_DOT_3: (static_cast<B_SS_DOT_3*>(busPtr))->SetLuminance(b); break;
|
||||
@ -944,6 +1038,10 @@ class PolyBus {
|
||||
case I_8266_U1_UCS_4: { Rgbw64Color c = (static_cast<B_8266_U1_UCS_4*>(busPtr))->GetPixelColor(pix); col = RGBW32(c.R>>8,c.G>>8,c.B>>8,c.W>>8); } break;
|
||||
case I_8266_DM_UCS_4: { Rgbw64Color c = (static_cast<B_8266_DM_UCS_4*>(busPtr))->GetPixelColor(pix); col = RGBW32(c.R>>8,c.G>>8,c.B>>8,c.W>>8); } break;
|
||||
case I_8266_BB_UCS_4: { Rgbw64Color c = (static_cast<B_8266_BB_UCS_4*>(busPtr))->GetPixelColor(pix); col = RGBW32(c.R>>8,c.G>>8,c.B>>8,c.W>>8); } break;
|
||||
case I_8266_U0_APA106_3: col = (static_cast<B_8266_U0_APA106_3*>(busPtr))->GetPixelColor(pix); break;
|
||||
case I_8266_U1_APA106_3: col = (static_cast<B_8266_U1_APA106_3*>(busPtr))->GetPixelColor(pix); break;
|
||||
case I_8266_DM_APA106_3: col = (static_cast<B_8266_DM_APA106_3*>(busPtr))->GetPixelColor(pix); break;
|
||||
case I_8266_BB_APA106_3: col = (static_cast<B_8266_BB_APA106_3*>(busPtr))->GetPixelColor(pix); break;
|
||||
#endif
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
case I_32_RN_NEO_3: col = (static_cast<B_32_RN_NEO_3*>(busPtr))->GetPixelColor(pix); break;
|
||||
@ -996,6 +1094,14 @@ class PolyBus {
|
||||
case I_32_I1_UCS_4: { Rgbw64Color c = (static_cast<B_32_I1_UCS_4*>(busPtr))->GetPixelColor(pix); col = RGBW32(c.R>>8,c.G>>8,c.B>>8,c.W>>8); } break;
|
||||
#endif
|
||||
// case I_32_BB_UCS_4: col = (static_cast<B_32_BB_UCS_4*>(busPtr))->GetPixelColor(pix); break;
|
||||
case I_32_RN_APA106_3: col = (static_cast<B_32_RN_APA106_3*>(busPtr))->GetPixelColor(pix); break;
|
||||
#ifndef WLED_NO_I2S0_PIXELBUS
|
||||
case I_32_I0_APA106_3: col = (static_cast<B_32_I0_APA106_3*>(busPtr))->GetPixelColor(pix); break;
|
||||
#endif
|
||||
#ifndef WLED_NO_I2S1_PIXELBUS
|
||||
case I_32_I1_APA106_3: col = (static_cast<B_32_I1_APA106_3*>(busPtr))->GetPixelColor(pix); break;
|
||||
#endif
|
||||
// case I_32_BB_APA106_3: col = (static_cast<B_32_BB_APA106_3*>(busPtr))->GetPixelColor(pix); break;
|
||||
#endif
|
||||
case I_HS_DOT_3: col = (static_cast<B_HS_DOT_3*>(busPtr))->GetPixelColor(pix); break;
|
||||
case I_SS_DOT_3: col = (static_cast<B_SS_DOT_3*>(busPtr))->GetPixelColor(pix); break;
|
||||
@ -1061,6 +1167,10 @@ class PolyBus {
|
||||
case I_8266_U1_UCS_4: delete (static_cast<B_8266_U1_UCS_4*>(busPtr)); break;
|
||||
case I_8266_DM_UCS_4: delete (static_cast<B_8266_DM_UCS_4*>(busPtr)); break;
|
||||
case I_8266_BB_UCS_4: delete (static_cast<B_8266_BB_UCS_4*>(busPtr)); break;
|
||||
case I_8266_U0_APA106_3: delete (static_cast<B_8266_U0_APA106_3*>(busPtr)); break;
|
||||
case I_8266_U1_APA106_3: delete (static_cast<B_8266_U1_APA106_3*>(busPtr)); break;
|
||||
case I_8266_DM_APA106_3: delete (static_cast<B_8266_DM_APA106_3*>(busPtr)); break;
|
||||
case I_8266_BB_APA106_3: delete (static_cast<B_8266_BB_APA106_3*>(busPtr)); break;
|
||||
#endif
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
case I_32_RN_NEO_3: delete (static_cast<B_32_RN_NEO_3*>(busPtr)); break;
|
||||
@ -1113,6 +1223,14 @@ class PolyBus {
|
||||
case I_32_I1_UCS_4: delete (static_cast<B_32_I1_UCS_4*>(busPtr)); break;
|
||||
#endif
|
||||
// case I_32_BB_UCS_4: delete (static_cast<B_32_BB_UCS_4*>(busPtr)); break;
|
||||
case I_32_RN_APA106_3: delete (static_cast<B_32_RN_APA106_3*>(busPtr)); break;
|
||||
#ifndef WLED_NO_I2S0_PIXELBUS
|
||||
case I_32_I0_APA106_3: delete (static_cast<B_32_I0_APA106_3*>(busPtr)); break;
|
||||
#endif
|
||||
#ifndef WLED_NO_I2S1_PIXELBUS
|
||||
case I_32_I1_APA106_3: delete (static_cast<B_32_I1_APA106_3*>(busPtr)); break;
|
||||
#endif
|
||||
// case I_32_BB_APA106_3: delete (static_cast<B_32_BB_APA106_3*>(busPtr)); break;
|
||||
#endif
|
||||
case I_HS_DOT_3: delete (static_cast<B_HS_DOT_3*>(busPtr)); break;
|
||||
case I_SS_DOT_3: delete (static_cast<B_SS_DOT_3*>(busPtr)); break;
|
||||
@ -1172,6 +1290,8 @@ class PolyBus {
|
||||
return I_8266_U0_UCS_3 + offset;
|
||||
case TYPE_UCS8904:
|
||||
return I_8266_U0_UCS_4 + offset;
|
||||
case TYPE_APA106:
|
||||
return I_8266_U0_APA106_3 + offset;
|
||||
}
|
||||
#else //ESP32
|
||||
uint8_t offset = 0; //0 = RMT (num 0-7) 8 = I2S0 9 = I2S1
|
||||
@ -1210,6 +1330,8 @@ class PolyBus {
|
||||
return I_32_RN_UCS_3 + offset;
|
||||
case TYPE_UCS8904:
|
||||
return I_32_RN_UCS_4 + offset;
|
||||
case TYPE_APA106:
|
||||
return I_32_RN_APA106_3 + offset;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
104
wled00/cfg.cpp
104
wled00/cfg.cpp
@ -40,21 +40,39 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
linked_remote[12] = '\0';
|
||||
#endif
|
||||
|
||||
JsonObject nw_ins_0 = nw["ins"][0];
|
||||
getStringFromJson(clientSSID, nw_ins_0[F("ssid")], 33);
|
||||
//int nw_ins_0_pskl = nw_ins_0[F("pskl")];
|
||||
//The WiFi PSK is normally not contained in the regular file for security reasons.
|
||||
//If it is present however, we will use it
|
||||
getStringFromJson(clientPass, nw_ins_0["psk"], 65);
|
||||
size_t n = 0;
|
||||
JsonArray nw_ins = nw["ins"];
|
||||
if (!nw_ins.isNull()) {
|
||||
// as password are stored separately in wsec.json when reading configuration vector resize happens there, but for dynamic config we need to resize if necessary
|
||||
if (nw_ins.size() > 1 && nw_ins.size() > multiWiFi.size()) multiWiFi.resize(nw_ins.size()); // resize constructs objects while resizing
|
||||
for (JsonObject wifi : nw_ins) {
|
||||
JsonArray ip = wifi["ip"];
|
||||
JsonArray gw = wifi["gw"];
|
||||
JsonArray sn = wifi["sn"];
|
||||
char ssid[33] = "";
|
||||
char pass[65] = "";
|
||||
IPAddress nIP = (uint32_t)0U, nGW = (uint32_t)0U, nSN = (uint32_t)0x00FFFFFF; // little endian
|
||||
getStringFromJson(ssid, wifi[F("ssid")], 33);
|
||||
getStringFromJson(pass, wifi["psk"], 65); // password is not normally present but if it is, use it
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
CJSON(nIP[i], ip[i]);
|
||||
CJSON(nGW[i], gw[i]);
|
||||
CJSON(nSN[i], sn[i]);
|
||||
}
|
||||
if (strlen(ssid) > 0) strlcpy(multiWiFi[n].clientSSID, ssid, 33); // this will keep old SSID intact if not present in JSON
|
||||
if (strlen(pass) > 0) strlcpy(multiWiFi[n].clientPass, pass, 65); // this will keep old password intact if not present in JSON
|
||||
multiWiFi[n].staticIP = nIP;
|
||||
multiWiFi[n].staticGW = nGW;
|
||||
multiWiFi[n].staticSN = nSN;
|
||||
if (++n >= WLED_MAX_WIFI_COUNT) break;
|
||||
}
|
||||
}
|
||||
|
||||
JsonArray nw_ins_0_ip = nw_ins_0["ip"];
|
||||
JsonArray nw_ins_0_gw = nw_ins_0["gw"];
|
||||
JsonArray nw_ins_0_sn = nw_ins_0["sn"];
|
||||
|
||||
for (byte i = 0; i < 4; i++) {
|
||||
CJSON(staticIP[i], nw_ins_0_ip[i]);
|
||||
CJSON(staticGateway[i], nw_ins_0_gw[i]);
|
||||
CJSON(staticSubnet[i], nw_ins_0_sn[i]);
|
||||
JsonArray dns = nw[F("dns")];
|
||||
if (!dns.isNull()) {
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
CJSON(dnsAddress[i], dns[i]);
|
||||
}
|
||||
}
|
||||
|
||||
JsonObject ap = doc["ap"];
|
||||
@ -212,7 +230,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
JsonObject btn_obj = hw["btn"];
|
||||
bool pull = btn_obj[F("pull")] | (!disablePullUp); // if true, pullup is enabled
|
||||
disablePullUp = !pull;
|
||||
JsonArray hw_btn_ins = btn_obj[F("ins")];
|
||||
JsonArray hw_btn_ins = btn_obj["ins"];
|
||||
if (!hw_btn_ins.isNull()) {
|
||||
for (uint8_t b = 0; b < WLED_MAX_BUTTONS; b++) { // deallocate existing button pins
|
||||
pinManager.deallocatePin(btnPin[b], PinOwner::Button); // does nothing if trying to deallocate a pin with PinOwner != Button
|
||||
@ -433,7 +451,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
if (e131Port == DDP_DEFAULT_PORT) e131Port = E131_DEFAULT_PORT; // prevent double DDP port allocation
|
||||
CJSON(e131Multicast, if_live[F("mc")]);
|
||||
|
||||
JsonObject if_live_dmx = if_live[F("dmx")];
|
||||
JsonObject if_live_dmx = if_live["dmx"];
|
||||
CJSON(e131Universe, if_live_dmx[F("uni")]);
|
||||
CJSON(e131SkipOutOfSequence, if_live_dmx[F("seqskip")]);
|
||||
CJSON(DMXAddress, if_live_dmx[F("addr")]);
|
||||
@ -507,6 +525,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
CJSON(analogClock12pixel, ol[F("o12pix")]);
|
||||
CJSON(analogClock5MinuteMarks, ol[F("o5m")]);
|
||||
CJSON(analogClockSecondsTrail, ol[F("osec")]);
|
||||
CJSON(analogClockSolidBlack, ol[F("osb")]);
|
||||
|
||||
//timed macro rules
|
||||
JsonObject tm = doc[F("timers")];
|
||||
@ -665,19 +684,23 @@ void serializeConfig() {
|
||||
#endif
|
||||
|
||||
JsonArray nw_ins = nw.createNestedArray("ins");
|
||||
for (size_t n = 0; n < multiWiFi.size(); n++) {
|
||||
JsonObject wifi = nw_ins.createNestedObject();
|
||||
wifi[F("ssid")] = multiWiFi[n].clientSSID;
|
||||
wifi[F("pskl")] = strlen(multiWiFi[n].clientPass);
|
||||
JsonArray wifi_ip = wifi.createNestedArray("ip");
|
||||
JsonArray wifi_gw = wifi.createNestedArray("gw");
|
||||
JsonArray wifi_sn = wifi.createNestedArray("sn");
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
wifi_ip.add(multiWiFi[n].staticIP[i]);
|
||||
wifi_gw.add(multiWiFi[n].staticGW[i]);
|
||||
wifi_sn.add(multiWiFi[n].staticSN[i]);
|
||||
}
|
||||
}
|
||||
|
||||
JsonObject nw_ins_0 = nw_ins.createNestedObject();
|
||||
nw_ins_0[F("ssid")] = clientSSID;
|
||||
nw_ins_0[F("pskl")] = strlen(clientPass);
|
||||
|
||||
JsonArray nw_ins_0_ip = nw_ins_0.createNestedArray("ip");
|
||||
JsonArray nw_ins_0_gw = nw_ins_0.createNestedArray("gw");
|
||||
JsonArray nw_ins_0_sn = nw_ins_0.createNestedArray("sn");
|
||||
|
||||
for (byte i = 0; i < 4; i++) {
|
||||
nw_ins_0_ip.add(staticIP[i]);
|
||||
nw_ins_0_gw.add(staticGateway[i]);
|
||||
nw_ins_0_sn.add(staticSubnet[i]);
|
||||
JsonArray dns = nw.createNestedArray(F("dns"));
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
dns.add(dnsAddress[i]);
|
||||
}
|
||||
|
||||
JsonObject ap = root.createNestedObject("ap");
|
||||
@ -693,7 +716,7 @@ void serializeConfig() {
|
||||
ap_ip.add(2);
|
||||
ap_ip.add(1);
|
||||
|
||||
JsonObject wifi = root.createNestedObject("wifi");
|
||||
JsonObject wifi = root.createNestedObject(F("wifi"));
|
||||
wifi[F("sleep")] = !noWifiSleep;
|
||||
wifi[F("phy")] = force802_3g;
|
||||
|
||||
@ -721,7 +744,7 @@ void serializeConfig() {
|
||||
}
|
||||
#endif
|
||||
|
||||
JsonObject hw = root.createNestedObject("hw");
|
||||
JsonObject hw = root.createNestedObject(F("hw"));
|
||||
|
||||
JsonObject hw_led = hw.createNestedObject("led");
|
||||
hw_led[F("total")] = strip.getLengthTotal(); //provided for compatibility on downgrade and per-output ABL
|
||||
@ -973,6 +996,7 @@ void serializeConfig() {
|
||||
ol[F("o12pix")] = analogClock12pixel;
|
||||
ol[F("o5m")] = analogClock5MinuteMarks;
|
||||
ol[F("osec")] = analogClockSecondsTrail;
|
||||
ol[F("osb")] = analogClockSolidBlack;
|
||||
|
||||
JsonObject timers = root.createNestedObject(F("timers"));
|
||||
|
||||
@ -1048,8 +1072,17 @@ bool deserializeConfigSec() {
|
||||
|
||||
JsonObject root = pDoc->as<JsonObject>();
|
||||
|
||||
JsonObject nw_ins_0 = root["nw"]["ins"][0];
|
||||
getStringFromJson(clientPass, nw_ins_0["psk"], 65);
|
||||
size_t n = 0;
|
||||
JsonArray nw_ins = root["nw"]["ins"];
|
||||
if (!nw_ins.isNull()) {
|
||||
if (nw_ins.size() > 1 && nw_ins.size() > multiWiFi.size()) multiWiFi.resize(nw_ins.size()); // resize constructs objects while resizing
|
||||
for (JsonObject wifi : nw_ins) {
|
||||
char pw[65] = "";
|
||||
getStringFromJson(pw, wifi["psk"], 65);
|
||||
strlcpy(multiWiFi[n].clientPass, pw, 65);
|
||||
if (++n >= WLED_MAX_WIFI_COUNT) break;
|
||||
}
|
||||
}
|
||||
|
||||
JsonObject ap = root["ap"];
|
||||
getStringFromJson(apPass, ap["psk"] , 65);
|
||||
@ -1088,9 +1121,10 @@ void serializeConfigSec() {
|
||||
JsonObject nw = root.createNestedObject("nw");
|
||||
|
||||
JsonArray nw_ins = nw.createNestedArray("ins");
|
||||
|
||||
JsonObject nw_ins_0 = nw_ins.createNestedObject();
|
||||
nw_ins_0["psk"] = clientPass;
|
||||
for (size_t i = 0; i < multiWiFi.size(); i++) {
|
||||
JsonObject wifi = nw_ins.createNestedObject();
|
||||
wifi[F("psk")] = multiWiFi[i].clientPass;
|
||||
}
|
||||
|
||||
JsonObject ap = root.createNestedObject("ap");
|
||||
ap["psk"] = apPass;
|
||||
|
@ -15,6 +15,10 @@
|
||||
#define DEFAULT_MDNS_NAME "x"
|
||||
|
||||
//increase if you need more
|
||||
#ifndef WLED_MAX_WIFI_COUNT
|
||||
#define WLED_MAX_WIFI_COUNT 3
|
||||
#endif
|
||||
|
||||
#ifndef WLED_MAX_USERMODS
|
||||
#ifdef ESP8266
|
||||
#define WLED_MAX_USERMODS 4
|
||||
@ -157,6 +161,10 @@
|
||||
#define AP_BEHAVIOR_NO_CONN 1 //Open when no connection (either after boot or if connection is lost)
|
||||
#define AP_BEHAVIOR_ALWAYS 2 //Always open
|
||||
#define AP_BEHAVIOR_BUTTON_ONLY 3 //Only when button pressed for 6 sec
|
||||
#define AP_BEHAVIOR_TEMPORARY 4 //Open AP when no connection after boot but only temporary
|
||||
#ifndef WLED_AP_TIMEOUT
|
||||
#define WLED_AP_TIMEOUT 300000 //Temporary AP timeout
|
||||
#endif
|
||||
|
||||
//Notifier callMode
|
||||
#define CALL_MODE_INIT 0 //no updates on init, can be used to disable updates
|
||||
@ -235,6 +243,7 @@
|
||||
#define TYPE_WS2811_400KHZ 24 //half-speed WS2812 protocol, used by very old WS2811 units
|
||||
#define TYPE_TM1829 25
|
||||
#define TYPE_UCS8903 26
|
||||
#define TYPE_APA106 27
|
||||
#define TYPE_UCS8904 29 //first RGBW digital type (hardcoded in busmanager.cpp, memUsage())
|
||||
#define TYPE_SK6812_RGBW 30
|
||||
#define TYPE_TM1814 31
|
||||
@ -292,19 +301,20 @@
|
||||
#define BTN_TYPE_TOUCH_SWITCH 9
|
||||
|
||||
//Ethernet board types
|
||||
#define WLED_NUM_ETH_TYPES 11
|
||||
#define WLED_NUM_ETH_TYPES 12
|
||||
|
||||
#define WLED_ETH_NONE 0
|
||||
#define WLED_ETH_WT32_ETH01 1
|
||||
#define WLED_ETH_ESP32_POE 2
|
||||
#define WLED_ETH_WESP32 3
|
||||
#define WLED_ETH_QUINLED 4
|
||||
#define WLED_ETH_TWILIGHTLORD 5
|
||||
#define WLED_ETH_ESP32DEUX 6
|
||||
#define WLED_ETH_ESP32ETHKITVE 7
|
||||
#define WLED_ETH_QUINLED_OCTA 8
|
||||
#define WLED_ETH_ABCWLEDV43ETH 9
|
||||
#define WLED_ETH_SERG74 10
|
||||
#define WLED_ETH_NONE 0
|
||||
#define WLED_ETH_WT32_ETH01 1
|
||||
#define WLED_ETH_ESP32_POE 2
|
||||
#define WLED_ETH_WESP32 3
|
||||
#define WLED_ETH_QUINLED 4
|
||||
#define WLED_ETH_TWILIGHTLORD 5
|
||||
#define WLED_ETH_ESP32DEUX 6
|
||||
#define WLED_ETH_ESP32ETHKITVE 7
|
||||
#define WLED_ETH_QUINLED_OCTA 8
|
||||
#define WLED_ETH_ABCWLEDV43ETH 9
|
||||
#define WLED_ETH_SERG74 10
|
||||
#define WLED_ETH_ESP32_POE_WROVER 11
|
||||
|
||||
//Hue error codes
|
||||
#define HUE_ERROR_INACTIVE 0
|
||||
|
@ -863,6 +863,15 @@ input[type=range]::-moz-range-thumb {
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
a.btn {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
padding: 8px 32px;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
/* Quick color select wrapper div */
|
||||
#qcs-w {
|
||||
@ -1018,7 +1027,7 @@ textarea {
|
||||
width: 50px !important;
|
||||
}
|
||||
|
||||
.segname, .pname, .bname {
|
||||
.segname, .pname {
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
@ -1028,9 +1037,6 @@ textarea {
|
||||
max-width: 170px;
|
||||
position: relative;
|
||||
}
|
||||
.bname {
|
||||
padding: 0 24px;
|
||||
}
|
||||
|
||||
.segname .flr, .pname .flr {
|
||||
transform: rotate(0deg);
|
||||
@ -1520,7 +1526,7 @@ dialog {
|
||||
#info .infobtn, #nodes .infobtn {
|
||||
width: 145px;
|
||||
}
|
||||
#info div, #nodes div {
|
||||
#info div, #nodes div, #nodes a.btn {
|
||||
max-width: 320px;
|
||||
}
|
||||
}
|
||||
|
@ -46,89 +46,89 @@
|
||||
<div id="Colors" class="tabcontent">
|
||||
<div id="picker" class="noslide"></div>
|
||||
<div id="hwrap" class="slider">
|
||||
<div tooltip="Hue" class="sliderwrap il">
|
||||
<div title="Hue" class="sliderwrap il">
|
||||
<input id="sliderH" class="noslide" oninput="fromH()" onchange="setColor(0)" max="359" min="0" type="range" value="0" step="any">
|
||||
<div class="sliderdisplay" style="background: linear-gradient(90deg, #f00 2%, #ff0 19%, #0f0 35%, #0ff 52%, #00f 68%, #f0f 85%, #f00)"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="swrap" class="slider">
|
||||
<div tooltip="Saturation" class="sliderwrap il">
|
||||
<div title="Saturation" class="sliderwrap il">
|
||||
<input id="sliderS" class="noslide" oninput="fromS()" onchange="setColor(0)" max="100" min="0" type="range" value="100" step="any">
|
||||
<div class="sliderdisplay" style="background: linear-gradient(90deg, #aaa 0%, #f00)"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="vwrap" class="slider">
|
||||
<div tooltip="Value/Brightness" class="sliderwrap il">
|
||||
<div title="Value/Brightness" class="sliderwrap il">
|
||||
<input id="sliderV" class="noslide" oninput="fromV()" onchange="setColor(0)" max="100" min="0" type="range" value="100" step="any" />
|
||||
<div class="sliderdisplay"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="kwrap" class="slider">
|
||||
<div tooltip="Kelvin/Temperature" class="sliderwrap il">
|
||||
<div title="Kelvin/Temperature" class="sliderwrap il">
|
||||
<input id="sliderK" class="noslide" oninput="fromK()" onchange="setColor(0)" max="10091" min="1900" type="range" value="6550" />
|
||||
<div class="sliderdisplay"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="rgbwrap">
|
||||
<div id="rwrap" class="slider">
|
||||
<div tooltip="Red channel" class="sliderwrap il">
|
||||
<div title="Red channel" class="sliderwrap il">
|
||||
<input id="sliderR" class="noslide" oninput="fromRgb()" onchange="setColor(0)" max="255" min="0" type="range" value="128" />
|
||||
<div class="sliderdisplay"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="gwrap" class="slider">
|
||||
<div tooltip="Green channel" class="sliderwrap il">
|
||||
<div title="Green channel" class="sliderwrap il">
|
||||
<input id="sliderG" class="noslide" oninput="fromRgb()" onchange="setColor(0)" max="255" min="0" type="range" value="128" />
|
||||
<div class="sliderdisplay"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bwrap" class="slider">
|
||||
<div tooltip="Blue channel" class="sliderwrap il">
|
||||
<div title="Blue channel" class="sliderwrap il">
|
||||
<input id="sliderB" class="noslide" oninput="fromRgb()" onchange="setColor(0)" max="255" min="0" type="range" value="128" />
|
||||
<div class="sliderdisplay"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="wwrap" class="slider">
|
||||
<div id="whibri" tooltip="White channel" class="sliderwrap il">
|
||||
<div id="whibri" title="White channel" class="sliderwrap il">
|
||||
<input id="sliderW" class="noslide" oninput="fromW()" onchange="setColor(0)" max="255" min="0" type="range" value="128" />
|
||||
<div class="sliderdisplay"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="wbal" class="slider">
|
||||
<div tooltip="White balance" class="sliderwrap il">
|
||||
<div title="White balance" class="sliderwrap il">
|
||||
<input id="sliderA" class="noslide" onchange="setBalance(this.value)" max="255" min="0" type="range" value="128" />
|
||||
<div class="sliderdisplay"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="qcs-w">
|
||||
<div class="qcs" onclick="pC('#ff0000');" tooltip="Red" style="background-color:#ff0000;"></div>
|
||||
<div class="qcs" onclick="pC('#ffa000');" tooltip="Orange" style="background-color:#ffa000;"></div>
|
||||
<div class="qcs" onclick="pC('#ffc800');" tooltip="Yellow" style="background-color:#ffc800;"></div>
|
||||
<div class="qcs" onclick="pC('#ffe0a0');" tooltip="Warm White" style="background-color:#ffe0a0;"></div>
|
||||
<div class="qcs" onclick="pC('#ffffff');" tooltip="White" style="background-color:#ffffff;"></div>
|
||||
<div class="qcs qcsb" onclick="pC('#000000');" tooltip="Black" style="background-color:#000000;"></div><br>
|
||||
<div class="qcs" onclick="pC('#ff00ff');" tooltip="Pink" style="background-color:#ff00ff;"></div>
|
||||
<div class="qcs" onclick="pC('#0000ff');" tooltip="Blue" style="background-color:#0000ff;"></div>
|
||||
<div class="qcs" onclick="pC('#00ffc8');" tooltip="Cyan" style="background-color:#00ffc8;"></div>
|
||||
<div class="qcs" onclick="pC('#08ff00');" tooltip="Green" style="background-color:#08ff00;"></div>
|
||||
<div class="qcs" onclick="pC('rnd');" tooltip="Random" style="background:linear-gradient(to right, red, orange, yellow, green, blue, purple);transform: translateY(-11px);">R</div>
|
||||
<div class="qcs" onclick="pC('#ff0000');" style="background-color:#ff0000;"></div>
|
||||
<div class="qcs" onclick="pC('#ffa000');" style="background-color:#ffa000;"></div>
|
||||
<div class="qcs" onclick="pC('#ffc800');" style="background-color:#ffc800;"></div>
|
||||
<div class="qcs" onclick="pC('#ffe0a0');" style="background-color:#ffe0a0;"></div>
|
||||
<div class="qcs" onclick="pC('#ffffff');" style="background-color:#ffffff;"></div>
|
||||
<div class="qcs qcsb" onclick="pC('#000000');" style="background-color:#000000;"></div><br>
|
||||
<div class="qcs" onclick="pC('#ff00ff');" style="background-color:#ff00ff;"></div>
|
||||
<div class="qcs" onclick="pC('#0000ff');" style="background-color:#0000ff;"></div>
|
||||
<div class="qcs" onclick="pC('#00ffc8');" style="background-color:#00ffc8;"></div>
|
||||
<div class="qcs" onclick="pC('#08ff00');" style="background-color:#08ff00;"></div>
|
||||
<div class="qcs" onclick="pC('rnd');" title="Random" style="background:linear-gradient(to right, red, orange, yellow, green, blue, purple);transform: translateY(-11px);">R</div>
|
||||
</div>
|
||||
<div id="csl">
|
||||
<button id="csl0" tooltip="Select slot" class="btn xxs cl" onclick="selectSlot(0);" data-r="0" data-g="0" data-b="0" data-w="0">1</button>
|
||||
<button id="csl1" tooltip="Select slot" class="btn xxs cl" onclick="selectSlot(1);" data-r="0" data-g="0" data-b="0" data-w="0">2</button>
|
||||
<button id="csl2" tooltip="Select slot" class="btn xxs cl" onclick="selectSlot(2);" data-r="0" data-g="0" data-b="0" data-w="0">3</button>
|
||||
<button id="csl0" title="Select slot" class="btn xxs cl" onclick="selectSlot(0);" data-r="0" data-g="0" data-b="0" data-w="0">1</button>
|
||||
<button id="csl1" title="Select slot" class="btn xxs cl" onclick="selectSlot(1);" data-r="0" data-g="0" data-b="0" data-w="0">2</button>
|
||||
<button id="csl2" title="Select slot" class="btn xxs cl" onclick="selectSlot(2);" data-r="0" data-g="0" data-b="0" data-w="0">3</button>
|
||||
</div>
|
||||
<p class="labels h" id="cslLabel"></p>
|
||||
<div id="hexw">
|
||||
<i class="icons sel-icon" onclick="tglRgb()"></i>
|
||||
<input id="hexc" tooltip="Hex RGB" type="text" class="noslide" onkeydown="hexEnter()" autocomplete="off" maxlength="8" />
|
||||
<input id="hexc" title="Hex RGB" type="text" class="noslide" onkeydown="hexEnter()" autocomplete="off" maxlength="8" />
|
||||
<button id="hexcnf" class="btn btn-xs" onclick="fromHex();"><i class="icons btn-icon"></i></button>
|
||||
</div>
|
||||
<div style="padding: 8px 0;" id="btns">
|
||||
<button class="btn btn-xs" tooltip="Pixel Magic Tool" type="button" id="pxmb" onclick="window.location.href=getURL('/pxmagic.htm')"><i class="icons btn-icon"></i></button>
|
||||
<button class="btn btn-xs" tooltip="Add custom palette" type="button" onclick="window.location.href=getURL('/cpal.htm')"><i class="icons btn-icon"></i></button>
|
||||
<button class="btn btn-xs" tooltip="Remove custom palette" type="button" id="rmPal" onclick="palettesData=null;localStorage.removeItem('wledPalx');requestJson({rmcpal:true});setTimeout(loadPalettes,250,loadPalettesData);"><i class="icons btn-icon"></i></button>
|
||||
<button class="btn btn-xs" title="Pixel Magic Tool" type="button" id="pxmb" onclick="window.location.href=getURL('/pxmagic.htm')"><i class="icons btn-icon"></i></button>
|
||||
<button class="btn btn-xs" title="Add custom palette" type="button" onclick="window.location.href=getURL('/cpal.htm')"><i class="icons btn-icon"></i></button>
|
||||
<button class="btn btn-xs" title="Remove custom palette" type="button" id="rmPal" onclick="palettesData=null;localStorage.removeItem('wledPalx');requestJson({rmcpal:true});setTimeout(loadPalettes,250,loadPalettesData);"><i class="icons btn-icon"></i></button>
|
||||
</div>
|
||||
<p class="labels" id="pall"><i class="icons sel-icon" onclick="tglHex()"></i> Color palette</p>
|
||||
<div id="palw" class="il">
|
||||
@ -159,27 +159,27 @@
|
||||
<i class="icons clear-icon" onclick="clean(this);"></i>
|
||||
<i class="icons search-icon" style="cursor:pointer;"></i>
|
||||
<div id="filters" class="filter fade">
|
||||
<label id="filterPal" tooltip="Uses palette" class="check fchkl">🎨
|
||||
<label id="filterPal" title="Uses palette" class="check fchkl">🎨
|
||||
<input type="checkbox" data-flt="🎨" onchange="filterFx();">
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
<label id="filter0D" tooltip="Single pixel" class="check fchkl">•
|
||||
<label id="filter0D" title="Single pixel" class="check fchkl">•
|
||||
<input type="checkbox" data-flt="•" onchange="filterFx();">
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
<label id="filter1D" tooltip="1D" class="check fchkl">⋮
|
||||
<label id="filter1D" title="1D" class="check fchkl">⋮
|
||||
<input type="checkbox" data-flt="⋮" onchange="filterFx();">
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
<label id="filter2D" tooltip="2D" class="check fchkl">▦
|
||||
<label id="filter2D" title="2D" class="check fchkl">▦
|
||||
<input type="checkbox" data-flt="▦" onchange="filterFx();">
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
<label id="filterVol" tooltip="Volume" class="check fchkl">♪
|
||||
<label id="filterVol" title="Volume" class="check fchkl">♪
|
||||
<input type="checkbox" data-flt="♪" onchange="filterFx();">
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
<label id="filterFreq" tooltip="Frequency" class="check fchkl">♫
|
||||
<label id="filterFreq" title="Frequency" class="check fchkl">♫
|
||||
<input type="checkbox" data-flt="♫" onchange="filterFx();">
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
@ -199,16 +199,16 @@
|
||||
</div>
|
||||
<div id="sliders">
|
||||
<div id="slider0" class="slider">
|
||||
<i class="icons slider-icon" onclick="tglFreeze()"></i>
|
||||
<div tooltip="Effect speed" class="sliderwrap il">
|
||||
<i class="icons slider-icon" title="Freeze" onclick="tglFreeze()"></i>
|
||||
<div title="Effect speed" class="sliderwrap il">
|
||||
<input id="sliderSpeed" class="noslide" onchange="setSpeed()" oninput="updateTrail(this)" max="255" min="0" type="range" value="128" />
|
||||
<div class="sliderdisplay"></div>
|
||||
</div>
|
||||
<output class="sliderbubble"></output>
|
||||
</div>
|
||||
<div id="slider1" class="slider">
|
||||
<i class="icons slider-icon" onclick="tglLabels()"></i>
|
||||
<div tooltip="Effect intensity" class="sliderwrap il">
|
||||
<i class="icons slider-icon" title="Toggle labels" onclick="tglLabels()"></i>
|
||||
<div title="Effect intensity" class="sliderwrap il">
|
||||
<input id="sliderIntensity" class="noslide" onchange="setIntensity()" oninput="updateTrail(this)" max="255" min="0" type="range" value="128" />
|
||||
<div class="sliderdisplay"></div>
|
||||
</div>
|
||||
@ -216,7 +216,7 @@
|
||||
</div>
|
||||
<div id="slider2" class="slider hide">
|
||||
<i class="icons slider-icon"></i>
|
||||
<div tooltip="Custom 1" class="sliderwrap il">
|
||||
<div title="Custom 1" class="sliderwrap il">
|
||||
<input id="sliderC1" class="noslide" onchange="setCustom(1)" oninput="updateTrail(this)" max="255" min="0" type="range" value="0" />
|
||||
<div class="sliderdisplay"></div>
|
||||
</div>
|
||||
@ -224,7 +224,7 @@
|
||||
</div>
|
||||
<div id="slider3" class="slider hide">
|
||||
<i class="icons slider-icon"></i>
|
||||
<div tooltip="Custom 2" class="sliderwrap il">
|
||||
<div title="Custom 2" class="sliderwrap il">
|
||||
<input id="sliderC2" class="noslide" onchange="setCustom(2)" oninput="updateTrail(this)" max="255" min="0" type="range" value="0" />
|
||||
<div class="sliderdisplay"></div>
|
||||
</div>
|
||||
@ -232,22 +232,22 @@
|
||||
</div>
|
||||
<div id="slider4" class="slider hide">
|
||||
<i class="icons slider-icon"></i>
|
||||
<div tooltip="Custom 3" class="sliderwrap il">
|
||||
<div title="Custom 3" class="sliderwrap il">
|
||||
<input id="sliderC3" class="noslide" onchange="setCustom(3)" oninput="updateTrail(this)" max="31" min="0" type="range" value="0" />
|
||||
<div class="sliderdisplay"></div>
|
||||
</div>
|
||||
<output class="sliderbubble"></output>
|
||||
</div>
|
||||
<div id="fxopt" class="option fade">
|
||||
<label id="opt0" tooltip="Check 1" class="check ochkl hide"><i class="icons"></i>
|
||||
<label id="opt0" title="Check 1" class="check ochkl hide"><i class="icons"></i>
|
||||
<input id="checkO1" type="checkbox" onchange="setOption(1, this.checked)">
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
<label id="opt1" tooltip="Check 2" class="check ochkl hide"><i class="icons"></i>
|
||||
<label id="opt1" title="Check 2" class="check ochkl hide"><i class="icons"></i>
|
||||
<input id="checkO2" type="checkbox" onchange="setOption(2, this.checked)">
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
<label id="opt2" tooltip="Check 3" class="check ochkl hide"><i class="icons"></i>
|
||||
<label id="opt2" title="Check 3" class="check ochkl hide"><i class="icons"></i>
|
||||
<input id="checkO3" type="checkbox" onchange="setOption(3, this.checked)">
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
|
@ -1088,7 +1088,7 @@ function populateNodes(i,n)
|
||||
for (var o of n.nodes) {
|
||||
if (o.name) {
|
||||
let onoff = `<i class="icons e-icon flr ${o.type&0x80?'':'off'}" onclick="rmtTgl('${o.ip}',this);""></i>`;
|
||||
var url = `<button class="btn" title="${o.ip}" onclick="location.assign('http://${o.ip}');"><div class="bname">${bname(o)}</div>${o.vid<2307130?'':onoff}</button>`;
|
||||
var url = `<a class="btn" title="${o.ip}" href="http://${o.ip}">${bname(o)}${o.vid<2307130?'':onoff}</a>`;
|
||||
urows += inforow(url,`${btype(o.type&0x7F)}<br><i>${o.vid==0?"N/A":o.vid}</i>`);
|
||||
nnodes++;
|
||||
}
|
||||
@ -2161,7 +2161,7 @@ function selGrp(g)
|
||||
var sel = gId(`segcont`).querySelectorAll(`div[data-set="${g}"]`);
|
||||
var obj = {"seg":[]};
|
||||
for (let i=0; i<=lSeg; i++) if (gId(`seg${i}`)) obj.seg.push({"id":i,"sel":false});
|
||||
if (sel) for (let s of sel||[]) {
|
||||
for (let s of (sel||[])) {
|
||||
let i = parseInt(s.id.substring(3));
|
||||
obj.seg[i] = {"id":i,"sel":true};
|
||||
}
|
||||
@ -3073,12 +3073,17 @@ function mergeDeep(target, ...sources)
|
||||
|
||||
function tooltip()
|
||||
{
|
||||
const elements = d.querySelectorAll("[tooltip]");
|
||||
const elements = d.querySelectorAll("[title]");
|
||||
elements.forEach((element)=>{
|
||||
element.addEventListener("mouseover", ()=>{
|
||||
// save title
|
||||
element.setAttribute("data-title", element.getAttribute("title"));
|
||||
const tooltip = d.createElement("span");
|
||||
tooltip.className = "tooltip";
|
||||
tooltip.textContent = element.getAttribute("tooltip");
|
||||
tooltip.textContent = element.getAttribute("title");
|
||||
|
||||
// prevent default title popup
|
||||
element.removeAttribute("title");
|
||||
|
||||
let { top, left, width } = element.getBoundingClientRect();
|
||||
|
||||
@ -3101,6 +3106,8 @@ function tooltip()
|
||||
tooltip.classList.remove("visible");
|
||||
d.body.removeChild(tooltip);
|
||||
});
|
||||
// restore title
|
||||
element.setAttribute("title", element.getAttribute("data-title"));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -394,6 +394,7 @@ ${i+1}:
|
||||
<option value="24">400kHz</option>\
|
||||
<option value="25">TM1829</option>\
|
||||
<option value="26">UCS8903</option>\
|
||||
<option value="27">APA106/PL9823</option>\
|
||||
<option value="29">UCS8904 RGBW</option>\
|
||||
<option value="50">WS2801</option>\
|
||||
<option value="51">APA102</option>\
|
||||
|
@ -212,6 +212,7 @@
|
||||
12h LED: <input name="OM" type="number" min="0" max="255" required><br>
|
||||
Show 5min marks: <input type="checkbox" name="O5"><br>
|
||||
Seconds (as trail): <input type="checkbox" name="OS"><br>
|
||||
Show clock overlay only if all LEDs are solid black: <input type="checkbox" name="OB"><br>
|
||||
</div>
|
||||
Countdown Mode: <input type="checkbox" name="CE"><br>
|
||||
Countdown Goal:<br>
|
||||
|
@ -8,7 +8,7 @@
|
||||
var d = document;
|
||||
var loc = false, locip, locproto = "http:";
|
||||
var scanLoops = 0, preScanSSID = "";
|
||||
|
||||
var maxNetworks = 3;
|
||||
function gId(e) { return d.getElementById(e); }
|
||||
function cE(e) { return d.createElement(e); }
|
||||
function toggle(el){gId(el).classList.toggle("hide"); gId('No'+el).classList.toggle("hide");}
|
||||
@ -52,13 +52,14 @@
|
||||
}
|
||||
scanLoops = 0;
|
||||
|
||||
let cs = gId("CS");
|
||||
if (cs) {
|
||||
let cs = d.querySelectorAll("#wifi_entries input[type=text]");
|
||||
for (let input of (cs||[])) {
|
||||
let found = false;
|
||||
let select = cE("select");
|
||||
select.setAttribute("id", "CS");
|
||||
select.setAttribute("name", "CS");
|
||||
select.setAttribute("onchange", "T()");
|
||||
preScanSSID = cs.value;
|
||||
select.id = input.id;
|
||||
select.name = input.name;
|
||||
select.setAttribute("onchange", "T(this)");
|
||||
preScanSSID = input.value;
|
||||
|
||||
for (let i = 0; i < select.children.length; i++) {
|
||||
select.removeChild(select.children[i]);
|
||||
@ -70,8 +71,9 @@
|
||||
option.setAttribute("value", networks[i].ssid);
|
||||
option.textContent = `${networks[i].ssid} (${networks[i].rssi} dBm)`;
|
||||
|
||||
if (networks[i].ssid === cs.value) {
|
||||
if (networks[i].ssid === input.value) {
|
||||
option.setAttribute("selected", "selected");
|
||||
found = true;
|
||||
}
|
||||
|
||||
select.appendChild(option);
|
||||
@ -79,10 +81,11 @@
|
||||
const option = cE("option");
|
||||
|
||||
option.setAttribute("value", "!Cs");
|
||||
option.textContent = `Other network...`;
|
||||
option.textContent = "Other network...";
|
||||
select.appendChild(option);
|
||||
|
||||
cs.replaceWith(select);
|
||||
if (input.value === "" || found) input.replaceWith(select);
|
||||
else select.remove();
|
||||
}
|
||||
|
||||
button.disabled = false;
|
||||
@ -90,17 +93,48 @@
|
||||
});
|
||||
}
|
||||
// replace WiFi select with custom SSID input field again
|
||||
function T() {
|
||||
let cs = gId("CS");
|
||||
function T(cs) {
|
||||
if (!cs || cs.value != "!Cs") return;
|
||||
let input = cE("input");
|
||||
input.type = "text";
|
||||
input.id = "CS";
|
||||
input.name ="CS";
|
||||
input.id = cs.id;
|
||||
input.name = cs.name;
|
||||
input.setAttribute("maxlength",32);
|
||||
input.value = preScanSSID;
|
||||
cs.replaceWith(input);
|
||||
}
|
||||
function resetWiFi(maxN = undefined) {
|
||||
if (maxN) maxNetworks = maxN;
|
||||
let entries = gId("wifi_entries").children
|
||||
for (let i = entries.length; i > 0; i--) entries[i-1].remove();
|
||||
btnWiFi(0);
|
||||
}
|
||||
function btnWiFi(i) {
|
||||
gId("wifi_add").style.display = (i<maxNetworks) ? "inline":"none";
|
||||
gId("wifi_rem").style.display = (i>1) ? "inline":"none";
|
||||
}
|
||||
function addWiFi(ssid="",pass="",ip=0,gw=0,sn=0x00ffffff) { // little endian
|
||||
var i = gId("wifi_entries").childNodes.length;
|
||||
if (i >= maxNetworks) return;
|
||||
var b = `<div id="net${i}"><hr class="sml">
|
||||
Network name (SSID${i==0?", empty to not connect":""}):<br><input type="text" id="CS${i}" name="CS${i}" maxlength="32" value="${ssid}" ${i>0?"required":""}><br>
|
||||
Network password:<br><input type="password" name="PW${i}" maxlength="64" value="${pass}"><br>
|
||||
Static IP (leave at 0.0.0.0 for DHCP)${i==0?"<br>Also used by Ethernet":""}:<br>
|
||||
<input name="IP${i}0" type="number" class="s" min="0" max="255" value="${ip&0xFF}" required>.<input name="IP${i}1" type="number" class="s" min="0" max="255" value="${(ip>>8)&0xFF}" required>.<input name="IP${i}2" type="number" class="s" min="0" max="255" value="${(ip>>16)&0xFF}" required>.<input name="IP${i}3" type="number" class="s" min="0" max="255" value="${(ip>>24)&0xFF}" required><br>
|
||||
Static gateway:<br>
|
||||
<input name="GW${i}0" type="number" class="s" min="0" max="255" value="${gw&0xFF}" required>.<input name="GW${i}1" type="number" class="s" min="0" max="255" value="${(gw>>8)&0xFF}" required>.<input name="GW${i}2" type="number" class="s" min="0" max="255" value="${(gw>>16)&0xFF}" required>.<input name="GW${i}3" type="number" class="s" min="0" max="255" value="${(gw>>24)&0xFF}" required><br>
|
||||
Static subnet mask:<br>
|
||||
<input name="SN${i}0" type="number" class="s" min="0" max="255" value="${sn&0xFF}" required>.<input name="SN${i}1" type="number" class="s" min="0" max="255" value="${(sn>>8)&0xFF}" required>.<input name="SN${i}2" type="number" class="s" min="0" max="255" value="${(sn>>16)&0xFF}" required>.<input name="SN${i}3" type="number" class="s" min="0" max="255" value="${(sn>>24)&0xFF}" required></div>`;
|
||||
gId("wifi_entries").insertAdjacentHTML("beforeend", b);
|
||||
btnWiFi(i+1);
|
||||
}
|
||||
function remWiFi() {
|
||||
const entries = gId("wifi_entries").children;
|
||||
const i = entries.length;
|
||||
if (i < 2) return;
|
||||
entries[i-1].remove();
|
||||
btnWiFi(i-1);
|
||||
}
|
||||
// https://www.educative.io/edpresso/how-to-dynamically-load-a-js-file-in-javascript
|
||||
function loadJS(FILE_URL, async = true) {
|
||||
let scE = cE("script");
|
||||
@ -158,24 +192,16 @@
|
||||
<h2>WiFi setup</h2>
|
||||
<h3>Connect to existing network</h3>
|
||||
<button type="button" id="scan" onclick="N()">Scan</button><br>
|
||||
Network name (SSID, empty to not connect):<br>
|
||||
<input type="text" id="CS" name="CS" maxlength="32"><br>
|
||||
Network password: <br> <input type="password" name="CP" maxlength="63"><br>
|
||||
Static IP (leave at 0.0.0.0 for DHCP):<br>
|
||||
<input name="I0" type="number" class="s" min="0" max="255" required> .
|
||||
<input name="I1" type="number" class="s" min="0" max="255" required> .
|
||||
<input name="I2" type="number" class="s" min="0" max="255" required> .
|
||||
<input name="I3" type="number" class="s" min="0" max="255" required><br>
|
||||
Static gateway:<br>
|
||||
<input name="G0" type="number" class="s" min="0" max="255" required> .
|
||||
<input name="G1" type="number" class="s" min="0" max="255" required> .
|
||||
<input name="G2" type="number" class="s" min="0" max="255" required> .
|
||||
<input name="G3" type="number" class="s" min="0" max="255" required><br>
|
||||
Static subnet mask:<br>
|
||||
<input name="S0" type="number" class="s" min="0" max="255" required> .
|
||||
<input name="S1" type="number" class="s" min="0" max="255" required> .
|
||||
<input name="S2" type="number" class="s" min="0" max="255" required> .
|
||||
<input name="S3" type="number" class="s" min="0" max="255" required><br>
|
||||
<div id="wifi">
|
||||
Wireless networks
|
||||
<div id="wifi_entries"></div>
|
||||
<hr class="sml">
|
||||
<button type="button" id="wifi_add" onclick="addWiFi()">+</button>
|
||||
<button type="button" id="wifi_rem" onclick="remWiFi()">-</button><br>
|
||||
</div>
|
||||
DNS server address:<br>
|
||||
<input name="D0" type="number" class="s" min="0" max="255" required>.<input name="D1" type="number" class="s" min="0" max="255" required>.<input name="D2" type="number" class="s" min="0" max="255" required>.<input name="D3" type="number" class="s" min="0" max="255" required><br>
|
||||
<br>
|
||||
mDNS address (leave empty for no mDNS):<br>
|
||||
http:// <input type="text" name="CM" maxlength="32"> .local<br>
|
||||
Client IP: <span class="sip"> Not connected </span> <br>
|
||||
@ -186,10 +212,12 @@
|
||||
Access Point WiFi channel: <input name="AC" type="number" class="xs" min="1" max="13" required><br>
|
||||
AP opens:
|
||||
<select name="AB">
|
||||
<option value="0">No connection after boot</option>
|
||||
<option value="1">Disconnected</option>
|
||||
<option value="2">Always</option>
|
||||
<option value="3">Never (not recommended)</option></select><br>
|
||||
<option value="0">No connection after boot</option>
|
||||
<option value="1">Disconnected</option>
|
||||
<option value="2">Always</option>
|
||||
<option value="3">Never (not recommended)</option>
|
||||
<option value="4">Temporary (no connection after boot)</option>
|
||||
</select><br>
|
||||
AP IP: <span class="sip"> Not active </span><br>
|
||||
<h3>Experimental</h3>
|
||||
Force 802.11g mode (ESP8266 only): <input type="checkbox" name="FG"><br>
|
||||
@ -215,6 +243,7 @@
|
||||
<option value="0">None</option>
|
||||
<option value="9">ABC! WLED V43 & compatible</option>
|
||||
<option value="2">ESP32-POE</option>
|
||||
<option value="11">ESP32-POE-WROVER</option>
|
||||
<option value="6">ESP32Deux</option>
|
||||
<option value="7">KIT-VE</option>
|
||||
<option value="8">QuinLED-Dig-Octa & T-ETH-POE</option>
|
||||
|
@ -81,6 +81,7 @@ input:disabled {
|
||||
}
|
||||
input[type="text"],
|
||||
input[type="number"],
|
||||
input[type="password"],
|
||||
select {
|
||||
font-size: medium;
|
||||
margin: 2px;
|
||||
|
@ -490,7 +490,7 @@ void prepareArtnetPollReply(ArtPollReply *reply) {
|
||||
// Node is DHCP capable
|
||||
// Node supports 15 bit Port-Address (Art-Net 3 or 4)
|
||||
// Node is able to switch between ArtNet and sACN
|
||||
reply->reply_status_2 = (staticIP[0] == 0) ? 0x1F : 0x1D;
|
||||
reply->reply_status_2 = (multiWiFi[0].staticIP[0] == 0) ? 0x1F : 0x1D;
|
||||
|
||||
// RDM is disabled
|
||||
// Output style is continuous
|
||||
|
@ -48,6 +48,21 @@ bool getJsonValue(const JsonVariant& element, DestType& destination, const Defau
|
||||
return true;
|
||||
}
|
||||
|
||||
typedef struct WiFiConfig {
|
||||
char clientSSID[33];
|
||||
char clientPass[65];
|
||||
IPAddress staticIP;
|
||||
IPAddress staticGW;
|
||||
IPAddress staticSN;
|
||||
WiFiConfig(const char *ssid="", const char *pass="", uint32_t ip=0, uint32_t gw=0, uint32_t subnet=0x00FFFFFF) // little endian
|
||||
: staticIP(ip)
|
||||
, staticGW(gw)
|
||||
, staticSN(subnet)
|
||||
{
|
||||
strncpy(clientSSID, ssid, 32); clientSSID[32] = 0;
|
||||
strncpy(clientPass, pass, 64); clientPass[64] = 0;
|
||||
}
|
||||
} wifi_config;
|
||||
|
||||
//colors.cpp
|
||||
// similar to NeoPixelBus NeoGammaTableMethod but allows dynamic changes (superseded by NPB::NeoGammaDynamicTableMethod)
|
||||
|
@ -377,27 +377,27 @@ void updateFSInfo() {
|
||||
|
||||
//Un-comment any file types you need
|
||||
static String getContentType(AsyncWebServerRequest* request, String filename){
|
||||
if(request->hasArg("download")) return "application/octet-stream";
|
||||
else if(filename.endsWith(".htm")) return "text/html";
|
||||
else if(filename.endsWith(".html")) return "text/html";
|
||||
else if(filename.endsWith(".css")) return "text/css";
|
||||
else if(filename.endsWith(".js")) return "application/javascript";
|
||||
else if(filename.endsWith(".json")) return "application/json";
|
||||
else if(filename.endsWith(".png")) return "image/png";
|
||||
else if(filename.endsWith(".gif")) return "image/gif";
|
||||
else if(filename.endsWith(".jpg")) return "image/jpeg";
|
||||
else if(filename.endsWith(".ico")) return "image/x-icon";
|
||||
// else if(filename.endsWith(".xml")) return "text/xml";
|
||||
// else if(filename.endsWith(".pdf")) return "application/x-pdf";
|
||||
// else if(filename.endsWith(".zip")) return "application/x-zip";
|
||||
// else if(filename.endsWith(".gz")) return "application/x-gzip";
|
||||
if(request->hasArg(F("download"))) return SET_F("application/octet-stream");
|
||||
else if(filename.endsWith(F(".htm"))) return SET_F("text/html");
|
||||
else if(filename.endsWith(F(".html"))) return SET_F("text/html");
|
||||
else if(filename.endsWith(F(".css"))) return SET_F("text/css");
|
||||
else if(filename.endsWith(F(".js"))) return SET_F("application/javascript");
|
||||
else if(filename.endsWith(F(".json"))) return SET_F("application/json");
|
||||
else if(filename.endsWith(F(".png"))) return SET_F("image/png");
|
||||
else if(filename.endsWith(F(".gif"))) return SET_F("image/gif");
|
||||
else if(filename.endsWith(F(".jpg"))) return SET_F("image/jpeg");
|
||||
else if(filename.endsWith(F(".ico"))) return SET_F("image/x-icon");
|
||||
// else if(filename.endsWith(F(".xml"))) return SET_F("text/xml");
|
||||
// else if(filename.endsWith(F(".pdf"))) return SET_F("application/x-pdf");
|
||||
// else if(filename.endsWith(F(".zip"))) return SET_F("application/x-zip");
|
||||
// else if(filename.endsWith(F(".gz"))) return SET_F("application/x-gzip");
|
||||
return "text/plain";
|
||||
}
|
||||
|
||||
bool handleFileRead(AsyncWebServerRequest* request, String path){
|
||||
DEBUG_PRINTLN("WS FileRead: " + path);
|
||||
if(path.endsWith("/")) path += "index.htm";
|
||||
if(path.indexOf("sec") > -1) return false;
|
||||
if(path.indexOf(F("sec")) > -1) return false;
|
||||
String contentType = getContentType(request, path);
|
||||
/*String pathWithGz = path + ".gz";
|
||||
if(WLED_FS.exists(pathWithGz)){
|
||||
|
@ -259,14 +259,14 @@ void parseWiFiCommand(char* rpcData) {
|
||||
|
||||
uint8_t ssidLen = rpcData[1];
|
||||
if (ssidLen > len -1 || ssidLen > 32) return;
|
||||
memset(clientSSID, 0, 32);
|
||||
memcpy(clientSSID, rpcData+2, ssidLen);
|
||||
memset(multiWiFi[0].clientSSID, 0, 32);
|
||||
memcpy(multiWiFi[0].clientSSID, rpcData+2, ssidLen);
|
||||
|
||||
memset(clientPass, 0, 64);
|
||||
memset(multiWiFi[0].clientPass, 0, 64);
|
||||
if (len > ssidLen +1) {
|
||||
uint8_t passLen = rpcData[2+ssidLen];
|
||||
memset(clientPass, 0, 64);
|
||||
memcpy(clientPass, rpcData+3+ssidLen, passLen);
|
||||
memset(multiWiFi[0].clientPass, 0, 64);
|
||||
memcpy(multiWiFi[0].clientPass, rpcData+3+ssidLen, passLen);
|
||||
}
|
||||
|
||||
sendImprovStateResponse(0x03); //provisioning
|
||||
|
@ -470,6 +470,19 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
|
||||
}
|
||||
}
|
||||
|
||||
JsonObject wifi = root[F("wifi")];
|
||||
if (!wifi.isNull()) {
|
||||
bool apMode = getBoolVal(wifi[F("ap")], apActive);
|
||||
if (!apActive && apMode) WLED::instance().initAP(); // start AP mode immediately
|
||||
else if (apActive && !apMode) { // stop AP mode immediately
|
||||
dnsServer.stop();
|
||||
WiFi.softAPdisconnect(true);
|
||||
apActive = false;
|
||||
}
|
||||
//bool restart = wifi[F("restart")] | false;
|
||||
//if (restart) forceReconnect = true;
|
||||
}
|
||||
|
||||
stateUpdated(callMode);
|
||||
if (presetToRestore) currentPreset = presetToRestore;
|
||||
|
||||
@ -611,7 +624,7 @@ void serializeInfo(JsonObject root)
|
||||
root[F("vid")] = VERSION;
|
||||
root[F("cn")] = F(WLED_CODENAME);
|
||||
|
||||
JsonObject leds = root.createNestedObject("leds");
|
||||
JsonObject leds = root.createNestedObject(F("leds"));
|
||||
leds[F("count")] = strip.getLengthTotal();
|
||||
leds[F("pwr")] = BusManager::currentMilliamps();
|
||||
leds["fps"] = strip.getFps();
|
||||
@ -622,7 +635,7 @@ void serializeInfo(JsonObject root)
|
||||
|
||||
#ifndef WLED_DISABLE_2D
|
||||
if (strip.isMatrix) {
|
||||
JsonObject matrix = leds.createNestedObject("matrix");
|
||||
JsonObject matrix = leds.createNestedObject(F("matrix"));
|
||||
matrix["w"] = Segment::maxWidth;
|
||||
matrix["h"] = Segment::maxHeight;
|
||||
}
|
||||
@ -702,7 +715,7 @@ void serializeInfo(JsonObject root)
|
||||
}
|
||||
}
|
||||
|
||||
JsonObject wifi_info = root.createNestedObject("wifi");
|
||||
JsonObject wifi_info = root.createNestedObject(F("wifi"));
|
||||
wifi_info[F("bssid")] = WiFi.BSSIDstr();
|
||||
int qrssi = WiFi.RSSI();
|
||||
wifi_info[F("rssi")] = qrssi;
|
||||
|
@ -123,6 +123,16 @@ const ethernet_settings ethernetBoards[] = {
|
||||
18, // eth_mdio,
|
||||
ETH_PHY_LAN8720, // eth_type,
|
||||
ETH_CLOCK_GPIO17_OUT // eth_clk_mode
|
||||
},
|
||||
|
||||
// ESP32-POE-WROVER
|
||||
{
|
||||
0, // eth_address,
|
||||
12, // eth_power,
|
||||
23, // eth_mdc,
|
||||
18, // eth_mdio,
|
||||
ETH_PHY_LAN8720, // eth_type,
|
||||
ETH_CLOCK_GPIO0_OUT // eth_clk_mode
|
||||
}
|
||||
};
|
||||
#endif
|
||||
@ -163,8 +173,8 @@ void WiFiEvent(WiFiEvent_t event)
|
||||
if (!apActive) {
|
||||
WiFi.disconnect(true);
|
||||
}
|
||||
if (staticIP != (uint32_t)0x00000000 && staticGateway != (uint32_t)0x00000000) {
|
||||
ETH.config(staticIP, staticGateway, staticSubnet, IPAddress(8, 8, 8, 8));
|
||||
if (multiWiFi[0].staticIP != (uint32_t)0x00000000 && multiWiFi[0].staticGW != (uint32_t)0x00000000) {
|
||||
ETH.config(multiWiFi[0].staticIP, multiWiFi[0].staticGW, multiWiFi[0].staticSN, dnsAddress);
|
||||
} else {
|
||||
ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
|
||||
}
|
||||
|
@ -89,6 +89,16 @@ void _overlayAnalogCountdown()
|
||||
|
||||
void handleOverlayDraw() {
|
||||
usermods.handleOverlayDraw();
|
||||
if (analogClockSolidBlack) {
|
||||
const Segment* segments = strip.getSegments();
|
||||
for (uint8_t i = 0; i < strip.getSegmentsNum(); i++) {
|
||||
const Segment& segment = segments[i];
|
||||
if (!segment.isActive()) continue;
|
||||
if (segment.mode > 0 || segment.colors[0] > 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (overlayCurrent == 1) _overlayAnalogClock();
|
||||
}
|
||||
|
||||
|
@ -19,21 +19,52 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
//WIFI SETTINGS
|
||||
if (subPage == SUBPAGE_WIFI)
|
||||
{
|
||||
char oldSSID[sizeof(clientSSID)];
|
||||
unsigned cnt = 0;
|
||||
for (size_t n = 0; n < WLED_MAX_WIFI_COUNT; n++) {
|
||||
char cs[4] = "CS"; cs[2] = 48+n; cs[3] = 0; //client SSID
|
||||
char pw[4] = "PW"; pw[2] = 48+n; pw[3] = 0; //client password
|
||||
char ip[5] = "IP"; ip[2] = 48+n; ip[4] = 0; //IP address
|
||||
char gw[5] = "GW"; gw[2] = 48+n; gw[4] = 0; //GW address
|
||||
char sn[5] = "SN"; sn[2] = 48+n; sn[4] = 0; //subnet mask
|
||||
if (request->hasArg(cs)) {
|
||||
if (n >= multiWiFi.size()) multiWiFi.push_back(WiFiConfig()); // expand vector by one
|
||||
char oldSSID[33]; strcpy(oldSSID, multiWiFi[n].clientSSID);
|
||||
char oldPass[65]; strcpy(oldPass, multiWiFi[n].clientPass);
|
||||
|
||||
strcpy(oldSSID, clientSSID);
|
||||
strlcpy(clientSSID,request->arg(F("CS")).c_str(), 33);
|
||||
if (!strcmp(oldSSID, clientSSID)) forceReconnect = true;
|
||||
strlcpy(multiWiFi[n].clientSSID, request->arg(cs).c_str(), 33);
|
||||
if (strlen(oldSSID) == 0 || !strncmp(multiWiFi[n].clientSSID, oldSSID, 32)) {
|
||||
forceReconnect = true;
|
||||
}
|
||||
if (!isAsterisksOnly(request->arg(pw).c_str(), 65)) {
|
||||
strlcpy(multiWiFi[n].clientPass, request->arg(pw).c_str(), 65);
|
||||
forceReconnect = true;
|
||||
}
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
ip[3] = 48+i;
|
||||
gw[3] = 48+i;
|
||||
sn[3] = 48+i;
|
||||
multiWiFi[n].staticIP[i] = request->arg(ip).toInt();
|
||||
multiWiFi[n].staticGW[i] = request->arg(gw).toInt();
|
||||
multiWiFi[n].staticSN[i] = request->arg(sn).toInt();
|
||||
}
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
// remove unused
|
||||
if (cnt < multiWiFi.size()) {
|
||||
cnt = multiWiFi.size() - cnt;
|
||||
while (cnt--) multiWiFi.pop_back();
|
||||
multiWiFi.shrink_to_fit(); // release memory
|
||||
}
|
||||
|
||||
if (!isAsterisksOnly(request->arg(F("CP")).c_str(), 65)) {
|
||||
strlcpy(clientPass, request->arg(F("CP")).c_str(), 65);
|
||||
forceReconnect = true;
|
||||
if (request->hasArg(F("D0"))) {
|
||||
dnsAddress = IPAddress(request->arg(F("D0")).toInt(),request->arg(F("D1")).toInt(),request->arg(F("D2")).toInt(),request->arg(F("D3")).toInt());
|
||||
}
|
||||
|
||||
strlcpy(cmDNS, request->arg(F("CM")).c_str(), 33);
|
||||
|
||||
apBehavior = request->arg(F("AB")).toInt();
|
||||
strcpy(oldSSID, apSSID);
|
||||
char oldSSID[33]; strcpy(oldSSID, apSSID);
|
||||
strlcpy(apSSID, request->arg(F("AS")).c_str(), 33);
|
||||
if (!strcmp(oldSSID, apSSID) && apActive) forceReconnect = true;
|
||||
apHide = request->hasArg(F("AH"));
|
||||
@ -61,21 +92,6 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
ethernetType = request->arg(F("ETH")).toInt();
|
||||
WLED::instance().initEthernet();
|
||||
#endif
|
||||
|
||||
char k[3]; k[2] = 0;
|
||||
for (int i = 0; i<4; i++)
|
||||
{
|
||||
k[1] = i+48;//ascii 0,1,2,3
|
||||
|
||||
k[0] = 'I'; //static IP
|
||||
staticIP[i] = request->arg(k).toInt();
|
||||
|
||||
k[0] = 'G'; //gateway
|
||||
staticGateway[i] = request->arg(k).toInt();
|
||||
|
||||
k[0] = 'S'; //subnet
|
||||
staticSubnet[i] = request->arg(k).toInt();
|
||||
}
|
||||
}
|
||||
|
||||
//LED SETTINGS
|
||||
@ -440,6 +456,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
analogClock12pixel = request->arg(F("OM")).toInt();
|
||||
analogClock5MinuteMarks = request->hasArg(F("O5"));
|
||||
analogClockSecondsTrail = request->hasArg(F("OS"));
|
||||
analogClockSolidBlack = request->hasArg(F("OB"));
|
||||
|
||||
countdownMode = request->hasArg(F("CE"));
|
||||
countdownYear = request->arg(F("CY")).toInt();
|
||||
|
@ -170,7 +170,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef USERMOD_KLIPPER_PERCENTAGE
|
||||
#include "..\usermods\usermod_v2_klipper_percentage\usermod_v2_klipper_percentage.h"
|
||||
#include "../usermods/usermod_v2_klipper_percentage/usermod_v2_klipper_percentage.h"
|
||||
#endif
|
||||
|
||||
#ifdef USERMOD_BOBLIGHT
|
||||
|
149
wled00/wled.cpp
149
wled00/wled.cpp
@ -34,6 +34,8 @@ void WLED::reset()
|
||||
|
||||
void WLED::loop()
|
||||
{
|
||||
static uint32_t lastHeap = UINT32_MAX;
|
||||
static unsigned long heapTime = 0;
|
||||
#ifdef WLED_DEBUG
|
||||
static unsigned long lastRun = 0;
|
||||
unsigned long loopMillis = millis();
|
||||
@ -151,6 +153,21 @@ void WLED::loop()
|
||||
createEditHandler(false);
|
||||
}
|
||||
|
||||
// reconnect WiFi to clear stale allocations if heap gets too low
|
||||
if (millis() - heapTime > 15000) {
|
||||
uint32_t heap = ESP.getFreeHeap();
|
||||
if (heap < MIN_HEAP_SIZE && lastHeap < MIN_HEAP_SIZE) {
|
||||
DEBUG_PRINT(F("Heap too low! ")); DEBUG_PRINTLN(heap);
|
||||
forceReconnect = true;
|
||||
strip.resetSegments(); // remove all but one segments from memory
|
||||
} else if (heap < MIN_HEAP_SIZE) {
|
||||
DEBUG_PRINTLN(F("Heap low, purging segments."));
|
||||
strip.purgeSegments();
|
||||
}
|
||||
lastHeap = heap;
|
||||
heapTime = millis();
|
||||
}
|
||||
|
||||
//LED settings have been saved, re-init busses
|
||||
//This code block causes severe FPS drop on ESP32 with the original "if (busConfigs[0] != nullptr)" conditional. Investigate!
|
||||
if (doInitBusses) {
|
||||
@ -386,7 +403,7 @@ void WLED::setup()
|
||||
//DEBUG_PRINT(F("LEDs inited. heap usage ~"));
|
||||
//DEBUG_PRINTLN(heapPreAlloc - ESP.getFreeHeap());
|
||||
|
||||
#ifdef WLED_DEBUG
|
||||
#if defined(WLED_DEBUG) && !defined(WLED_DEBUG_HOST)
|
||||
pinManager.allocatePin(hardwareTX, true, PinOwner::DebugOut); // TX (GPIO1 on ESP32) reserved for debug output
|
||||
#endif
|
||||
#ifdef WLED_ENABLE_DMX //reserve GPIO2 as hardcoded DMX pin
|
||||
@ -424,6 +441,7 @@ void WLED::setup()
|
||||
escapedMac.toLowerCase();
|
||||
|
||||
WLED_SET_AP_SSID(); // otherwise it is empty on first boot until config is saved
|
||||
multiWiFi.push_back(WiFiConfig(CLIENT_SSID,CLIENT_PASS)); // initialise vector with default WiFi
|
||||
|
||||
DEBUG_PRINTLN(F("Reading config"));
|
||||
deserializeConfigFromFS();
|
||||
@ -445,13 +463,16 @@ void WLED::setup()
|
||||
usermods.setup();
|
||||
DEBUG_PRINT(F("heap ")); DEBUG_PRINTLN(ESP.getFreeHeap());
|
||||
|
||||
if (strcmp(clientSSID, DEFAULT_CLIENT_SSID) == 0)
|
||||
if (strcmp(multiWiFi[0].clientSSID, DEFAULT_CLIENT_SSID) == 0)
|
||||
showWelcomePage = true;
|
||||
WiFi.persistent(false);
|
||||
#ifdef WLED_USE_ETHERNET
|
||||
WiFi.onEvent(WiFiEvent);
|
||||
#endif
|
||||
|
||||
WiFi.mode(WIFI_STA); // enable scanning
|
||||
findWiFi(true); // start scanning for available WiFi-s
|
||||
|
||||
#ifdef WLED_ENABLE_ADALIGHT
|
||||
//Serial RX (Adalight, Improv, Serial JSON) only possible if GPIO3 unused
|
||||
//Serial TX (Debug, Improv, Serial JSON) only possible if GPIO1 unused
|
||||
@ -697,11 +718,52 @@ bool WLED::initEthernet()
|
||||
#else
|
||||
return false; // Ethernet not enabled for build
|
||||
#endif
|
||||
}
|
||||
|
||||
// performs asynchronous scan for available networks (which may take couple of seconds to finish)
|
||||
// returns configured WiFi ID with the strongest signal (or default if no configured networks available)
|
||||
int8_t WLED::findWiFi(bool doScan) {
|
||||
if (multiWiFi.size() <= 1) {
|
||||
DEBUG_PRINTLN(F("Defaulf WiFi used."));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (doScan) WiFi.scanDelete(); // restart scan
|
||||
|
||||
int status = WiFi.scanComplete(); // complete scan may take as much as several seconds (usually <3s with not very crowded air)
|
||||
|
||||
if (status == WIFI_SCAN_FAILED) {
|
||||
DEBUG_PRINTLN(F("WiFi scan started."));
|
||||
WiFi.scanNetworks(true); // start scanning in asynchronous mode
|
||||
} else if (status >= 0) { // status contains number of found networks
|
||||
DEBUG_PRINT(F("WiFi scan completed: ")); DEBUG_PRINTLN(status);
|
||||
int rssi = -9999;
|
||||
int selected = selectedWiFi;
|
||||
for (int o = 0; o < status; o++) {
|
||||
DEBUG_PRINT(F(" WiFi available: ")); DEBUG_PRINT(WiFi.SSID(o));
|
||||
DEBUG_PRINT(F(" RSSI: ")); DEBUG_PRINT(WiFi.RSSI(o)); DEBUG_PRINTLN(F("dB"));
|
||||
for (unsigned n = 0; n < multiWiFi.size(); n++)
|
||||
if (!strcmp(WiFi.SSID(o).c_str(), multiWiFi[n].clientSSID)) {
|
||||
// find the WiFi with the strongest signal (but keep priority of entry if signal difference is not big)
|
||||
if ((n < selected && WiFi.RSSI(o) > rssi-10) || WiFi.RSSI(o) > rssi) {
|
||||
rssi = WiFi.RSSI(o);
|
||||
selected = n;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
DEBUG_PRINT(F("Selected: ")); DEBUG_PRINT(multiWiFi[selected].clientSSID);
|
||||
DEBUG_PRINT(F(" RSSI: ")); DEBUG_PRINT(rssi); DEBUG_PRINTLN(F("dB"));
|
||||
return selected;
|
||||
}
|
||||
//DEBUG_PRINT(F("WiFi scan running."));
|
||||
return status; // scan is still running or there was an error
|
||||
}
|
||||
|
||||
void WLED::initConnection()
|
||||
{
|
||||
DEBUG_PRINTLN(F("initConnection() called."));
|
||||
|
||||
#ifdef WLED_ENABLE_WEBSOCKETS
|
||||
ws.onEvent(wsEvent);
|
||||
#endif
|
||||
@ -714,13 +776,13 @@ void WLED::initConnection()
|
||||
}
|
||||
#endif
|
||||
|
||||
WiFi.disconnect(true); // close old connections
|
||||
WiFi.disconnect(true); // close old connections
|
||||
#ifdef ESP8266
|
||||
WiFi.setPhyMode(force802_3g ? WIFI_PHY_MODE_11G : WIFI_PHY_MODE_11N);
|
||||
#endif
|
||||
|
||||
if (staticIP[0] != 0 && staticGateway[0] != 0) {
|
||||
WiFi.config(staticIP, staticGateway, staticSubnet, IPAddress(1, 1, 1, 1));
|
||||
if (multiWiFi[selectedWiFi].staticIP != 0U && multiWiFi[selectedWiFi].staticGW != 0U) {
|
||||
WiFi.config(multiWiFi[selectedWiFi].staticIP, multiWiFi[selectedWiFi].staticGW, multiWiFi[selectedWiFi].staticSN, dnsAddress);
|
||||
} else {
|
||||
WiFi.config(IPAddress((uint32_t)0), IPAddress((uint32_t)0), IPAddress((uint32_t)0));
|
||||
}
|
||||
@ -745,13 +807,14 @@ void WLED::initConnection()
|
||||
showWelcomePage = false;
|
||||
|
||||
DEBUG_PRINT(F("Connecting to "));
|
||||
DEBUG_PRINT(clientSSID);
|
||||
DEBUG_PRINT(multiWiFi[selectedWiFi].clientSSID);
|
||||
DEBUG_PRINTLN("...");
|
||||
|
||||
// convert the "serverDescription" into a valid DNS hostname (alphanumeric)
|
||||
char hostname[25];
|
||||
prepareHostname(hostname);
|
||||
WiFi.begin(clientSSID, clientPass);
|
||||
WiFi.begin(multiWiFi[selectedWiFi].clientSSID, multiWiFi[selectedWiFi].clientPass); // no harm if called multiple times
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#if defined(LOLIN_WIFI_FIX) && (defined(ARDUINO_ARCH_ESP32C3) || defined(ARDUINO_ARCH_ESP32S2) || defined(ARDUINO_ARCH_ESP32S3))
|
||||
WiFi.setTxPower(WIFI_POWER_8_5dBm);
|
||||
@ -843,35 +906,26 @@ void WLED::initInterfaces()
|
||||
|
||||
void WLED::handleConnection()
|
||||
{
|
||||
static bool scanDone = true;
|
||||
static byte stacO = 0;
|
||||
static uint32_t lastHeap = UINT32_MAX;
|
||||
static unsigned long heapTime = 0;
|
||||
unsigned long now = millis();
|
||||
const bool wifiConfigured = WLED_WIFI_CONFIGURED;
|
||||
|
||||
if (now < 2000 && (!WLED_WIFI_CONFIGURED || apBehavior == AP_BEHAVIOR_ALWAYS))
|
||||
// ignore connection handling if WiFi is configured and scan still running
|
||||
// or within first 2s if WiFi is not configured or AP is always active
|
||||
if ((wifiConfigured && multiWiFi.size() > 1 && WiFi.scanComplete() < 0) || (now < 2000 && (!wifiConfigured || apBehavior == AP_BEHAVIOR_ALWAYS)))
|
||||
return;
|
||||
|
||||
if (lastReconnectAttempt == 0) {
|
||||
DEBUG_PRINTLN(F("lastReconnectAttempt == 0"));
|
||||
if (lastReconnectAttempt == 0 || forceReconnect) {
|
||||
DEBUG_PRINTLN(F("Initial connect or forced reconnect."));
|
||||
selectedWiFi = findWiFi(); // find strongest WiFi
|
||||
initConnection();
|
||||
interfacesInited = false;
|
||||
forceReconnect = false;
|
||||
wasConnected = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// reconnect WiFi to clear stale allocations if heap gets too low
|
||||
if (now - heapTime > 5000) {
|
||||
uint32_t heap = ESP.getFreeHeap();
|
||||
if (heap < MIN_HEAP_SIZE && lastHeap < MIN_HEAP_SIZE) {
|
||||
DEBUG_PRINT(F("Heap too low! "));
|
||||
DEBUG_PRINTLN(heap);
|
||||
forceReconnect = true;
|
||||
strip.resetSegments();
|
||||
} else if (heap < MIN_HEAP_SIZE) {
|
||||
strip.purgeSegments();
|
||||
}
|
||||
lastHeap = heap;
|
||||
heapTime = now;
|
||||
}
|
||||
|
||||
byte stac = 0;
|
||||
if (apActive) {
|
||||
#ifdef ESP8266
|
||||
@ -885,7 +939,7 @@ void WLED::handleConnection()
|
||||
stacO = stac;
|
||||
DEBUG_PRINT(F("Connected AP clients: "));
|
||||
DEBUG_PRINTLN(stac);
|
||||
if (!WLED_CONNECTED && WLED_WIFI_CONFIGURED) { // trying to connect, but not connected
|
||||
if (!WLED_CONNECTED && wifiConfigured) { // trying to connect, but not connected
|
||||
if (stac)
|
||||
WiFi.disconnect(); // disable search so that AP can work
|
||||
else
|
||||
@ -893,36 +947,49 @@ void WLED::handleConnection()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (forceReconnect) {
|
||||
DEBUG_PRINTLN(F("Forcing reconnect."));
|
||||
initConnection();
|
||||
interfacesInited = false;
|
||||
forceReconnect = false;
|
||||
wasConnected = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Network.isConnected()) {
|
||||
if (interfacesInited) {
|
||||
if (scanDone && multiWiFi.size() > 1) {
|
||||
DEBUG_PRINTLN(F("WiFi scan initiated on disconnect."));
|
||||
findWiFi(true); // reinit scan
|
||||
scanDone = false;
|
||||
return; // try to connect in next iteration
|
||||
}
|
||||
DEBUG_PRINTLN(F("Disconnected!"));
|
||||
selectedWiFi = findWiFi();
|
||||
initConnection();
|
||||
interfacesInited = false;
|
||||
scanDone = true;
|
||||
}
|
||||
//send improv failed 6 seconds after second init attempt (24 sec. after provisioning)
|
||||
if (improvActive > 2 && now - lastReconnectAttempt > 6000) {
|
||||
sendImprovStateResponse(0x03, true);
|
||||
improvActive = 2;
|
||||
}
|
||||
if (now - lastReconnectAttempt > ((stac) ? 300000 : 18000) && WLED_WIFI_CONFIGURED) {
|
||||
if (now - lastReconnectAttempt > ((stac) ? 300000 : 18000) && wifiConfigured) {
|
||||
if (improvActive == 2) improvActive = 3;
|
||||
DEBUG_PRINTLN(F("Last reconnect too old."));
|
||||
if (++selectedWiFi >= multiWiFi.size()) selectedWiFi = 0; // we couldn't connect, try with another network from the list
|
||||
initConnection();
|
||||
}
|
||||
if (!apActive && now - lastReconnectAttempt > 12000 && (!wasConnected || apBehavior == AP_BEHAVIOR_NO_CONN)) {
|
||||
DEBUG_PRINTLN(F("Not connected AP."));
|
||||
initAP();
|
||||
if (!(apBehavior == AP_BEHAVIOR_TEMPORARY && now > WLED_AP_TIMEOUT)) {
|
||||
DEBUG_PRINTLN(F("Not connected AP."));
|
||||
initAP(); // start AP only within first 5min
|
||||
}
|
||||
}
|
||||
if (apActive && apBehavior == AP_BEHAVIOR_TEMPORARY && now > WLED_AP_TIMEOUT && stac == 0) { // disconnect AP after 5min if no clients connected
|
||||
// if AP was enabled more than 10min after boot or if client was connected more than 10min after boot do not disconnect AP mode
|
||||
if (now < 2*WLED_AP_TIMEOUT) {
|
||||
dnsServer.stop();
|
||||
WiFi.softAPdisconnect(true);
|
||||
apActive = false;
|
||||
DEBUG_PRINTLN(F("Temporary AP disabled."));
|
||||
}
|
||||
}
|
||||
} else if (!interfacesInited) { //newly connected
|
||||
DEBUG_PRINTLN("");
|
||||
DEBUG_PRINTLN();
|
||||
DEBUG_PRINT(F("Connected! IP address: "));
|
||||
DEBUG_PRINTLN(Network.localIP());
|
||||
if (improvActive) {
|
||||
@ -940,7 +1007,7 @@ void WLED::handleConnection()
|
||||
dnsServer.stop();
|
||||
WiFi.softAPdisconnect(true);
|
||||
apActive = false;
|
||||
DEBUG_PRINTLN(F("Access point disabled (handle)."));
|
||||
DEBUG_PRINTLN(F("Access point disabled (connected)."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
// version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2401140
|
||||
#define VERSION 2401270
|
||||
|
||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||
//#define WLED_USE_MY_CONFIG
|
||||
@ -304,22 +304,21 @@ WLED_GLOBAL int8_t irPin _INIT(IRPIN);
|
||||
WLED_GLOBAL char ntpServerName[33] _INIT("0.wled.pool.ntp.org"); // NTP server to use
|
||||
|
||||
// WiFi CONFIG (all these can be changed via web UI, no need to set them here)
|
||||
WLED_GLOBAL char clientSSID[33] _INIT(CLIENT_SSID);
|
||||
WLED_GLOBAL char clientPass[65] _INIT(CLIENT_PASS);
|
||||
WLED_GLOBAL char cmDNS[33] _INIT(MDNS_NAME); // mDNS address (*.local, replaced by wledXXXXXX if default is used)
|
||||
WLED_GLOBAL char apSSID[33] _INIT(""); // AP off by default (unless setup)
|
||||
WLED_GLOBAL byte apChannel _INIT(1); // 2.4GHz WiFi AP channel (1-13)
|
||||
WLED_GLOBAL byte apHide _INIT(0); // hidden AP SSID
|
||||
WLED_GLOBAL byte apBehavior _INIT(AP_BEHAVIOR_BOOT_NO_CONN); // access point opens when no connection after boot by default
|
||||
WLED_GLOBAL IPAddress staticIP _INIT_N((( 0, 0, 0, 0))); // static IP of ESP
|
||||
WLED_GLOBAL IPAddress staticGateway _INIT_N((( 0, 0, 0, 0))); // gateway (router) IP
|
||||
WLED_GLOBAL IPAddress staticSubnet _INIT_N(((255, 255, 255, 0))); // most common subnet in home networks
|
||||
WLED_GLOBAL uint8_t selectedWiFi _INIT(0);
|
||||
WLED_GLOBAL std::vector<WiFiConfig> multiWiFi;
|
||||
WLED_GLOBAL IPAddress dnsAddress _INIT_N((( 8, 8, 8, 8))); // Google's DNS
|
||||
WLED_GLOBAL char cmDNS[33] _INIT(MDNS_NAME); // mDNS address (*.local, replaced by wledXXXXXX if default is used)
|
||||
WLED_GLOBAL char apSSID[33] _INIT(""); // AP off by default (unless setup)
|
||||
WLED_GLOBAL byte apChannel _INIT(1); // 2.4GHz WiFi AP channel (1-13)
|
||||
WLED_GLOBAL byte apHide _INIT(0); // hidden AP SSID
|
||||
WLED_GLOBAL byte apBehavior _INIT(AP_BEHAVIOR_BOOT_NO_CONN); // access point opens when no connection after boot by default
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
WLED_GLOBAL bool noWifiSleep _INIT(true); // disabling modem sleep modes will increase heat output and power usage, but may help with connection issues
|
||||
WLED_GLOBAL bool noWifiSleep _INIT(true); // disabling modem sleep modes will increase heat output and power usage, but may help with connection issues
|
||||
#else
|
||||
WLED_GLOBAL bool noWifiSleep _INIT(false);
|
||||
#endif
|
||||
WLED_GLOBAL bool force802_3g _INIT(false);
|
||||
#define WLED_WIFI_CONFIGURED (strlen(multiWiFi[0].clientSSID) >= 1 && strcmp(multiWiFi[0].clientSSID, DEFAULT_CLIENT_SSID) != 0)
|
||||
|
||||
#ifdef WLED_USE_ETHERNET
|
||||
#ifdef WLED_ETH_DEFAULT // default ethernet board type if specified
|
||||
@ -494,6 +493,7 @@ WLED_GLOBAL byte overlayMin _INIT(0), overlayMax _INIT(DEFAULT_LED_COUNT - 1);
|
||||
WLED_GLOBAL byte analogClock12pixel _INIT(0); // The pixel in your strip where "midnight" would be
|
||||
WLED_GLOBAL bool analogClockSecondsTrail _INIT(false); // Display seconds as trail of LEDs instead of a single pixel
|
||||
WLED_GLOBAL bool analogClock5MinuteMarks _INIT(false); // Light pixels at every 5-minute position
|
||||
WLED_GLOBAL bool analogClockSolidBlack _INIT(false); // Show clock overlay only if all LEDs are solid black (effect is 0 and color is black)
|
||||
|
||||
WLED_GLOBAL bool countdownMode _INIT(false); // Clock will count down towards date
|
||||
WLED_GLOBAL byte countdownYear _INIT(20), countdownMonth _INIT(1); // Countdown target date, year is last two digits
|
||||
@ -833,7 +833,6 @@ WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0);
|
||||
#else
|
||||
#define WLED_CONNECTED (WiFi.status() == WL_CONNECTED)
|
||||
#endif
|
||||
#define WLED_WIFI_CONFIGURED (strlen(clientSSID) >= 1 && strcmp(clientSSID, DEFAULT_CLIENT_SSID) != 0)
|
||||
|
||||
#ifndef WLED_AP_SSID_UNIQUE
|
||||
#define WLED_SET_AP_SSID() do { \
|
||||
@ -883,6 +882,7 @@ public:
|
||||
void initAP(bool resetAP = false);
|
||||
void initConnection();
|
||||
void initInterfaces();
|
||||
int8_t findWiFi(bool doScan = false);
|
||||
#if defined(STATUSLED)
|
||||
void handleStatusLED();
|
||||
#endif
|
||||
|
@ -74,11 +74,11 @@ void loadSettingsFromEEPROM()
|
||||
int lastEEPROMversion = EEPROM.read(377); //last EEPROM version before update
|
||||
|
||||
|
||||
readStringFromEEPROM( 0, clientSSID, 32);
|
||||
readStringFromEEPROM( 32, clientPass, 64);
|
||||
readStringFromEEPROM( 96, cmDNS, 32);
|
||||
readStringFromEEPROM(128, apSSID, 32);
|
||||
readStringFromEEPROM(160, apPass, 64);
|
||||
readStringFromEEPROM( 0, multiWiFi[0].clientSSID, 32);
|
||||
readStringFromEEPROM( 32, multiWiFi[0].clientPass, 64);
|
||||
readStringFromEEPROM( 96, cmDNS, 32);
|
||||
readStringFromEEPROM(128, apSSID, 32);
|
||||
readStringFromEEPROM(160, apPass, 64);
|
||||
|
||||
nightlightDelayMinsDefault = EEPROM.read(224);
|
||||
nightlightDelayMins = nightlightDelayMinsDefault;
|
||||
|
@ -532,18 +532,18 @@ void serveSettings(AsyncWebServerRequest* request, bool post) {
|
||||
const String& url = request->url();
|
||||
|
||||
if (url.indexOf("sett") >= 0) {
|
||||
if (url.indexOf(".js") > 0) subPage = SUBPAGE_JS;
|
||||
else if (url.indexOf(".css") > 0) subPage = SUBPAGE_CSS;
|
||||
else if (url.indexOf("wifi") > 0) subPage = SUBPAGE_WIFI;
|
||||
else if (url.indexOf("leds") > 0) subPage = SUBPAGE_LEDS;
|
||||
else if (url.indexOf("ui") > 0) subPage = SUBPAGE_UI;
|
||||
else if (url.indexOf("sync") > 0) subPage = SUBPAGE_SYNC;
|
||||
else if (url.indexOf("time") > 0) subPage = SUBPAGE_TIME;
|
||||
else if (url.indexOf("sec") > 0) subPage = SUBPAGE_SEC;
|
||||
else if (url.indexOf("dmx") > 0) subPage = SUBPAGE_DMX;
|
||||
else if (url.indexOf("um") > 0) subPage = SUBPAGE_UM;
|
||||
else if (url.indexOf("2D") > 0) subPage = SUBPAGE_2D;
|
||||
else if (url.indexOf("lock") > 0) subPage = SUBPAGE_LOCK;
|
||||
if (url.indexOf(F(".js")) > 0) subPage = SUBPAGE_JS;
|
||||
else if (url.indexOf(F(".css")) > 0) subPage = SUBPAGE_CSS;
|
||||
else if (url.indexOf(F("wifi")) > 0) subPage = SUBPAGE_WIFI;
|
||||
else if (url.indexOf(F("leds")) > 0) subPage = SUBPAGE_LEDS;
|
||||
else if (url.indexOf(F("ui")) > 0) subPage = SUBPAGE_UI;
|
||||
else if (url.indexOf( "sync") > 0) subPage = SUBPAGE_SYNC;
|
||||
else if (url.indexOf( "time") > 0) subPage = SUBPAGE_TIME;
|
||||
else if (url.indexOf(F("sec")) > 0) subPage = SUBPAGE_SEC;
|
||||
else if (url.indexOf( "dmx") > 0) subPage = SUBPAGE_DMX;
|
||||
else if (url.indexOf( "um") > 0) subPage = SUBPAGE_UM;
|
||||
else if (url.indexOf( "2D") > 0) subPage = SUBPAGE_2D;
|
||||
else if (url.indexOf(F("lock")) > 0) subPage = SUBPAGE_LOCK;
|
||||
}
|
||||
else if (url.indexOf("/update") >= 0) subPage = SUBPAGE_UPDATE; // update page, for PIN check
|
||||
//else if (url.indexOf("/edit") >= 0) subPage = 10;
|
||||
|
@ -157,8 +157,8 @@ void appendGPIOinfo() {
|
||||
oappend(SET_F(",2")); // DMX hardcoded pin
|
||||
#endif
|
||||
|
||||
#ifdef WLED_DEBUG
|
||||
oappend(SET_F(",")); oappend(itoa(hardwareTX,nS,10));// debug output (TX) pin
|
||||
#if defined(WLED_DEBUG) && !defined(WLED_DEBUG_HOST)
|
||||
oappend(SET_F(",")); oappend(itoa(hardwareTX,nS,10)); // debug output (TX) pin
|
||||
#endif
|
||||
|
||||
//Note: Using pin 3 (RX) disables Adalight / Serial JSON
|
||||
@ -248,23 +248,34 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
|
||||
if (subPage == SUBPAGE_WIFI)
|
||||
{
|
||||
sappends('s',SET_F("CS"),clientSSID);
|
||||
|
||||
byte l = strlen(clientPass);
|
||||
char fpass[l+1]; //fill password field with ***
|
||||
fpass[l] = 0;
|
||||
memset(fpass,'*',l);
|
||||
sappends('s',SET_F("CP"),fpass);
|
||||
|
||||
char k[3]; k[2] = 0; //IP addresses
|
||||
for (int i = 0; i<4; i++)
|
||||
{
|
||||
k[1] = 48+i; //ascii 0,1,2,3
|
||||
k[0] = 'I'; sappend('v',k,staticIP[i]);
|
||||
k[0] = 'G'; sappend('v',k,staticGateway[i]);
|
||||
k[0] = 'S'; sappend('v',k,staticSubnet[i]);
|
||||
char nS[10];
|
||||
size_t l;
|
||||
oappend(SET_F("resetWiFi("));
|
||||
oappend(itoa(WLED_MAX_WIFI_COUNT,nS,10));
|
||||
oappend(SET_F(");"));
|
||||
for (size_t n = 0; n < multiWiFi.size(); n++) {
|
||||
l = strlen(multiWiFi[n].clientPass);
|
||||
char fpass[l+1]; //fill password field with ***
|
||||
fpass[l] = 0;
|
||||
memset(fpass,'*',l);
|
||||
oappend(SET_F("addWiFi(\""));
|
||||
oappend(multiWiFi[n].clientSSID);
|
||||
oappend(SET_F("\",\""));
|
||||
oappend(fpass);
|
||||
oappend(SET_F("\",0x"));
|
||||
oappend(itoa(multiWiFi[n].staticIP,nS,16));
|
||||
oappend(SET_F(",0x"));
|
||||
oappend(itoa(multiWiFi[n].staticGW,nS,16));
|
||||
oappend(SET_F(",0x"));
|
||||
oappend(itoa(multiWiFi[n].staticSN,nS,16));
|
||||
oappend(SET_F(");"));
|
||||
}
|
||||
|
||||
sappend('v',SET_F("D0"),dnsAddress[0]);
|
||||
sappend('v',SET_F("D1"),dnsAddress[1]);
|
||||
sappend('v',SET_F("D2"),dnsAddress[2]);
|
||||
sappend('v',SET_F("D3"),dnsAddress[3]);
|
||||
|
||||
sappends('s',SET_F("CM"),cmDNS);
|
||||
sappend('i',SET_F("AB"),apBehavior);
|
||||
sappends('s',SET_F("AS"),apSSID);
|
||||
@ -597,6 +608,7 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappend('v',SET_F("OM"),analogClock12pixel);
|
||||
sappend('c',SET_F("OS"),analogClockSecondsTrail);
|
||||
sappend('c',SET_F("O5"),analogClock5MinuteMarks);
|
||||
sappend('c',SET_F("OB"),analogClockSolidBlack);
|
||||
|
||||
sappend('c',SET_F("CE"),countdownMode);
|
||||
sappend('v',SET_F("CY"),countdownYear);
|
||||
|
Loading…
x
Reference in New Issue
Block a user