diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index ac2a1214..285ad419 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -56,6 +56,9 @@ body: options: - ESP8266 - ESP32 + - ESP32-S3 + - ESP32-S2 + - ESP32-C3 - Other validations: required: true @@ -80,4 +83,4 @@ body: description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Aircoookie/WLED/blob/master/CODE_OF_CONDUCT.md) options: - label: I agree to follow this project's Code of Conduct - required: true \ No newline at end of file + required: true diff --git a/package-lock.json b/package-lock.json index ce4caa8e..ebdf5772 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1742,9 +1742,9 @@ "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=" }, "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==" }, "rc": { "version": "1.2.8", diff --git a/platformio.ini b/platformio.ini index 931dc38f..77b7c38c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -6,16 +6,14 @@ # ENVIRONMENTS # # Please uncomment one of the lines below to select your board(s) +# (use `platformio_override.ini` when building for your own board; see `platformio_override.ini.sample` for an example) # ------------------------------------------------------------------------------ -# Travis CI binaries (use `platformio_override.ini` when building for your own board; see `platformio_override.ini.sample` for an example) -; default_envs = travis_esp8266, travis_esp32 - -# Release binaries -default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, esp32s2_saola, esp32c3 +# Release / CI binaries +default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, esp32s2_saola, esp32c3, 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, travis_esp8266, travis_esp32, 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 +; 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 @@ -113,6 +111,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 -DWLED_USE_MY_CONFIG ; -D USERMOD_SENSORSTOMQTT #For ADS1115 sensor uncomment following @@ -120,13 +119,6 @@ build_flags = build_unflags = -# enables all features for travis CI -build_flags_all_features = - -D WLED_ENABLE_ADALIGHT - -D WLED_ENABLE_DMX - -D WLED_ENABLE_MQTT - -D WLED_ENABLE_WEBSOCKETS - build_flags_esp8266 = ${common.build_flags} ${esp8266.build_flags} build_flags_esp32 = ${common.build_flags} ${esp32.build_flags} @@ -269,8 +261,8 @@ build_flags = -g lib_deps = ${env.lib_deps} - ;; currently we need the latest NeoPixelBus dev version, because it contains important bugfixes for -S3 - https://github.com/Makuna/NeoPixelBus.git#master @ 2.7.0 + ;; NeoPixelBus 2.7.1 is the first that has official support for ESP32-S3 + makuna/NeoPixelBus @ ~2.7.1 https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 @@ -284,7 +276,7 @@ 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_RELEASE_NAME=ESP8266 +build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 #-DWLED_DISABLE_2D lib_deps = ${esp8266.lib_deps} monitor_filters = esp8266_exception_decoder @@ -385,6 +377,7 @@ 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 lib_deps = ${esp32s2.lib_deps} [env:esp32c3] @@ -403,13 +396,18 @@ lib_deps = ${esp32c3.lib_deps} board = esp32-s3-devkitc-1 platform = espressif32@5.1.1 platform_packages = -upload_speed = 921600 +upload_speed = 921600 ; or 460800 build_unflags = ${common.build_unflags} -build_flags = ${common.build_flags} ${esp32s3.build_flags} -D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0 -D ARDUINO_USB_MODE=1 -D ARDUINO_USB_CDC_ON_BOOT=0 -D ARDUINO_USB_MSC_ON_BOOT=0 +build_flags = ${common.build_flags} ${esp32s3.build_flags} + -D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0 + -D ARDUINO_USB_CDC_ON_BOOT=0 -D ARDUINO_USB_MSC_ON_BOOT=0 -D ARDUINO_DFU_ON_BOOT=0 -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip + ;-D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MSC_ON_BOOT=0 -D ARDUINO_DFU_ON_BOOT=0 ; -D ARDUINO_USB_MODE=0 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB") + ;-D WLED_DEBUG lib_deps = ${esp32s3.lib_deps} board_build.partitions = tools/WLED_ESP32_8MB.csv board_build.f_flash = 80000000L board_build.flash_mode = qio +; board_build.flash_mode = dio ;; try this if you have problems at startup monitor_filters = esp32_exception_decoder [env:esp32s3dev_8MB_PSRAM] @@ -422,8 +420,8 @@ platform_packages = upload_speed = 921600 build_unflags = ${common.build_unflags} build_flags = ${common.build_flags} ${esp32s3.build_flags} - -D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0 -D ARDUINO_USB_MODE=1 -D ARDUINO_USB_MSC_ON_BOOT=0 - ; -D ARDUINO_USB_CDC_ON_BOOT=0 + -D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0 + -D ARDUINO_USB_MODE=1 -D ARDUINO_USB_MSC_ON_BOOT=0 ; -D ARDUINO_USB_CDC_ON_BOOT=0 ; -D WLED_RELEASE_NAME=ESP32-S3_PSRAM -D WLED_USE_PSRAM -DBOARD_HAS_PSRAM ; tells WLED that PSRAM shall be used lib_deps = ${esp32s3.lib_deps} @@ -588,22 +586,6 @@ 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} -# ------------------------------------------------------------------------------ -# travis test board configurations -# ------------------------------------------------------------------------------ - -[env:travis_esp8266] -extends = env:d1_mini -build_type = debug -build_unflags = ${common.build_unflags} -build_flags = ${common.build_flags_esp8266} ${common.debug_flags} ${common.build_flags_all_features} - -[env:travis_esp32] -extends = env:esp32dev -; build_type = debug -build_unflags = ${common.build_unflags} -build_flags = ${common.build_flags_esp32} ${common.debug_flags} ${common.build_flags_all_features} - # ------------------------------------------------------------------------------ # codm pixel controller board configurations # codm-controller-0.6 can also be used for the TYWE3S controller diff --git a/readme.md b/readme.md index 2e7843c2..c35e6319 100644 --- a/readme.md +++ b/readme.md @@ -15,11 +15,11 @@ A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control NeoPixel (WS2812B, WS2811, SK6812) LEDs or also SPI based chipsets like the WS2801 and APA102! ## ⚙️ Features -- WS2812FX library integrated for over 100 special effects +- WS2812FX library with more than 100 special effects - FastLED noise effects and 50 palettes - Modern UI with color, effect and segment controls -- Segments to set different effects and colors to parts of the LEDs -- Settings page - configuration over network +- Segments to set different effects and colors to user defined parts of the LED string +- Settings page - configuration via the network - Access Point and station mode - automatic failsafe AP - Up to 10 LED outputs per instance - Support for RGBW strips @@ -28,7 +28,7 @@ A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control - Nightlight function (gradually dims down) - Full OTA software updatability (HTTP + ArduinoOTA), password protectable - Configurable analog clock (Cronixie, 7-segment and EleksTube IPS clock support via usermods) -- Configurable Auto Brightness limit for safer operation +- Configurable Auto Brightness limit for safe operation - Filesystem-based config for easier backup of presets and settings ## 💡 Supported light control interfaces @@ -51,7 +51,7 @@ A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control See the [documentation on our official site](https://kno.wled.ge)! -[On this page](https://kno.wled.ge/basics/tutorials/) you can find excellent tutorials made by the community and helpful tools to help you get your new lamp up and running! +[On this page](https://kno.wled.ge/basics/tutorials/) you can find excellent tutorials and tools to help you get your new project up and running! ## 🖼️ User interface @@ -70,12 +70,16 @@ Join the Discord server to discuss everything about WLED! Check out the WLED [Discourse forum](https://wled.discourse.group)! -You can also send me mails to [dev.aircoookie@gmail.com](mailto:dev.aircoookie@gmail.com), but please only do so if you want to talk to me privately. -If WLED really brightens up your every day, you can [![](https://img.shields.io/badge/send%20me%20a%20small%20gift-paypal-blue.svg?style=flat-square)](https://paypal.me/aircoookie) + +You can also send me mails to [dev.aircoookie@gmail.com](mailto:dev.aircoookie@gmail.com), but please, only do so if you want to talk to me privately. + +If WLED really brightens up your day, you can [![](https://img.shields.io/badge/send%20me%20a%20small%20gift-paypal-blue.svg?style=flat-square)](https://paypal.me/aircoookie) *Disclaimer:* -If you are sensitive to photosensitive epilepsy it is not recommended that you use this software. -In case you still want to try, don't use strobe, lighting or noise modes or high effect speed settings. + +If you are prone to photosensitive epilepsy, we recommended you do **not** use this software. +If you still want to try, don't use strobe, lighting or noise modes or high effect speed settings. + As per the MIT license, I assume no liability for any damage to you or any other person or equipment. diff --git a/requirements.txt b/requirements.txt index 820ecdef..e484d7bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ async-timeout==4.0.2 # via zeroconf bottle==0.12.23 # via platformio -certifi==2022.6.15 +certifi==2022.12.7 # via requests charset-normalizer==2.1.1 # via requests @@ -23,9 +23,7 @@ click==8.1.3 # platformio # uvicorn colorama==0.4.5 - # via - # click - # platformio + # via platformio h11==0.13.0 # via # uvicorn @@ -58,8 +56,6 @@ starlette==0.20.4 # via platformio tabulate==0.8.10 # via platformio -typing-extensions==4.3.0 - # via starlette urllib3==1.26.11 # via requests uvicorn==0.18.2 diff --git a/usermods/ADS1115_v2/readme.md b/usermods/ADS1115_v2/readme.md index 9b778809..44092bc8 100644 --- a/usermods/ADS1115_v2/readme.md +++ b/usermods/ADS1115_v2/readme.md @@ -2,7 +2,7 @@ This usermod will read from an ADS1115 ADC. The voltages are displayed in the Info section of the web UI. -Configuration is all completed via the Usermod menu. There are no settings to set in code! +Configuration is performed via the Usermod menu. There are no parameters to set in code! ## Installation diff --git a/usermods/Animated_Staircase/README.md b/usermods/Animated_Staircase/README.md index 2641e676..61c1cb2d 100644 --- a/usermods/Animated_Staircase/README.md +++ b/usermods/Animated_Staircase/README.md @@ -1,14 +1,14 @@ # Usermod Animated Staircase -This usermod makes your staircase look cool by switching it on with an animation. It uses +This usermod makes your staircase look cool by illuminating it with an animation. It uses PIR or ultrasonic sensors at the top and bottom of your stairs to: -- Light up the steps in your walking direction, leading the way. +- Light up the steps in the direction you're walking. - Switch off the steps after you, in the direction of the last detected movement. - Always switch on when one of the sensors detects movement, even if an effect - is still running. It can therewith handle multiple people on the stairs gracefully. + is still running. It can gracefully handle multiple people on the stairs. The Animated Staircase can be controlled by the WLED API. Change settings such as -speed, on/off time and distance settings by sending an HTTP request, see below. +speed, on/off time and distance by sending an HTTP request, see below. ## WLED integration To include this usermod in your WLED setup, you have to be able to [compile WLED from source](https://github.com/Aircoookie/WLED/wiki/Compiling-WLED). @@ -20,17 +20,16 @@ Edit `usermods_list.cpp`: 2. add `#include "../usermods/Animated_Staircase/Animated_Staircase.h"` to the top of the file 3. add `usermods.add(new Animated_Staircase());` to the end of the `void registerUsermods()` function. -You can configure usermod using Usermods settings page. -Please enter GPIO pins for PIR sensors or ultrasonic sensor (trigger and echo). +You can configure usermod using the Usermods settings page. +Please enter GPIO pins for PIR or ultrasonic sensors (trigger and echo). If you use PIR sensor enter -1 for echo pin. -Maximum distance for ultrasonic sensor can be configured as a time needed for echo (see below). +Maximum distance for ultrasonic sensor can be configured as the time needed for an echo (see below). ## Hardware installation -1. Stick the LED strip under each step of the stairs. -2. Connect the ESP8266 pin D4 or ESP32 pin D2 to the first LED data pin at the bottom step - of your stairs. +1. Attach the LED strip to each step of the stairs. +2. Connect the ESP8266 pin D4 or ESP32 pin D2 to the first LED data pin at the bottom step. 3. Connect the data-out pin at the end of each strip per step to the data-in pin on the - other end of the next step, creating one large virtual LED strip. + next step, creating one large virtual LED strip. 4. Mount sensors of choice at the bottom and top of the stairs and connect them to the ESP. 5. To make sure all LEDs get enough power and have your staircase lighted evenly, power each step from one side, using at least AWG14 or 2.5mm^2 cable. Don't connect them serial as you @@ -62,7 +61,7 @@ or remove them and put everything on one line. To read the current settings, open a browser to `http://xxx.xxx.xxx.xxx/json/state` (use your WLED device IP address). The device will respond with a json object containing all WLED settings. -The staircase settings and sensor states are inside the WLED status element: +The staircase settings and sensor states are inside the WLED "state" element: ```json { @@ -70,14 +69,14 @@ The staircase settings and sensor states are inside the WLED status element: "staircase": { "enabled": true, "bottom-sensor": false, - "tops-ensor": false + "top-sensor": false }, } ``` ### Enable/disable the usermod By disabling the usermod you will be able to keep the LED's on, independent from the sensor -activity. This enables to play with the lights without the usermod switching them on or off. +activity. This enables you to play with the lights without the usermod switching them on or off. To disable the usermod: @@ -92,17 +91,17 @@ To enable the usermod again, use `"enabled":true`. Alternatively you can use _Usermod_ Settings page where you can change other parameters as well. ### Changing animation parameters and detection range of the ultrasonic HC-SR04 sensor -Using _Usermod_ Settings page you can define different usermod parameters, includng sensor pins, delay between segment activation and so on. +Using _Usermod_ Settings page you can define different usermod parameters, includng sensor pins, delay between segment activation etc. When an ultrasonic sensor is enabled you can enter maximum detection distance in centimeters separately for top and bottom sensors. -**Please note:** that using an HC-SR04 sensor, particularly when detecting echos at longer -distances creates delays in the WLED software, and _might_ introduce timing hickups in your animations or +**Please note:** using an HC-SR04 sensor, particularly when detecting echos at longer +distances creates delays in the WLED software, _might_ introduce timing hiccups in your animation or a less responsive web interface. It is therefore advised to keep the detection distance as short as possible. ### Animation triggering through the API -Instead of stairs activation by one of the sensors, you can also trigger the animation through -the API. To simulate triggering the bottom sensor, use: +In addition to activation by one of the stair sensors, you can also trigger the animation manually +via the API. To simulate triggering the bottom sensor, use: ```bash curl -X POST -H "Content-Type: application/json" \ @@ -110,7 +109,7 @@ curl -X POST -H "Content-Type: application/json" \ xxx.xxx.xxx.xxx/json/state ``` -Likewise, to trigger the top sensor, use: +Likewise, to trigger the top sensor: ```bash curl -X POST -H "Content-Type: application/json" \ @@ -119,7 +118,7 @@ curl -X POST -H "Content-Type: application/json" \ ``` **MQTT** You can publish a message with either `up` or `down` on topic `/swipe` to trigger animation. -You can also use `on` or `off` for enabling or disabling usermod. +You can also use `on` or `off` for enabling or disabling the usermod. Have fun with this usermod.
www.rolfje.com @@ -128,4 +127,4 @@ Modifications @blazoncek ## Change log 2021-04 -* Adaptation for runtime configuration. \ No newline at end of file +* Adaptation for runtime configuration. diff --git a/usermods/BH1750_v2/readme.md b/usermods/BH1750_v2/readme.md index f70300b7..05a033cf 100644 --- a/usermods/BH1750_v2/readme.md +++ b/usermods/BH1750_v2/readme.md @@ -1,7 +1,7 @@ # BH1750 usermod -This usermod will read from an ambient light sensor like the BH1750 sensor. -The luminance is displayed both in the Info section of the web UI as well as published to the `/luminance` MQTT topic if enabled. +This usermod will read from an ambient light sensor like the BH1750. +The luminance is displayed in both the Info section of the web UI, as well as published to the `/luminance` MQTT topic if enabled. ## Dependencies - Libraries @@ -28,9 +28,9 @@ The following settings can be set at compile-time but are configurable on the us * `USERMOD_BH1750_MAX_MEASUREMENT_INTERVAL` - the max number of milliseconds between measurements, defaults to 10000ms * `USERMOD_BH1750_MIN_MEASUREMENT_INTERVAL` - the min number of milliseconds between measurements, defaults to 500ms * `USERMOD_BH1750_OFFSET_VALUE` - the offset value to report on, defaults to 1 -* `USERMOD_BH1750_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 10 seconds +* `USERMOD_BH1750_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 10000 ms -In addition, on the Usermod screen allows you to: +In addition, the Usermod screen allows you to: - enable/disable the usermod - Enable Home Assistant Discovery of usermod - Configure the SCL/SDA pins @@ -44,6 +44,6 @@ Jul 2022 - Added Home Assistant Discovery - Implemented PinManager to register pins - Made pins configurable in usermod menu -- Added API call to read illuminance from other modules +- Added API call to read luminance from other modules - Enhanced info-screen outputs -- Updated `readme.md` \ No newline at end of file +- Updated `readme.md` diff --git a/usermods/BME280_v2/README.md b/usermods/BME280_v2/README.md index b8718e0e..0a4afbf1 100644 --- a/usermods/BME280_v2/README.md +++ b/usermods/BME280_v2/README.md @@ -6,14 +6,14 @@ This Usermod is designed to read a `BME280` or `BMP280` sensor and output the fo - Heat Index (`BME280` only) - Dew Point (`BME280` only) -Configuration is all completed via the Usermod menu. There are no settings to set in code! The following settings can be configured in the Usermod Menu: +Configuration is performed via the Usermod menu. There are no parameters to set in code! The following settings can be configured in the Usermod Menu: - Temperature Decimals (number of decimal places to output) - Humidity Decimals - Pressure Decimals -- Temperature Interval (how many seconds between reads of temperature and humidity) +- Temperature Interval (how many seconds between temperature and humidity measurements) - Pressure Interval - Publish Always (turn off to only publish changes, on to publish whether or not value changed) -- Use Celsius (turn off to use Farenheit) +- Use Celsius (turn off to use Fahrenheit) - Home Assistant Discovery (turn on to sent MQTT Discovery entries for Home Assistant) - SCL/SDA GPIO Pins @@ -23,7 +23,7 @@ Dependencies - `Wire` - These must be added under `lib_deps` in your `platform.ini` (or `platform_override.ini`). - Data is published over MQTT - make sure you've enabled the MQTT sync interface. -- This usermod also writes to serial (GPIO1 on ESP8266). Please make sure nothing else listening on the serial TX pin of your board will get confused by log messages! +- This usermod also writes to serial (GPIO1 on ESP8266). Please make sure nothing else is listening to the serial TX pin or your board will get confused by log messages! In addition to outputting via MQTT, you can read the values from the Info Screen on the dashboard page of the device's web interface. @@ -37,7 +37,7 @@ Methods also exist to read the read/calculated values from other WLED modules th - `getHeatIndexC()` - `getHeatIndexF()` -# Complilation +# Compiling To enable, compile with `USERMOD_BME280` defined (e.g. in `platformio_override.ini`) ```ini @@ -63,7 +63,7 @@ Pressure | `/pressure` Heat index | `/heat_index` Dew point | `/dew_point` -If you are using Home Assistant, and `Home Assistant Discovery` is turned on, Home Assistant should automatically detect a new device, provided you have the MQTT integration installed. The device is seperate from the main WLED device and will contain sensors for Pressure, Humidity, Temperature, Dew Point and Heat Index. +If you are using Home Assistant, and `Home Assistant Discovery` is turned on, Home Assistant should automatically detect a new device, provided you have the MQTT integration installed. The device is separate from the main WLED device and will contain sensors for Pressure, Humidity, Temperature, Dew Point and Heat Index. # Revision History Jul 2022 @@ -82,9 +82,9 @@ Apr 2021 Dec 2020 - Ported to V2 Usermod format -- Customisable `measure intervals` -- Customisable number of `decimal places` in published sensor values +- Customizable `measure intervals` +- Customizable number of `decimal places` in published sensor values - Pressure measured in units of hPa instead of Pa - Calculation of heat index (apparent temperature) and dew point - `16x oversampling` of sensor during measurement -- Values only published if they are different from the previous value \ No newline at end of file +- Values only published if they are different from the previous value diff --git a/usermods/DHT/readme.md b/usermods/DHT/readme.md index 55b1dd1c..6089ffbf 100644 --- a/usermods/DHT/readme.md +++ b/usermods/DHT/readme.md @@ -1,11 +1,11 @@ # DHT Temperature/Humidity sensor usermod This usermod will read from an attached DHT22 or DHT11 humidity and temperature sensor. -The sensor readings are displayed in the Info section of the web UI (and optionally send to a MQTT broker). +The sensor readings are displayed in the Info section of the web UI (and optionally sent to an MQTT broker). -If sensor is not detected after a while (10 update intervals), this usermod will be disabled. +If sensor is not detected after 10 update intervals, the usermod will be disabled. -If enabled measured temperature and humidity will be published to the following MQTT topics +If enabled, measured temperature and humidity will be published to the following MQTT topics * `{devceTopic}/dht/temperature` * `{devceTopic}/dht/humidity` @@ -15,13 +15,13 @@ Copy the example `platformio_override.ini` to the root directory. This file sho ### Define Your Options -* `USERMOD_DHT` - define this to have this user mod included wled00\usermods_list.cpp +* `USERMOD_DHT` - define this to include this user mod wled00\usermods_list.cpp * `USERMOD_DHT_DHTTYPE` - DHT model: 11, 21, 22 for DHT11, DHT21, or DHT22, defaults to 22/DHT22 * `USERMOD_DHT_PIN` - pin to which DTH is connected, defaults to Q2 pin on QuinLed Dig-Uno's board -* `USERMOD_DHT_CELSIUS` - define this to report temperatures in degrees celsious, otherwise fahrenheit will be reported -* `USERMOD_DHT_MEASUREMENT_INTERVAL` - the number of milliseconds between measurements, defaults to 60 seconds -* `USERMOD_DHT_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 90 seconds -* `USERMOD_DHT_MQTT` - publish measurements to the MQTT broker +* `USERMOD_DHT_CELSIUS` - define this to report temperatures in degrees Celsius, otherwise Fahrenheit will be reported +* `USERMOD_DHT_MEASUREMENT_INTERVAL` - the number of milliseconds between measurements, defaults to 60000 ms +* `USERMOD_DHT_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 90000 ms +* `USERMOD_DHT_MQTT` - publish measurements to an MQTT broker * `USERMOD_DHT_STATS` - For debug, report delay stats ## Project link @@ -35,11 +35,11 @@ If you are using `platformio_override.ini`, you should be able to refresh the ta ## Change Log 2022-10-15 -* Add possibility to publish sensor readings to an MQTT broker +* Add ability to publish sensor readings to an MQTT broker * fix compilation error for sample [env:d1_mini_usermod_dht_C] task 2020-02-04 * Change default QuinLed pin to Q2 -* Instead of trying to keep updates at constant cadence, space readings out by measurement interval; hope this helps to avoid occasional bursts of readings with errors +* Instead of trying to keep updates at constant cadence, space out readings by measurement interval. Hopefully, this helps eliminate occasional bursts of readings with errors * Add some more (optional) stats 2020-02-03 * Due to poor readouts on ESP32 with previous DHT library, rewrote to use https://github.com/alwynallan/DHT_nonblocking diff --git a/usermods/EleksTube_IPS/readme.md b/usermods/EleksTube_IPS/readme.md index 87827ac4..a05c9346 100644 --- a/usermods/EleksTube_IPS/readme.md +++ b/usermods/EleksTube_IPS/readme.md @@ -15,7 +15,7 @@ Not supported: - On-device setup with buttons (WiFi setup only) Your images must be 1-135 pixels wide and 1-240 pixels high. -For BMP, 1, 4, 8, and 24 bits per pixel formats are supported. +BMP 1, 4, 8, and 24 bits per pixel formats are supported. ## Installation @@ -26,11 +26,11 @@ Use LED pin 12, relay pin 27 and button pin 34. ## Use of RGB565 images -Binary 16-bit per pixel RGB565 format `.bin` and `.clk` images are now supported. This has the benefit of only using 2/3rds of the file size a 24 BPP `.bmp` has. -The drawback is that this format cannot be handled by common image programs and that an extra conversion step is needed. +Binary 16-bit per pixel RGB565 format `.bin` and `.clk` images are now supported. This has the benefit of using only 2/3rds of the file space a 24 BPP `.bmp` occupies. +The drawback is this format cannot be handled by common image programs and an extra conversion step is needed. You can use https://lvgl.io/tools/imageconverter to convert your .bmp to a .bin file (settings `True color` and `Binary RGB565`). Thank you to @RedNax67 for adding .bin and .clk support. -For most clockface designs, using 4 or 8 BPP BMP formats will save even more file size: +For most clockface designs, using 4 or 8 BPP BMP format will reduce file size even more: | Bits per pixel | File size in kB (for 135x240 img) | % of 24 BPP BMP | Max unique colors | --- | --- | --- | --- | @@ -42,4 +42,4 @@ For most clockface designs, using 4 or 8 BPP BMP formats will save even more fil Comparison 1 vs. 4 vs. 8 vs. 24 BPP. With this clockface on the actual clock, 4 bit looks good, and 8 bit is almost indistinguishable from 24 bit. -![comparison](https://user-images.githubusercontent.com/21045690/156899667-5b55ed9f-6e03-4066-b2aa-1260e9570369.png) \ No newline at end of file +![comparison](https://user-images.githubusercontent.com/21045690/156899667-5b55ed9f-6e03-4066-b2aa-1260e9570369.png) diff --git a/usermods/Enclosure_with_OLED_temp_ESP07/readme.md b/usermods/Enclosure_with_OLED_temp_ESP07/readme.md index 94d1c1f2..d612e06e 100644 --- a/usermods/Enclosure_with_OLED_temp_ESP07/readme.md +++ b/usermods/Enclosure_with_OLED_temp_ESP07/readme.md @@ -10,7 +10,7 @@ For BME280 sensor use usermod_bme280.cpp. Copy to wled00 and rename to usermod.c ## Features - SSD1306 128x32 and 128x64 I2C OLED display - On screen IP address, SSID and controller status (e.g. ON or OFF, recent effect) -- Auto display shutoff for saving display lifetime +- Auto display shutoff for extending display lifetime - Dallas temperature sensor - Reporting temperature to MQTT broker @@ -39,15 +39,15 @@ default_envs = esp07 ... lib_deps_external = ... - #For use SSD1306 OLED display uncomment following + #To use the SSD1306 OLED display, uncomment following U8g2@~2.27.3 - #For Dallas sensor uncomment following 2 lines + #For Dallas sensor, uncomment the following 2 lines DallasTemperature@~3.8.0 OneWire@~2.3.5 ... ``` -For BME280 sensor uncomment `U8g2@~2.27.3`,`BME280@~3.0.0 under` `[common]` section in `platformio.ini`: +For BME280 sensor, uncomment `U8g2@~2.27.3`,`BME280@~3.0.0 under` `[common]` section in `platformio.ini`: ```ini # platformio.ini ... @@ -60,7 +60,7 @@ default_envs = esp07 ... lib_deps_external = ... - #For use SSD1306 OLED display uncomment following + #To use the SSD1306 OLED display, uncomment following U8g2@~2.27.3 #For BME280 sensor uncomment following BME280@~3.0.0 diff --git a/usermods/Fix_unreachable_netservices_v2/readme.md b/usermods/Fix_unreachable_netservices_v2/readme.md index f7b721dd..24d5ff5a 100644 --- a/usermods/Fix_unreachable_netservices_v2/readme.md +++ b/usermods/Fix_unreachable_netservices_v2/readme.md @@ -2,15 +2,16 @@ **Attention: This usermod compiles only for ESP8266** -This usermod-v2 modification performs a ping request to the local IP address every 60 seconds. By this procedure the net services of WLED remains accessible in some problematic WLAN environments. +This usermod-v2 modification performs a ping request to a local IP address every 60 seconds. This ensures WLED net services remain accessible in some problematic WLAN environments. The modification works with static or DHCP IP address configuration. _Story:_ -Unfortunately, with all ESP projects where a web server or other network services are running, I have the problem that after some time the web server is no longer accessible. Now I found out that the connection is at least reestablished when a ping request is executed by the device. +Unfortunately, with many ESP projects where a web server or other network services are running, after some time, the connecton to the web server is lost. +The connection can be reestablished with a ping request from the device. -With this modification, in the worst case, the network functions are not available for 60 seconds until the next ping request. +With this modification, in the worst case, the network functions are not available until the next ping request. (60 seconds) ## Webinterface diff --git a/usermods/JSON_IR_remote/readme.md b/usermods/JSON_IR_remote/readme.md index 2cba06ed..43532a6f 100644 --- a/usermods/JSON_IR_remote/readme.md +++ b/usermods/JSON_IR_remote/readme.md @@ -2,8 +2,8 @@ ## Purpose -The JSON IR remote allows users to customize IR remote behavior without writing custom code and compiling. -It also enables using any remote that is compatible with your IR receiver. Using the JSON IR remote, you can +The JSON IR remote enables users to customize IR remote behavior without writing custom code and compiling. +It also allows using any remote compatible with your IR receiver. Using the JSON IR remote, you can map buttons from any remote to any HTTP request API or JSON API command. ## Usage diff --git a/usermods/PIR_sensor_switch/readme.md b/usermods/PIR_sensor_switch/readme.md index b023cea5..574bd06d 100644 --- a/usermods/PIR_sensor_switch/readme.md +++ b/usermods/PIR_sensor_switch/readme.md @@ -7,34 +7,35 @@ _Story:_ I use the PIR Sensor to automatically turn on the WLED analog clock in my home office room when I am there. The LED strip is switched [using a relay](https://github.com/Aircoookie/WLED/wiki/Control-a-relay-with-WLED) to keep the power consumption low when it is switched off. -## Webinterface +## Web interface The info page in the web interface shows the remaining time of the off timer. Usermod can also be temporarily disbled/enabled from the info page by clicking PIR button. ## Sensor connection -My setup uses an HC-SR501 or HC-SR602 sensor, a HC-SR505 should also work. +My setup uses an HC-SR501 or HC-SR602 sensor, an HC-SR505 should also work. -The usermod uses GPIO13 (D1 mini pin D7) by default for the sensor signal but can be changed in the Usermod settings page. +The usermod uses GPIO13 (D1 mini pin D7) by default for the sensor signal, but can be changed in the Usermod settings page. [This example page](http://www.esp8266learning.com/wemos-mini-pir-sensor-example.php) describes how to connect the sensor. -Use the potentiometers on the sensor to set the time-delay to the minimum and the sensitivity to about half, or slightly above. +Use the potentiometers on the sensor to set the time delay to the minimum and the sensitivity to about half, or slightly above. You can also use usermod's off timer instead of sensor's. In such case rotate the potentiometer to its shortest time possible (or use SR602 which lacks such potentiometer). ## Usermod installation -**NOTE:** Usermod has been included in master branch of WLED so it can be compiled in directly just by defining `-D USERMOD_PIRSWITCH` and optionaly `-D PIR_SENSOR_PIN=16` to override default pin. You can also change the default off tim by adding `-D PIR_SENSOR_OFF_SEC=30`. +**NOTE:** Usermod has been included in master branch of WLED so it can be compiled in directly just by defining `-D USERMOD_PIRSWITCH` and optionaly `-D PIR_SENSOR_PIN=16` to override default pin. You can also change the default off time by adding `-D PIR_SENSOR_OFF_SEC=30`. -## API to enable/disable the PIR sensor from outside. For example from another usermod. +## API to enable/disable the PIR sensor from outside. For example from another usermod: To query or change the PIR sensor state the methods `bool PIRsensorEnabled()` and `void EnablePIRsensor(bool enable)` are available. When the PIR sensor state changes an MQTT message is broadcasted with topic `wled/deviceMAC/motion` and message `on` or `off`. -Usermod can also be configured to just send MQTT message and not change WLED state using settings page as well as responding to motion only during nighttime (assuming NTP and lattitude/longitude are set to determine sunrise/sunset times). +Usermod can also be configured to send just the MQTT message but not change WLED state using settings page as well as responding to motion only at night +(assuming NTP and lattitude/longitude are set to determine sunrise/sunset times). ### There are two options to get access to the usermod instance: -1. Include `usermod_PIR_sensor_switch.h` **before** you include the other usermod in `usermods_list.cpp' +1. Include `usermod_PIR_sensor_switch.h` **before** you include other usermods in `usermods_list.cpp' or @@ -63,7 +64,7 @@ class MyUsermod : public Usermod { ### Configuration options -Usermod can be configured in Usermods settings page. +Usermod can be configured via the Usermods settings page. * `PIRenabled` - enable/disable usermod * `pin` - dynamically change GPIO pin where PIR sensor is attached to ESP @@ -71,8 +72,8 @@ Usermod can be configured in Usermods settings page. * `on-preset` - preset triggered when PIR activates (if this is 0 it will just turn WLED on) * `off-preset` - preset triggered when PIR deactivates (if this is 0 it will just turn WLED off) * `nighttime-only` - enable triggering only between sunset and sunrise (you will need to set up _NTP_, _Lat_ & _Lon_ in Time & Macro settings) -* `mqtt-only` - only send MQTT messages, do not interact with WLED -* `off-only` - only trigger presets or turn WLED on/off in WLED is not already on (displaying effect) +* `mqtt-only` - send only MQTT messages, do not interact with WLED +* `off-only` - only trigger presets or turn WLED on/off if WLED is not already on (displaying effect) * `notifications` - enable or disable sending notifications to other WLED instances using Sync button @@ -89,4 +90,4 @@ Have fun - @gegu & @blazoncek 2022-11 * Added compile time option for off timer. * Added Home Assistant autodiscovery MQTT broadcast. -* Updated info on compiling. \ No newline at end of file +* Updated info on compiling. diff --git a/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h b/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h index b03a36ce..f716e48e 100644 --- a/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h +++ b/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h @@ -235,7 +235,7 @@ private: if (offTimerStart > 0 && millis() - offTimerStart > m_switchOffDelay) { offTimerStart = 0; if (enabled == true) { - if (!m_mqttOnly && (!m_nightTimeOnly || (m_nightTimeOnly && !isDayTime()))) switchStrip(false); + if (!m_mqttOnly && (!m_nightTimeOnly || (m_nightTimeOnly && !isDayTime()) || PIRtriggered)) switchStrip(false); else if (NotifyUpdateMode != CALL_MODE_NO_NOTIFY) updateInterfaces(CALL_MODE_WS_SEND); publishMqtt("off"); } diff --git a/usermods/PWM_fan/readme.md b/usermods/PWM_fan/readme.md index 8cd04a91..1fbfe0e6 100644 --- a/usermods/PWM_fan/readme.md +++ b/usermods/PWM_fan/readme.md @@ -2,12 +2,12 @@ v2 Usermod to to control PWM fan with RPM feedback and temperature control -This usermod requires Dallas Temperature usermod to obtain temperature information. If this is not available the fan will always run at 100% speed. -If the fan does not have _tacho_ (RPM) output you can set the _tacho-pin_ to -1 to not use that feature. +This usermod requires the Dallas Temperature usermod to obtain temperature information. If it's not available, the fan will run at 100% speed. +If the fan does not have _tachometer_ (RPM) output you can set the _tachometer-pin_ to -1 to disable that feature. -You can also set the thershold temperature at which fan runs at lowest speed. If the actual temperature measured will be 3°C greater than threshold temperature the fan will run at 100%. +You can also set the thershold temperature at which fan runs at lowest speed. If the measured temperature is 3°C greater than the threshold temperature, the fan will run at 100%. -If the _tacho_ is supported the current speed (in RPM) will be repored in WLED Info page. +If the _tachometer_ is supported, the current speed (in RPM) will be displayed on the WLED Info page. ## Installation @@ -20,7 +20,7 @@ All of the parameters are configured during run-time using Usermods settings pag This includes: * PWM output pin (can be configured at compile time `-D PWM_PIN=xx`) -* tacho input pin (can be configured at compile time `-D TACHO_PIN=xx`) +* tachometer input pin (can be configured at compile time `-D TACHO_PIN=xx`) * sampling frequency in seconds * threshold temperature in degees C @@ -32,14 +32,14 @@ No special requirements. ## Control PWM fan speed using JSON API -You can use e.g. `{"PWM-fan":{"speed":30,"lock":true}}` to set fan speed to 30 percent of maximum speed (replace 30 with arbitrary value between 0 and 100) and lock the speed. -If you include `speed` property you can set fan speed in percent (%) of maximum speed. -If you include `lock` property you can lock (_true_) or unlock (_false_) fan speed. -If the fan speed is unlocked it will revert to temperature controlled speed on next update cycle. Once fan speed is locked it will remain so until it is unlocked by next API call. +e.g. you can use `{"PWM-fan":{"speed":30,"lock":true}}` to lock fan speed to 30 percent of maximum. (replace 30 with an arbitrary value between 0 and 100) +If you include `speed` property you can set fan speed as a percentage (%) of maximum speed. +If you include `lock` property you can lock (_true_) or unlock (_false_) the fan speed. +If the fan speed is unlocked, it will revert to temperature controlled speed on the next update cycle. Once fan speed is locked it will remain so until it is unlocked by the next API call. ## Change Log 2021-10 * First public release 2022-05 -* Added JSON API call to allow changing of speed \ No newline at end of file +* Added JSON API call to allow changing of speed diff --git a/usermods/RTC/readme.md b/usermods/RTC/readme.md index 3aaa6091..0add4efc 100644 --- a/usermods/RTC/readme.md +++ b/usermods/RTC/readme.md @@ -1,6 +1,6 @@ # DS1307/DS3231 Real time clock -Gets the time from I2C RTC module on boot. This allows clocks to operate e.g. if temporarily no WiFi is available. +Gets the time from I2C RTC module on boot. This allows clock operation if WiFi is not available. The stored time is updated each time NTP is synced. ## Installation diff --git a/usermods/RelayBlinds/readme.md b/usermods/RelayBlinds/readme.md index 0c3d2a0b..8c533dd4 100644 --- a/usermods/RelayBlinds/readme.md +++ b/usermods/RelayBlinds/readme.md @@ -1,8 +1,8 @@ # RelayBlinds usermod -This simple usermod toggles two relay pins momentarily (default for 500ms) when `userVar0` is set. -This can be used to e.g. "push" the buttons of a window blinds motor controller. +This simple usermod toggles two relay pins momentarily (defaults to 500ms) when `userVar0` is set. +e.g. can be used to "push" the buttons of a window blinds motor controller. v1 usermod. Please replace usermod.cpp in the `wled00` directory with the one in this file. You may upload `index.htm` to `[WLED-IP]/edit` to replace the default lighting UI with a simple Up/Down button one. -Also, a simple `presets.json` file is available, this makes the relay actions controllable via two presets to facilitate control e.g. via the default UI or Alexa. \ No newline at end of file +A simple `presets.json` file is available. This makes the relay actions controllable via two presets to facilitate control e.g. the default UI or Alexa. diff --git a/usermods/SN_Photoresistor/readme.md b/usermods/SN_Photoresistor/readme.md index 4f3a36fb..feacf41a 100644 --- a/usermods/SN_Photoresistor/readme.md +++ b/usermods/SN_Photoresistor/readme.md @@ -1,7 +1,7 @@ # SN_Photoresistor usermod -This usermod will read from an attached photoresistor sensor like the KY-018 sensor. -The luminance is displayed both in the Info section of the web UI as well as published to the `/luminance` MQTT topic if enabled. +This usermod will read from an attached photoresistor sensor like the KY-018. +The luminance is displayed in both the Info section of the web UI as well as published to the `/luminance` MQTT topic, if enabled. ## Installation @@ -9,15 +9,15 @@ Copy the example `platformio_override.ini` to the root directory. This file sho ### Define Your Options -* `USERMOD_SN_PHOTORESISTOR` - define this to have this user mod included wled00\usermods_list.cpp -* `USERMOD_SN_PHOTORESISTOR_MEASUREMENT_INTERVAL` - the number of milliseconds between measurements, defaults to 60 seconds -* `USERMOD_SN_PHOTORESISTOR_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 20 seconds -* `USERMOD_SN_PHOTORESISTOR_REFERENCE_VOLTAGE` - the voltage supplied to the sensor, defaults to 5v -* `USERMOD_SN_PHOTORESISTOR_ADC_PRECISION` - the ADC precision is the number of distinguishable ADC inputs, defaults to 1024.0 (10 bits) -* `USERMOD_SN_PHOTORESISTOR_RESISTOR_VALUE` - the resistor size, defaults to 10000.0 (10K hms) -* `USERMOD_SN_PHOTORESISTOR_OFFSET_VALUE` - the offset value to report on, defaults to 25 +* `USERMOD_SN_PHOTORESISTOR` - Enables this user mod. wled00\usermods_list.cpp +* `USERMOD_SN_PHOTORESISTOR_MEASUREMENT_INTERVAL` - Number of milliseconds between measurements. Defaults to 60000 ms +* `USERMOD_SN_PHOTORESISTOR_FIRST_MEASUREMENT_AT` - Number of milliseconds after boot to take first measurement. Defaults to 20000 ms +* `USERMOD_SN_PHOTORESISTOR_REFERENCE_VOLTAGE` - Voltage supplied to the sensor. Defaults to 5v +* `USERMOD_SN_PHOTORESISTOR_ADC_PRECISION` - ADC precision. Defaults to 10 bits +* `USERMOD_SN_PHOTORESISTOR_RESISTOR_VALUE` - Resistor size, defaults to 10000.0 (10K Ohms) +* `USERMOD_SN_PHOTORESISTOR_OFFSET_VALUE` - Offset value to report on. Defaults to 25 -All parameters can be configured at runtime using Usermods settings page. +All parameters can be configured at runtime via the Usermods settings page. ## Project link diff --git a/usermods/ST7789_display/README.md b/usermods/ST7789_display/README.md index 93092186..ebaae492 100644 --- a/usermods/ST7789_display/README.md +++ b/usermods/ST7789_display/README.md @@ -1,15 +1,15 @@ -# ST7789 TFT IPS Color display 240x240pxwith ESP32 boards +# Using the ST7789 TFT IPS 240x240 pixel color display with ESP32 boards -This usermod allow to use 240x240 display to display following: +This usermod enables display of the following: -* current date and time; +* Current date and time; * Network SSID; * IP address; * WiFi signal strength; * Brightness; -* Chosen effect; -* Chosen palette; -* effect speed and intensity; +* Selected effect; +* Selected palette; +* Effect speed and intensity; * Estimated current in mA; ## Hardware @@ -41,9 +41,9 @@ lib_deps = ... ``` -Also, while in the `platformio.ini` file, you must change the environment setup to build for just the esp32dev platform as follows: +In the `platformio.ini` file, you must change the environment setup to build for just the esp32dev platform as follows: -Add lines to section: +Add the following lines to section: ```ini default_envs = esp32dev @@ -64,14 +64,14 @@ build_flags = ${common.build_flags_esp32} ;-DCONFIG_SPIRAM_SUPPORT=1 ``` -Save the `platformio.ini` file. Once this is saved, the required library files should be automatically downloaded for modifications in a later step. +Save the `platformio.ini` file. Once saved, the required library files should be automatically downloaded for modifications in a later step. ### TFT_eSPI Library Adjustments -If you are not using PlatformIO you need to modify a file in the `TFT_eSPI` library. If you followed the directions to modify and save the `platformio.ini` file above, the `Setup24_ST7789.h` file can be found in the `/.pio/libdeps/esp32dev/TFT_eSPI/User_Setups/` folder. +If you are not using PlatformIO, you need to modify a file in the `TFT_eSPI` library. If you followed the directions to modify and save the `platformio.ini` file above, the `Setup24_ST7789.h` file can be found in the `/.pio/libdeps/esp32dev/TFT_eSPI/User_Setups/` folder. -Edit `Setup_ST7789.h` file and uncomment nad changep GPIO pin numbers in lines containing `TFT_MOSI`, `TFT_SCLK`, `TFT_RST`, `TFT_DC`. +Edit `Setup_ST7789.h` file and uncomment and change GPIO pin numbers in lines containing `TFT_MOSI`, `TFT_SCLK`, `TFT_RST`, `TFT_DC`. -Modify the `User_Setup_Select.h` by uncommentig the line containing `#include ` and commenting out line containing `#include `. +Modify the `User_Setup_Select.h` by uncommenting the line containing `#include ` and commenting out the line containing `#include `. -If your display includes backlight enable pin, #define TFT_BL with backlight enable GPIO number. \ No newline at end of file +If your display uses the backlight enable pin, add this definition: #define TFT_BL with backlight enable GPIO number. diff --git a/usermods/Si7021_MQTT_HA/readme.md b/usermods/Si7021_MQTT_HA/readme.md index d9a96f7a..99a240f7 100644 --- a/usermods/Si7021_MQTT_HA/readme.md +++ b/usermods/Si7021_MQTT_HA/readme.md @@ -2,14 +2,14 @@ This usermod implements support for [Si7021 I²C temperature and humidity sensors](https://www.silabs.com/documents/public/data-sheets/Si7021-A20.pdf). -The sensor data will *not* be shown on the WLED UI (so far) but published via MQTT to WLED's "build in" MQTT device topic. +As of this writing, the sensor data will *not* be shown on the WLED UI, but it _is_ published via MQTT to WLED's "built-in" MQTT device topic. ``` temperature: $mqttDeviceTopic/si7021_temperature humidity: $mqttDeviceTopic/si7021_humidity ``` -Additionally the following sensors can be published: +The following sensors can also be published: ``` heat_index: $mqttDeviceTopic/si7021_heat_index @@ -17,7 +17,7 @@ dew_point: $mqttDeviceTopic/si7021_dew_point absolute_humidity: $mqttDeviceTopic/si7021_absolute_humidity ``` -Sensor data will be updated/send every 60 seconds. +Sensor data will be updated/sent every 60 seconds. This usermod also supports Home Assistant Auto Discovery. @@ -66,4 +66,4 @@ Add to `lib_deps` in platformio.ini: - Aircoookie for making WLED - Other usermod creators for example code (`sensors_to_mqtt` and `multi_relay` especially) -- You, for reading this \ No newline at end of file +- You, for reading this diff --git a/usermods/TTGO-T-Display/README.md b/usermods/TTGO-T-Display/README.md index 872beeb8..439f9832 100644 --- a/usermods/TTGO-T-Display/README.md +++ b/usermods/TTGO-T-Display/README.md @@ -1,19 +1,19 @@ # TTGO T-Display ESP32 with 240x135 TFT via SPI with TFT_eSPI -This usermod allows use of the TTGO T-Display ESP32 module with integrated 240x135 display +This usermod enables use of the TTGO 240x135 T-Display ESP32 module for controlling WLED and showing the following information: * Current SSID -* IP address if obtained - * If connected to a network, current brightness % is shown - * in AP mode AP IP and password are shown +* IP address, if obtained + * If connected to a network, current brightness percentage is shown + * In AP mode, AP, IP and password are shown * Current effect * Current palette -* Estimated current in mA is shown (NOTE: for this to be a reasonable value, the correct LED type must be specified in the LED Prefs section) +* Estimated current in mA (NOTE: for this to be a reasonable value, the correct LED type must be specified in the LED Prefs section) -Button pin is mapped to the onboard button next to the side actuated reset button of the TTGO T-Display board. +Button pin is mapped to the onboard button adjacent to the reset button of the TTGO T-Display board. -I have designed a 3D printed case around this board and an ["ElectroCookie"](https://amzn.to/2WCNeeA) project board, a [level shifter](https://amzn.to/3hbKu18), a [buck regulator](https://amzn.to/3mLMy0W), and a DC [power jack](https://amzn.to/3phj9NZ). I use 12V WS2815 LED strips for my projects, and power them with 12V power supplies, so the regulator drops the voltage to the 5V level I need to power the ESP module and the level shifter. If there is any interest in this case, which elevates the board and display on some custom extended headers to make place the screen at the top of the enclosure (with accessible buttons), let me know, and I could post the STL files. It is a bit tricky to get the height correct, so I also designed a one-time use 3D printed solder fixture to set the board in the right location and at the correct height for the housing. (It is one-time use because it has to be cut off after soldering to be able to remove it). I didn't think the effort to make it in multiple pieces was worthwhile. +I have designed a 3D printed case around this board and an ["ElectroCookie"](https://amzn.to/2WCNeeA) project board, a [level shifter](https://amzn.to/3hbKu18), a [buck regulator](https://amzn.to/3mLMy0W), and a DC [power jack](https://amzn.to/3phj9NZ). I use 12V WS2815 LED strips for my projects, and power them with 12V power supplies. The regulator supplies 5V for the ESP module and the level shifter. If there is any interest in this case which elevates the board and display on custom extended standoffs to place the screen at the top of the enclosure (with accessible buttons), let me know, and I will post the STL files. It is a bit tricky to get the height correct, so I also designed a one-time use 3D printed solder fixture to set the board in the right location and at the correct height for the housing. (It is one-time use because it has to be cut off after soldering to be able to remove it). I didn't think the effort to make it in multiple pieces was worthwhile. -Usermod based on a rework of the ssd1306_i2c_oled_u8g2 usermod from the WLED repo. +Based on a rework of the ssd1306_i2c_oled_u8g2 usermod from the WLED repo. ## Hardware ![Hardware](assets/ttgo_hardware1.png) @@ -30,8 +30,8 @@ Usermod based on a rework of the ssd1306_i2c_oled_u8g2 usermod from the WLED rep Functionality checked with: * TTGO T-Display * PlatformIO -* Group of 4 individual Neopixels from Adafruit, and a several full strings of 12v WS2815 LEDs. -* The hardware design shown above should be limited to shorter strings. For larger strings, I use a different setup with a dedicated 12v power supply and power them directly off the supply (in addition to dropping the 12v supply down to 5v with a buck regulator for the ESP module and level shifter). +* Group of 4 individual Neopixels from Adafruit and several full strings of 12v WS2815 LEDs. +* The hardware design shown above should be limited to shorter strings. For larger strings, I use a different setup with a dedicated 12v power supply and power them directly from said supply (in addition to dropping the 12v to 5v with a buck regulator for the ESP module and level shifter). ## Setup Needed: * As with all usermods, copy the usermod.cpp file from the TTGO-T-Display usermod folder to the wled00 folder (replacing the default usermod.cpp file). @@ -51,24 +51,24 @@ lib_deps = ... ``` -Also, while in the `platformio.ini` file, you must change the environment setup to build for just the esp32dev platform as follows: +In the `platformio.ini` file, you must change the environment setup to build for just the esp32dev platform as follows: Comment out the line described below: ```ini -# Travis CI binaries (comment this out when building for single board) -; default_envs = travis_esp8266, esp01, esp01_1m_ota, travis_esp32 +# Release binaries +; default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, esp32s2_saola, esp32c3 ``` -and UNCOMMENT the following line in the 'Single binaries' section: +and uncomment the following line in the 'Single binaries' section: ```ini default_envs = esp32dev ``` -Save the `platformio.ini` file. Once this is saved, the required library files should be automatically downloaded for modifications in a later step. +Save the `platformio.ini` file. Once saved, the required library files should be automatically downloaded for modifications in a later step. ### Platformio_overrides.ini (added) Copy the `platformio_overrides.ini` file which is contained in the `usermods/TTGO-T-Display/` folder into the root of your project folder. This file contains an override that remaps the button pin of WLED to use the on-board button to the right of the USB-C connector (when viewed with the port oriented downward - see hardware photo). ### TFT_eSPI Library Adjustments (board selection) -We need to modify a file in the `TFT_eSPI` library to select the correct board. If you followed the directions to modify and save the `platformio.ini` file above, the `User_Setup_Select.h` file can be found in the `/.pio/libdeps/esp32dev/TFT_eSPI_ID1559` folder. +You need to modify a file in the `TFT_eSPI` library to select the correct board. If you followed the directions to modify and save the `platformio.ini` file above, the `User_Setup_Select.h` file can be found in the `/.pio/libdeps/esp32dev/TFT_eSPI_ID1559` folder. Modify the `User_Setup_Select.h` file as follows: * Comment out the following line (which is the 'default' setup file): @@ -80,12 +80,12 @@ Modify the `User_Setup_Select.h` file as follows: #include // Setup file for ESP32 and TTGO T-Display ST7789V SPI bus TFT ``` -Run the build and it should complete correctly. If you see a failure like this: +Build the file. If you see a failure like this: ```ini xtensa-esp32-elf-g++: error: wled00\wled00.ino.cpp: No such file or directory xtensa-esp32-elf-g++: fatal error: no input files ``` -Just try building again - I find that sometimes this happens on the first build attempt and subsequent attempts will build correctly. +try building again. Sometimes this happens on the first build attempt and subsequent attempts build correctly. ## Arduino IDE -- UNTESTED \ No newline at end of file +- UNTESTED diff --git a/usermods/Temperature/readme.md b/usermods/Temperature/readme.md index ac2823c3..1515d000 100644 --- a/usermods/Temperature/readme.md +++ b/usermods/Temperature/readme.md @@ -1,9 +1,9 @@ # Temperature usermod -Based on the excellent `QuinLED_Dig_Uno_Temp_MQTT` by srg74 and 400killer! -This usermod will read from an attached DS18B20 temperature sensor (as available on the QuinLED Dig-Uno) -The temperature is displayed both in the Info section of the web UI as well as published to the `/temperature` MQTT topic if enabled. -This usermod may be expanded with support for different sensor types in the future. +Based on the excellent `QuinLED_Dig_Uno_Temp_MQTT` usermod by srg74 and 400killer! +Reads an attached DS18B20 temperature sensor (as available on the QuinLED Dig-Uno) +Temperature is displayed in both the Info section of the web UI as well as published to the `/temperature` MQTT topic, if enabled. +May be expanded with support for different sensor types in the future. If temperature sensor is not detected during boot, this usermod will be disabled. @@ -13,10 +13,10 @@ Copy the example `platformio_override.ini` to the root directory. This file sho ### Define Your Options -* `USERMOD_DALLASTEMPERATURE` - define this to have this user mod included wled00\usermods_list.cpp -* `USERMOD_DALLASTEMPERATURE_FIRST_MEASUREMENT_AT` - the number of milliseconds after boot to take first measurement, defaults to 20 seconds +* `USERMOD_DALLASTEMPERATURE` - enables this user mod wled00/usermods_list.cpp +* `USERMOD_DALLASTEMPERATURE_FIRST_MEASUREMENT_AT` - umber of milliseconds after boot to take first measurement, defaults to 20000 ms -All parameters can be configured at runtime using Usermods settings page, including pin, selection to display temerature in degrees Celsius or Farenheit mand measurement interval. +All parameters can be configured at runtime via the Usermods settings page, including pin, temperature in degrees Celsius or Farenheit and measurement interval. ## Project link @@ -50,9 +50,9 @@ lib_deps = ## Change Log 2020-09-12 -* Changed to use async, non-blocking implementation -* Do not report low temperatures that indicate an error to mqtt +* Changed to use async non-blocking implementation +* Do not report erroneous low temperatures to MQTT * Disable plugin if temperature sensor not detected * Report the number of seconds until the first read in the info screen instead of sensor error 2021-04 -* Adaptation for runtime configuration. \ No newline at end of file +* Adaptation for runtime configuration. diff --git a/usermods/VL53L0X_gestures/readme.md b/usermods/VL53L0X_gestures/readme.md index 74c970dc..a230b1a6 100644 --- a/usermods/VL53L0X_gestures/readme.md +++ b/usermods/VL53L0X_gestures/readme.md @@ -1,10 +1,10 @@ # Description -That usermod implements support of simple hand gestures with VL53L0X sensor: on/off and brightness correction. -It can be useful for kitchen strips to avoid any touches. - - on/off - just swipe a hand below your sensor ("shortPressAction" is called and can be customized through WLED macros) - - brightness correction - keep your hand below sensor for 1 second to switch to "brightness" mode. - Configure brightness by changing distance to the sensor (see parameters below for customization). +Implements support of simple hand gestures via a VL53L0X sensor: on/off and brightness adjustment. +Useful for controlling strips when you want to avoid touching anything. + - on/off - swipe your hand below the sensor ("shortPressAction" is called. Can be customized via WLED macros) + - brightness adjustment - hold your hand below the sensor for 1 second to switch to "brightness" mode. + adjust the brightness by changing the distance between your hand and the sensor (see parameters below for customization). ## Installation @@ -26,4 +26,4 @@ default_envs = nodemcuv2 build_flags = ${env.build_flags} -D USERMOD_VL53L0X_GESTURES lib_deps = ${env.lib_deps} pololu/VL53L0X @ ^1.3.0 -``` \ No newline at end of file +``` diff --git a/usermods/Wemos_D1_mini+Wemos32_mini_shield/readme.md b/usermods/Wemos_D1_mini+Wemos32_mini_shield/readme.md index eebc50da..105f2a24 100644 --- a/usermods/Wemos_D1_mini+Wemos32_mini_shield/readme.md +++ b/usermods/Wemos_D1_mini+Wemos32_mini_shield/readme.md @@ -9,10 +9,10 @@ ## Features - SSD1306 128x32 or 128x64 I2C OLED display - On screen IP address, SSID and controller status (e.g. ON or OFF, recent effect) -- Auto display shutoff for saving display lifetime +- Auto display shutoff for extending display lifetime - Dallas temperature sensor - Reporting temperature to MQTT broker -- Relay for energy saving +- Relay for saving energy ## Hardware ![Shield](https://github.com/srg74/WLED-wemos-shield/blob/master/resources/Images/Assembly_8.jpg) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 9d833715..09cc931c 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -1776,16 +1776,16 @@ class AudioReactive : public Usermod { oappend(SET_F("addOption(dd,'Send',1);")); oappend(SET_F("addOption(dd,'Receive',2);")); oappend(SET_F("addInfo('AudioReactive:digitalmic:type',1,'requires reboot!');")); // 0 is field type, 1 is actual field - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',0,'I2S Serial Data', 'sd/data/dout');")); - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',1,'I2S L/R Clock','ws/clk/lrck');")); - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',2,'I2S Serial Clock','sck/bclk');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',0,'sd/data/dout','I2S SD');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',1,'ws/clk/lrck','I2S WS');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',2,'sck/bclk','I2S SCK');")); #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'I2S Master CLK','only use -1, 0, 1 or 3');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'only use -1, 0, 1 or 3','I2S MCLK');")); #else - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'', 'I2S Master CLK');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'master clock','I2S MCLK');")); #endif - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',4,'', 'I2C SDA');")); - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',5,'', 'I2C SCL');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',4,'','I2C SDA');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',5,'','I2C SCL');")); } diff --git a/usermods/audioreactive/readme.md b/usermods/audioreactive/readme.md index f11e219e..d9f9ea78 100644 --- a/usermods/audioreactive/readme.md +++ b/usermods/audioreactive/readme.md @@ -1,11 +1,11 @@ # Audioreactive usermod -This usermod allows controlling LEDs using audio input. Audio input can be either microphone or analog-in (AUX) using appropriate adapter. -Supported microphones range from cheap analog (MAX4466, MAX9814, ...) to high quality digital (INMP441, ICS-43434, ...) and dgital Line-In. +Enabless controlling LEDs via audio input. Audio source can be a microphone or analog-in (AUX) using an appropriate adapter. +Supported microphones range from analog (MAX4466, MAX9814, ...) to digital (INMP441, ICS-43434, ...). -The usermod does audio processing and provides data structure that specially written effect can use. +Does audio processing and provides data structure that specially written effects can use. -The usermod **does not** provide effects or draws anything to LED strip/matrix. +**does not** provide effects or draw anything to an LED strip/matrix. ## Additional Documentation This usermod is an evolution of [SR-WLED](https://github.com/atuline/WLED), and a lot of documentation and information can be found in the [SR-WLED wiki](https://github.com/atuline/WLED/wiki): @@ -42,9 +42,9 @@ ArduinoFFT `develop` library is slightly more accurate, and slighly faster than ## Configuration -All parameters are runtime configurable though some may require hard boot after change (I2S microphone or selected GPIOs). +All parameters are runtime configurable. Some may require a hard reset after changing them (I2S microphone or selected GPIOs). -If you want to define default GPIOs during compile time use the following addtional build_flags (default values in parentheses): +If you want to define default GPIOs during compile time, use the following (default values in parentheses): - `-D SR_DMTYPE=x` : defines digital microphone type: 0=analog, 1=generic I2S (default), 2=ES7243 I2S, 3=SPH0645 I2S, 4=generic I2S with master clock, 5=PDM I2S - `-D AUDIOPIN=x` : GPIO for analog microphone/AUX-in (36) @@ -55,7 +55,7 @@ If you want to define default GPIOs during compile time use the following addtio - `-D ES7243_SDAPIN` : GPIO for I2C SDA pin on ES7243 microphone (-1) - `-D ES7243_SCLPIN` : GPIO for I2C SCL pin on ES7243 microphone (-1) -**NOTE** Due to the fact that usermod uses I2S peripherial for analog audio sampling, use of analog *buttons* (i.e. potentiometers) is disabled while running this usermod with analog microphone. +**NOTE** I2S is used for analog audio sampling. Hence, the analog *buttons* (i.e. potentiometers) are disabled when running this usermod with an analog microphone. ### Advanced Compile-Time Options You can use the following additional flags in your `build_flags` diff --git a/usermods/battery_status_basic/readme.md b/usermods/battery_status_basic/readme.md index 276b23c1..bada8d5f 100644 --- a/usermods/battery_status_basic/readme.md +++ b/usermods/battery_status_basic/readme.md @@ -1,12 +1,11 @@ # :battery: Battery status/level Usermod :battery: - -This Usermod allows you to monitor the battery level of your battery powered project. +Enables battery level monitoring of your project. You can see the battery level and voltage in the `info modal`. -For this to work the positive side of the (18650) battery must be connected to pin `A0` of the d1mini/esp8266 with a 100k ohm resistor (see [Useful Links](#useful-links)). +For this to work, the positive side of the (18650) battery must be connected to pin `A0` of the d1 mini/esp8266 with a 100k Ohm resistor (see [Useful Links](#useful-links)). -If you have a esp32 board it is best to connect the positive side of the battery to ADC1 (GPIO32 - GPIO39) +If you have an ESP32 board, connect the positive side of the battery to ADC1 (GPIO32 - GPIO39)

@@ -23,16 +22,16 @@ define `USERMOD_BATTERY_STATUS_BASIC` in `my_config.h` ### Define Your Options -* `USERMOD_BATTERY_STATUS_BASIC` - define this (in `my_config.h`) to have this user mod included wled00\usermods_list.cpp -* `USERMOD_BATTERY_MEASUREMENT_PIN` - defaults to A0 on esp8266 and GPIO32 on esp32 -* `USERMOD_BATTERY_MEASUREMENT_INTERVAL` - the frequency to check the battery, defaults to 30 seconds -* `USERMOD_BATTERY_MIN_VOLTAGE` - minimum voltage of the Battery used, default is 2.6 (18650 battery standard) -* `USERMOD_BATTERY_MAX_VOLTAGE` - maximum voltage of the Battery used, default is 4.2 (18650 battery standard) +* `USERMOD_BATTERY_STATUS_BASIC` - define this (in `my_config.h`) to have this usermod included wled00\usermods_list.cpp +* `USERMOD_BATTERY_MEASUREMENT_PIN` - defaults to A0 on ESP8266 and GPIO32 on ESP32 +* `USERMOD_BATTERY_MEASUREMENT_INTERVAL` - battery check interval. defaults to 30 seconds +* `USERMOD_BATTERY_MIN_VOLTAGE` - minimum battery voltage. default is 2.6 (18650 battery standard) +* `USERMOD_BATTERY_MAX_VOLTAGE` - maximum battery voltage. default is 4.2 (18650 battery standard) -All parameters can be configured at runtime using Usermods settings page. +All parameters can be configured at runtime via the Usermods settings page. ## Important :warning: -* Make sure you know your battery specification ! not every battery is the same ! +* Make sure you know your battery specifications! All batteries are **NOT** the same! * Example: | Your battery specification table | | Options you can define | diff --git a/usermods/blynk_relay_control/README.md b/usermods/blynk_relay_control/README.md index b6494b46..f4832c08 100644 --- a/usermods/blynk_relay_control/README.md +++ b/usermods/blynk_relay_control/README.md @@ -1,11 +1,11 @@ # Blynk controllable relay -This usermod allows controlling a relay state from the user variables. It also allows the user variables to be set over Blynk. +Enables controlling a relay state via user variables. Allows the user variables to be set via Blynk. -Optionally, the servo can have a reset timer to go back to it's default state after an interval. This interval is set through userVar1. +Optionally, the servo can have a reset timer to return to its default state after a user definable interval. The interval is set via userVar1. ## Instalation -Replace the WLED06_usermod.ino file in Aircoookies WLED folder with the one here. +Replace the WLED06_usermod.ino file in Aircoookies WLED folder, with the one here. ## Customizations @@ -16,13 +16,13 @@ Update the following parameters in WLED06_usermod.ino to configure the mod's beh #define RELAY_PIN 5 //Which pin state should the relay default to #define RELAY_PIN_DEFAULT LOW -//If >0 The controller returns to RELAY_PIN_DEFAULT after this time in milliseconds +//If >0 The controller returns to RELAY_PIN_DEFAULT after this time, in milliseconds #define RELAY_PIN_TIMER_DEFAULT 3000 //Blynk virtual pin for controlling relay #define BLYNK_USER_VAR0_PIN V9 //Blynk virtual pin for controlling relay timer #define BLYNK_USER_VAR1_PIN V10 -//Number of milliseconds between updating blynk +//Number of milliseconds between Blynk updates #define BLYNK_RELAY_UPDATE_INTERVAL 5000 ``` diff --git a/usermods/boblight/boblight.h b/usermods/boblight/boblight.h new file mode 100644 index 00000000..263d8743 --- /dev/null +++ b/usermods/boblight/boblight.h @@ -0,0 +1,457 @@ +#pragma once + +#include "wled.h" + +/* + * Usermod that implements BobLight "ambilight" protocol + * + * See the accompanying README.md file for more info. + */ + +#ifndef BOB_PORT + #define BOB_PORT 19333 // Default boblightd port +#endif + +class BobLightUsermod : public Usermod { + typedef struct _LIGHT { + char lightname[5]; + float hscan[2]; + float vscan[2]; + } light_t; + + private: + unsigned long lastTime = 0; + bool enabled = false; + bool initDone = false; + + light_t *lights = nullptr; + uint16_t numLights = 0; // 16 + 9 + 16 + 9 + uint16_t top, bottom, left, right; // will be filled in readFromConfig() + uint16_t pct; + + WiFiClient bobClient; + WiFiServer *bob; + uint16_t bobPort = BOB_PORT; + + static const char _name[]; + static const char _enabled[]; + + /* + # boblight + # Copyright (C) Bob 2009 + # + # makeboblight.sh created by Adam Boeglin + # + # boblight is free software: you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by the + # Free Software Foundation, either version 3 of the License, or + # (at your option) any later version. + # + # boblight is distributed in the hope that it will be useful, but + # WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + # See the GNU General Public License for more details. + # + # You should have received a copy of the GNU General Public License along + # with this program. If not, see . + */ + + // fills the lights[] array with position & depth of scan for each LED + void fillBobLights(int bottom, int left, int top, int right, float pct_scan) { + + int lightcount = 0; + int total = top+left+right+bottom; + int bcount; + + if (total > strip.getLengthTotal()) { + DEBUG_PRINTLN(F("BobLight: Too many lights.")); + return; + } + + // start left part of bottom strip (clockwise direction, 1st half) + if (bottom > 0) { + bcount = 1; + float brange = 100.0/bottom; + float bcurrent = 50.0; + if (bottom < top) { + int diff = top - bottom; + brange = 100.0/top; + bcurrent -= (diff/2)*brange; + } + while (bcount <= bottom/2) { + float btop = bcurrent - brange; + String name = "b"+String(bcount); + strncpy(lights[lightcount].lightname, name.c_str(), 4); + lights[lightcount].hscan[0] = btop; + lights[lightcount].hscan[1] = bcurrent; + lights[lightcount].vscan[0] = 100 - pct_scan; + lights[lightcount].vscan[1] = 100; + lightcount+=1; + bcurrent = btop; + bcount+=1; + } + } + + // left side + if (left > 0) { + int lcount = 1; + float lrange = 100.0/left; + float lcurrent = 100.0; + while (lcount <= left) { + float ltop = lcurrent - lrange; + String name = "l"+String(lcount); + strncpy(lights[lightcount].lightname, name.c_str(), 4); + lights[lightcount].hscan[0] = 0; + lights[lightcount].hscan[1] = pct_scan; + lights[lightcount].vscan[0] = ltop; + lights[lightcount].vscan[1] = lcurrent; + lightcount+=1; + lcurrent = ltop; + lcount+=1; + } + } + + // top side + if (top > 0) { + int tcount = 1; + float trange = 100.0/top; + float tcurrent = 0; + while (tcount <= top) { + float ttop = tcurrent + trange; + String name = "t"+String(tcount); + strncpy(lights[lightcount].lightname, name.c_str(), 4); + lights[lightcount].hscan[0] = tcurrent; + lights[lightcount].hscan[1] = ttop; + lights[lightcount].vscan[0] = 0; + lights[lightcount].vscan[1] = pct_scan; + lightcount+=1; + tcurrent = ttop; + tcount+=1; + } + } + + // right side + if (right > 0) { + int rcount = 1; + float rrange = 100.0/right; + float rcurrent = 0; + while (rcount <= right) { + float rtop = rcurrent + rrange; + String name = "r"+String(rcount); + strncpy(lights[lightcount].lightname, name.c_str(), 4); + lights[lightcount].hscan[0] = 100-pct_scan; + lights[lightcount].hscan[1] = 100; + lights[lightcount].vscan[0] = rcurrent; + lights[lightcount].vscan[1] = rtop; + lightcount+=1; + rcurrent = rtop; + rcount+=1; + } + } + + // right side of bottom strip (2nd half) + if (bottom > 0) { + float brange = 100.0/bottom; + float bcurrent = 100; + if (bottom < top) { + brange = 100.0/top; + } + while (bcount <= bottom) { + float btop = bcurrent - brange; + String name = "b"+String(bcount); + strncpy(lights[lightcount].lightname, name.c_str(), 4); + lights[lightcount].hscan[0] = btop; + lights[lightcount].hscan[1] = bcurrent; + lights[lightcount].vscan[0] = 100 - pct_scan; + lights[lightcount].vscan[1] = 100; + lightcount+=1; + bcurrent = btop; + bcount+=1; + } + } + + numLights = lightcount; + + #if WLED_DEBUG + DEBUG_PRINTLN(F("Fill light data: ")); + DEBUG_PRINTF(" lights %d\n", numLights); + for (int i=0; i strip.getLengthTotal() ) { + DEBUG_PRINTLN(F("BobLight: Too many lights.")); + DEBUG_PRINTF("%d+%d+%d+%d>%d\n", bottom, left, top, right, strip.getLengthTotal()); + totalLights = strip.getLengthTotal(); + top = bottom = (uint16_t) roundf((float)totalLights * 16.0f / 50.0f); + left = right = (uint16_t) roundf((float)totalLights * 9.0f / 50.0f); + } + lights = new light_t[totalLights]; + if (lights) fillBobLights(bottom, left, top, right, float(pct)); // will fill numLights + else enable(false); + initDone = true; + } + + void connected() { + // we can only start server when WiFi is connected + if (!bob) bob = new WiFiServer(bobPort, 1); + bob->begin(); + bob->setNoDelay(true); + } + + void loop() { + if (!enabled || strip.isUpdating()) return; + if (millis() - lastTime > 10) { + lastTime = millis(); + pollBob(); + } + } + + void enable(bool en) { enabled = en; } + + /** + * handling of MQTT message + * topic only contains stripped topic (part after /wled/MAC) + * topic should look like: /swipe with amessage of [up|down] + */ + bool onMqttMessage(char* topic, char* payload) { + //if (strlen(topic) == 6 && strncmp_P(topic, PSTR("/subtopic"), 6) == 0) { + // String action = payload; + // if (action == "on") { + // enable(true); + // return true; + // } else if (action == "off") { + // enable(false); + // return true; + // } + //} + return false; + } + + /** + * subscribe to MQTT topic for controlling usermod + */ + void onMqttConnect(bool sessionPresent) { + //char subuf[64]; + //if (mqttDeviceTopic[0] != 0) { + // strcpy(subuf, mqttDeviceTopic); + // strcat_P(subuf, PSTR("/subtopic")); + // mqtt->subscribe(subuf, 0); + //} + } + + void addToJsonInfo(JsonObject& root) + { + JsonObject user = root["u"]; + if (user.isNull()) user = root.createNestedObject("u"); + + JsonArray infoArr = user.createNestedArray(FPSTR(_name)); + String uiDomString = F(""); + infoArr.add(uiDomString); + } + + /* + * addToJsonState() can be used to add custom entries to the /json/state part of the JSON API (state object). + * Values in the state object may be modified by connected clients + */ + void addToJsonState(JsonObject& root) + { + } + + /* + * readFromJsonState() can be used to receive data clients send to the /json/state part of the JSON API (state object). + * Values in the state object may be modified by connected clients + */ + void readFromJsonState(JsonObject& root) { + if (!initDone) return; // prevent crash on boot applyPreset() + bool en = enabled; + JsonObject um = root[FPSTR(_name)]; + if (!um.isNull()) { + if (um[FPSTR(_enabled)].is()) { + en = um[FPSTR(_enabled)].as(); + } else { + String str = um[FPSTR(_enabled)]; // checkbox -> off or on + en = (bool)(str!="off"); // off is guaranteed to be present + } + if (en != enabled && lights) { + enable(en); + if (!enabled && bob && bob->hasClient()) { + if (bobClient) bobClient.stop(); + bobClient = bob->available(); + BobClear(); + exitRealtime(); + } + } + } + } + + void appendConfigData() { + //oappend(SET_F("dd=addDropdown('usermod','selectfield');")); + //oappend(SET_F("addOption(dd,'1st value',0);")); + //oappend(SET_F("addOption(dd,'2nd value',1);")); + oappend(SET_F("addInfo('BobLight:top',1,'LEDs');")); // 0 is field type, 1 is actual field + oappend(SET_F("addInfo('BobLight:bottom',1,'LEDs');")); // 0 is field type, 1 is actual field + oappend(SET_F("addInfo('BobLight:left',1,'LEDs');")); // 0 is field type, 1 is actual field + oappend(SET_F("addInfo('BobLight:right',1,'LEDs');")); // 0 is field type, 1 is actual field + oappend(SET_F("addInfo('BobLight:pct',1,'Depth of scan [%]');")); // 0 is field type, 1 is actual field + } + + void addToConfig(JsonObject& root) { + JsonObject umData = root.createNestedObject(FPSTR(_name)); + umData[FPSTR(_enabled)] = enabled; + umData[F("port")] = bobPort; + umData[F("top")] = top; + umData[F("bottom")] = bottom; + umData[F("left")] = left; + umData[F("right")] = right; + umData[F("pct")] = pct; + } + + bool readFromConfig(JsonObject& root) { + JsonObject umData = root[FPSTR(_name)]; + bool configComplete = !umData.isNull(); + + bool en = enabled; + configComplete &= getJsonValue(umData[FPSTR(_enabled)], en); + enable(en); + + configComplete &= getJsonValue(umData[F("port")], bobPort); + configComplete &= getJsonValue(umData[F("bottom")], bottom, 16); + configComplete &= getJsonValue(umData[F("top")], top, 16); + configComplete &= getJsonValue(umData[F("left")], left, 9); + configComplete &= getJsonValue(umData[F("right")], right, 9); + configComplete &= getJsonValue(umData[F("pct")], pct, 5); // Depth of scan [%] + pct = MIN(50,MAX(1,pct)); + + uint16_t totalLights = bottom + left + top + right; + if (initDone && numLights != totalLights) { + if (lights) delete[] lights; + setup(); + } + return configComplete; + } + + /* + * handleOverlayDraw() is called just before every show() (LED strip update frame) after effects have set the colors. + * Use this to blank out some LEDs or set them to a different color regardless of the set effect mode. + * Commonly used for custom clocks (Cronixie, 7 segment) + */ + void handleOverlayDraw() { + //strip.setPixelColor(0, RGBW32(0,0,0,0)) // set the first pixel to black + } + + uint16_t getId() { return USERMOD_ID_BOBLIGHT; } + +}; + +// strings to reduce flash memory usage (used more than twice) +const char BobLightUsermod::_name[] PROGMEM = "BobLight"; +const char BobLightUsermod::_enabled[] PROGMEM = "enabled"; + +// main boblight handling (definition here prevents inlining) +void BobLightUsermod::pollBob() { + + //check if there are any new clients + if (bob && bob->hasClient()) { + //find free/disconnected spot + if (!bobClient || !bobClient.connected()) { + if (bobClient) bobClient.stop(); + bobClient = bob->available(); + DEBUG_PRINTLN(F("Boblight: Client connected.")); + } + //no free/disconnected spot so reject + WiFiClient bobClientTmp = bob->available(); + bobClientTmp.stop(); + BobClear(); + exitRealtime(); + } + + //check clients for data + if (bobClient && bobClient.connected()) { + realtimeLock(realtimeTimeoutMs); // lock strip as we have a client connected + + //get data from the client + while (bobClient.available()) { + String input = bobClient.readStringUntil('\n'); + // DEBUG_PRINT("Client: "); DEBUG_PRINTLN(input); // may be to stressful on Serial + if (input.startsWith(F("hello"))) { + DEBUG_PRINTLN(F("hello")); + bobClient.print(F("hello\n")); + } else if (input.startsWith(F("ping"))) { + DEBUG_PRINTLN(F("ping 1")); + bobClient.print(F("ping 1\n")); + } else if (input.startsWith(F("get version"))) { + DEBUG_PRINTLN(F("version 5")); + bobClient.print(F("version 5\n")); + } else if (input.startsWith(F("get lights"))) { + char tmp[64]; + String answer = ""; + sprintf_P(tmp, PSTR("lights %d\n"), numLights); + DEBUG_PRINT(tmp); + answer.concat(tmp); + for (int i=0; i ... + input.remove(0,10); + String tmp = input.substring(0,input.indexOf(' ')); + + int light_id = -1; + for (uint16_t i=0; iavailable(); + BobClear(); + } + } + } +} diff --git a/usermods/boblight/readme.md b/usermods/boblight/readme.md new file mode 100644 index 00000000..34583009 --- /dev/null +++ b/usermods/boblight/readme.md @@ -0,0 +1,37 @@ +# BobLight usermod + +This usermod allows displaying BobLight ambilight protocol on WLED device with a limited command set (not a full implementation). +BobLight protocol uses a TCP connection which guarantees packet delivery at the possible expense of latency delays. It is not very efficient (as it uses plaintext comands) so is not suited for large number of LEDs. + +This implementation is intended for TV backlight in combination with XBMC/Kodi BobLight add-on. + +The LEDs can be configured in usermod settings page. The configuration is simple: you enter the number of LED pixels on each side of your TV (top, right, bottom, left). +The LEDs should be wired in a clockwise orientation starting in the middle of bottom side (left half of bottom leds is where the string should start). + +``` ++-------->-------+ +| | +^ v +| | ++---<--+ ---<---+ + ^ + start +``` + +## Installation + +Add `-D USERMOD_BOBLIGHT` to your PlatformIO environment. +If you are not using PlatformIO (which you should) try adding `#define USERMOD_BOBLIGHT` to *my_config.h*. + +## Configuration + +All parameters are runtime configurable though changing port may require reboot. + +If you want to define default port during compile time use the following (default values in parentheses): + +- `BOB_PORT=x` : defines default TCP port for usermod to listen on (19333) + + +## Release notes + +2022-11 Initial implementation by @blazoncek (AKA Blaz Kristan) diff --git a/usermods/mpu6050_imu/readme.md b/usermods/mpu6050_imu/readme.md index 6e3cee3e..41200415 100644 --- a/usermods/mpu6050_imu/readme.md +++ b/usermods/mpu6050_imu/readme.md @@ -1,13 +1,13 @@ # MPU-6050 Six-Axis (Gyro + Accelerometer) Driver -This usermod-v2 modification allows the connection of a MPU-6050 IMU sensor to -allow for effects that are controlled by the orientation or motion of the WLED Device. +v2 of this usermod enables connection of a MPU-6050 IMU sensor to +work with effects controlled by the orientation or motion of the WLED Device. -The MPU6050 has a built in "Digital Motion Processor" which does a lot of the heavy -lifting in integrating the gyro and accel measurements to get potentially more +The MPU6050 has a built in "Digital Motion Processor" which does the "heavy lifting" +integrating the gyro and accelerometer measurements to get potentially more useful gravity vector and orientation output. -It is pretty straightforward to comment out some of the variables being read off the device if they're not needed to save CPU/Mem/Bandwidth. +It is fairly straightforward to comment out variables being read from the device if they're not needed. Saves CPU/Memory/Bandwidth. _Story:_ diff --git a/usermods/multi_relay/readme.md b/usermods/multi_relay/readme.md index a0a3e9e9..2906b860 100644 --- a/usermods/multi_relay/readme.md +++ b/usermods/multi_relay/readme.md @@ -1,37 +1,37 @@ # Multi Relay -This usermod-v2 modification allows the connection of multiple relays each with individual delay and on/off mode. +This usermod-v2 modification allows the connection of multiple relays, each with individual delay and on/off mode. ## HTTP API -All responses are returned as JSON. +All responses are returned in JSON format. * Status Request: `http://[device-ip]/relays` * Switch Command: `http://[device-ip]/relays?switch=1,0,1,1` -The number of numbers behind the switch parameter must correspond to the number of relays. The number 1 switches the relay on. The number 0 switches the relay off. +The number of values behind the switch parameter must correspond to the number of relays. The value 1 switches the relay on, 0 switches it off. * Toggle Command: `http://[device-ip]/relays?toggle=1,0,1,1` -The number of numbers behind the parameter switch must correspond to the number of relays. The number 1 causes a toggling of the relay. The number 0 leaves the state of the device. +The number of values behind the parameter switch must correspond to the number of relays. The value 1 causes the relay to toggle, 0 leaves its state unchanged. -Examples +Examples: 1. total of 4 relays, relay 2 will be toggled: `http://[device-ip]/relays?toggle=0,1,0,0` 2. total of 3 relays, relay 1&3 will be switched on: `http://[device-ip]/relays?switch=1,0,1` ## JSON API -You can switch relay state using the following JSON object transmitted to: `http://[device-ip]/json` - +You can toggle the relay state by sending the following JSON object to: `http://[device-ip]/json` Switch relay 0 on: `{"MultiRelay":{"relay":0,"on":true}}` -Switch relay4 3 & 4 off: `{"MultiRelay":[{"relay":2,"on":false},{"relay":3,"on":false}]}` +Switch relay 3 and 4 off: `{"MultiRelay":[{"relay":2,"on":false},{"relay":3,"on":false}]}` + ## MQTT API * `wled`/_deviceMAC_/`relay`/`0`/`command` `on`|`off`|`toggle` * `wled`/_deviceMAC_/`relay`/`1`/`command` `on`|`off`|`toggle` -When relay is switched it will publish a message: +When a relay is switched, a message is published: * `wled`/_deviceMAC_/`relay`/`0` `on`|`off` @@ -42,7 +42,7 @@ When relay is switched it will publish a message: or 2. Use `#define USERMOD_MULTI_RELAY` in wled.h or `-D USERMOD_MULTI_RELAY` in your platformio.ini -You can override the default maximum number (4) of relays by defining MULTI_RELAY_MAX_RELAYS. +You can override the default maximum number of relays (which is 4) by defining MULTI_RELAY_MAX_RELAYS. Example **usermods_list.cpp**: @@ -78,15 +78,15 @@ void registerUsermods() ## Configuration -Usermod can be configured in Usermods settings page. +Usermod can be configured via the Usermods settings page. * `enabled` - enable/disable usermod -* `pin` - GPIO pin where relay is attached to ESP (can be configured at compile time `-D MULTI_RELAY_PINS=xx,xx,...`) +* `pin` - ESP GPIO pin the relay is connected to (can be configured at compile time `-D MULTI_RELAY_PINS=xx,xx,...`) * `delay-s` - delay in seconds after on/off command is received -* `active-high` - toggle high/low activation of relay (can be used to reverse relay states) -* `external` - if enabled WLED does not control relay, it can only be triggered by external command (MQTT, HTTP, JSON or button) +* `active-high` - assign high/low activation of relay (can be used to reverse relay states) +* `external` - if enabled, WLED does not control relay, it can only be triggered by an external command (MQTT, HTTP, JSON or button) * `button` - button (from LED Settings) that controls this relay -* `broadcast`- time in seconds between state broadcasts using MQTT +* `broadcast`- time in seconds between MQTT relay-state broadcasts * `HA-discovery`- enable Home Assistant auto discovery If there is no MultiRelay section, just save current configuration and re-open Usermods settings page. @@ -99,4 +99,4 @@ Have fun - @blazoncek 2021-11 * Added information about dynamic configuration options -* Added button support. \ No newline at end of file +* Added button support. diff --git a/usermods/photoresistor_sensor_mqtt_v1/README.md b/usermods/photoresistor_sensor_mqtt_v1/README.md index 33d96bc7..f83bb01a 100644 --- a/usermods/photoresistor_sensor_mqtt_v1/README.md +++ b/usermods/photoresistor_sensor_mqtt_v1/README.md @@ -1,10 +1,12 @@ # Photoresister sensor with MQTT -This simple usermod allows attaching a photoresistor sensor like the KY-018 and publish the readings in percentage over MQTT. The frequency of MQTT messages can be modified, and there is a threshold value that can be set so that significant changes in the readings can be published immediately instead of waiting for the next update. This was found to be a good compromise between spamming MQTT messages and delayed updates. +Enables attaching a photoresistor sensor like the KY-018 and publishing the readings as a percentage, via MQTT. The frequency of MQTT messages is user definable. +A threshold value can be set so significant changes in the readings are published immediately vice waiting for the next update. This was found to be a good compromise between excessive MQTT traffic and delayed updates. -I also found it useful to limit the frequency of analog pin reads because otherwise the board hangs. +I also found it useful to limit the frequency of analog pin reads, otherwise the board hangs. -This usermod has only been tested with the KY-018 sensor though should work for any other analog pin sensor. Note that this does not control the LED strip directly, it only publishes MQTT readings for use with other integrations like Home Assistant. +This usermod has only been tested with the KY-018 sensor though it should work for any other analog pin sensor. +Note: this does not control the LED strip directly, it only publishes MQTT readings for use with other integrations like Home Assistant. ## Installation diff --git a/usermods/project_cars_shiftlight/readme.md b/usermods/project_cars_shiftlight/readme.md index 4490a2ba..433da430 100644 --- a/usermods/project_cars_shiftlight/readme.md +++ b/usermods/project_cars_shiftlight/readme.md @@ -1,12 +1,11 @@ ### Shift Light for Project Cars Turn your WLED lights into a rev light and shift indicator for Project Cars. +It's easy to use. -It is pretty straight forward to use. +1. Make sure your WLED device and your PC/console are on the same network and can talk to each other -1. Make sure, your WLED device and your PC/console are on the same network and can talk to each other - -2. Go to the gameplay settings menu in PCARS and enable UDP. There are 9 numbers you can choose from. This is the refresh rate. The lower the number, the better. But you might run into problems at faster rates. +2. Go to the gameplay settings menu in PCARS and enable UDP. There are 9 numbers you can choose from. This is the refresh rate. The lower the number, the better. However, you might run into problems at faster rates. | Number | Updates/Second | | ------ | -------------- | @@ -20,4 +19,5 @@ It is pretty straight forward to use. | 8 | 05 | | 9 | 1 | -3. once you enter a race, WLED should automatically shift to PCARS mode. Done. +3. Once you enter a race, WLED should automatically shift to PCARS mode. +4. Done. diff --git a/usermods/pwm_outputs/readme.md b/usermods/pwm_outputs/readme.md new file mode 100644 index 00000000..0309ad36 --- /dev/null +++ b/usermods/pwm_outputs/readme.md @@ -0,0 +1,27 @@ +# PWM outputs + +v2 Usermod to add generic PWM outputs to WLED. Usermode could be used to control servo motors, LED brightness or any other device controlled by PWM signal. + +## Installation + +Add the compile-time option `-D USERMOD_PWM_OUTPUTS` to your `platformio.ini` (or `platformio_override.ini`). By default upt to 3 PWM outputs could be configured, to increase that limit add build argument `-D USERMOD_PWM_OUTPUT_PINS=10` (replace 10 by desired amount). + +Currently only ESP32 is supported. + +## Configuration + +By default PWM outputs are disabled, navigate to Usermods settings and configure desired PWM pins and frequencies. + +## Usage + +If PWM output is configured, it starts to publish its duty cycle value (0-1) both to state JSON and to info JSON (visible in UI info panel). To set PWM duty cycle, use JSON api (over HTTP or over Serial) + +```json +{ + "pwm": { + "0": {"duty": 0.1}, + "1": {"duty": 0.2}, + ... + } +} +``` diff --git a/usermods/pwm_outputs/usermod_pwm_outputs.h b/usermods/pwm_outputs/usermod_pwm_outputs.h new file mode 100644 index 00000000..1880308c --- /dev/null +++ b/usermods/pwm_outputs/usermod_pwm_outputs.h @@ -0,0 +1,221 @@ +#pragma once +#include "wled.h" + +#ifndef ESP32 + #error This usermod does not support the ESP8266. +#endif + +#ifndef USERMOD_PWM_OUTPUT_PINS + #define USERMOD_PWM_OUTPUT_PINS 3 +#endif + + +class PwmOutput { + public: + + void open(int8_t pin, uint32_t freq) { + + if (enabled_) { + if (pin == pin_ && freq == freq_) { + return; // PWM output is already open + } else { + close(); // Config has changed, close and reopen + } + } + + pin_ = pin; + freq_ = freq; + if (pin_ < 0) + return; + + DEBUG_PRINTF("pwm_output[%d]: setup to freq %d\n", pin_, freq_); + if (!pinManager.allocatePin(pin_, true, PinOwner::UM_PWM_OUTPUTS)) + return; + + channel_ = pinManager.allocateLedc(1); + if (channel_ == 255) { + DEBUG_PRINTF("pwm_output[%d]: failed to quire ledc\n", pin_); + pinManager.deallocatePin(pin_, PinOwner::UM_PWM_OUTPUTS); + return; + } + + ledcSetup(channel_, freq_, bit_depth_); + ledcAttachPin(pin_, channel_); + DEBUG_PRINTF("pwm_output[%d]: init successful\n", pin_); + enabled_ = true; + } + + void close() { + DEBUG_PRINTF("pwm_output[%d]: close\n", pin_); + if (!enabled_) + return; + pinManager.deallocatePin(pin_, PinOwner::UM_PWM_OUTPUTS); + if (channel_ != 255) + pinManager.deallocateLedc(channel_, 1); + channel_ = 255; + duty_ = 0.0f; + enabled_ = false; + } + + void setDuty(const float duty) { + DEBUG_PRINTF("pwm_output[%d]: set duty %f\n", pin_, duty); + if (!enabled_) + return; + duty_ = min(1.0f, max(0.0f, duty)); + const uint32_t value = static_cast((1 << bit_depth_) * duty_); + ledcWrite(channel_, value); + } + + void setDuty(const uint16_t duty) { + setDuty(static_cast(duty) / 65535.0f); + } + + bool isEnabled() const { + return enabled_; + } + + void addToJsonState(JsonObject& pwmState) const { + pwmState[F("duty")] = duty_; + } + + void readFromJsonState(JsonObject& pwmState) { + if (pwmState.isNull()) { + return; + } + float duty; + if (getJsonValue(pwmState[F("duty")], duty)) { + setDuty(duty); + } + } + + void addToJsonInfo(JsonObject& user) const { + if (!enabled_) + return; + char buffer[12]; + sprintf_P(buffer, PSTR("PWM pin %d"), pin_); + JsonArray data = user.createNestedArray(buffer); + data.add(1e2f * duty_); + data.add(F("%")); + } + + void addToConfig(JsonObject& pwmConfig) const { + pwmConfig[F("pin")] = pin_; + pwmConfig[F("freq")] = freq_; + } + + bool readFromConfig(JsonObject& pwmConfig) { + if (pwmConfig.isNull()) + return false; + + bool configComplete = true; + int8_t newPin = pin_; + uint32_t newFreq = freq_; + configComplete &= getJsonValue(pwmConfig[F("pin")], newPin); + configComplete &= getJsonValue(pwmConfig[F("freq")], newFreq); + + open(newPin, newFreq); + + return configComplete; + } + + private: + int8_t pin_ {-1}; + uint32_t freq_ {50}; + static const uint8_t bit_depth_ {12}; + uint8_t channel_ {255}; + float duty_ {0.0f}; + bool enabled_ {false}; +}; + + +class PwmOutputsUsermod : public Usermod { + public: + + static const char USERMOD_NAME[]; + static const char PWM_STATE_NAME[]; + + void setup() { + // By default all PWM outputs are disabled, no setup do be done + } + + void loop() { + } + + void addToJsonState(JsonObject& root) { + JsonObject pwmStates = root.createNestedObject(PWM_STATE_NAME); + for (int i = 0; i < USERMOD_PWM_OUTPUT_PINS; i++) { + const PwmOutput& pwm = pwms_[i]; + if (!pwm.isEnabled()) + continue; + char buffer[4]; + sprintf_P(buffer, PSTR("%d"), i); + JsonObject pwmState = pwmStates.createNestedObject(buffer); + pwm.addToJsonState(pwmState); + } + } + + void readFromJsonState(JsonObject& root) { + JsonObject pwmStates = root[PWM_STATE_NAME]; + if (pwmStates.isNull()) + return; + + for (int i = 0; i < USERMOD_PWM_OUTPUT_PINS; i++) { + PwmOutput& pwm = pwms_[i]; + if (!pwm.isEnabled()) + continue; + char buffer[4]; + sprintf_P(buffer, PSTR("%d"), i); + JsonObject pwmState = pwmStates[buffer]; + pwm.readFromJsonState(pwmState); + } + } + + void addToJsonInfo(JsonObject& root) { + JsonObject user = root[F("u")]; + if (user.isNull()) + user = root.createNestedObject(F("u")); + + for (int i = 0; i < USERMOD_PWM_OUTPUT_PINS; i++) { + const PwmOutput& pwm = pwms_[i]; + pwm.addToJsonInfo(user); + } + } + + void addToConfig(JsonObject& root) { + JsonObject top = root.createNestedObject(USERMOD_NAME); + for (int i = 0; i < USERMOD_PWM_OUTPUT_PINS; i++) { + const PwmOutput& pwm = pwms_[i]; + char buffer[8]; + sprintf_P(buffer, PSTR("PWM %d"), i); + JsonObject pwmConfig = top.createNestedObject(buffer); + pwm.addToConfig(pwmConfig); + } + } + + bool readFromConfig(JsonObject& root) { + JsonObject top = root[USERMOD_NAME]; + if (top.isNull()) + return false; + + bool configComplete = true; + for (int i = 0; i < USERMOD_PWM_OUTPUT_PINS; i++) { + PwmOutput& pwm = pwms_[i]; + char buffer[8]; + sprintf_P(buffer, PSTR("PWM %d"), i); + JsonObject pwmConfig = top[buffer]; + configComplete &= pwm.readFromConfig(pwmConfig); + } + return configComplete; + } + + uint16_t getId() { + return USERMOD_ID_PWM_OUTPUTS; + } + + private: + PwmOutput pwms_[USERMOD_PWM_OUTPUT_PINS]; + +}; + +const char PwmOutputsUsermod::USERMOD_NAME[] PROGMEM = "PwmOutputs"; +const char PwmOutputsUsermod::PWM_STATE_NAME[] PROGMEM = "pwm"; diff --git a/usermods/quinled-an-penta/readme.md b/usermods/quinled-an-penta/readme.md index 4a4c0290..2338747d 100644 --- a/usermods/quinled-an-penta/readme.md +++ b/usermods/quinled-an-penta/readme.md @@ -1,5 +1,5 @@ # QuinLED-An-Penta -The (un)official usermod to get the best out of the QuinLED-An-Penta (https://quinled.info/quinled-an-penta/), like using the OLED and the SHT30 temperature/humidity sensor. +The (un)official usermod to get the best out of the QuinLED-An-Penta (https://quinled.info/quinled-an-penta/), e.g. using the OLED and the SHT30 temperature/humidity sensor. ## Requirements * "u8gs" by olikraus, v2.28 or higher: https://github.com/olikraus/u8g2 @@ -31,15 +31,15 @@ lib_deps = ${esp32.lib_deps} ## Some words about the (optional) OLED This mod has been optimized for an SSD1306 driven 128x64 OLED. Using a smaller OLED or an OLED using a different driver will result in unexpected results. I highly recommend using these "two color monochromatic OLEDs", which have the first 16 pixels in a different color than the other 48, e.g. a yellow/blue OLED. -Also note, you need to have an **SPI** driven OLED, **not i2c**! +Note: you _must_ use an **SPI** driven OLED, **not an i2c one**! ### Limitations combined with Ethernet -The initial development of this mod had been done with a beta version of the QuinLED-An-Penta, which had a different IO layout for the OLED: The CS pin used to be IO_0, but has been changed to IO27 with the first v1 public release. Unfortunately, IO27 is used by the Ethernet boards, so WLED will not let you enable the OLED screen, if you're using it with Ethernet. This unfortunately makes the development I've done to support/show Ethernet information void, as it cannot be used. -However (and I've not tried this, as I don't own a v1 board): You can try to modify this mod and try to use IO27 for the OLED and share it with the Ethernet board. It is "just" the chip select pin, so there is a chance that both can coexist and use the same IO. You need to skip WLEDs PinManager for the CS pin, so WLED will not block using it. If you don't know how this works: Leave it. If you know what I'm talking about: Try it and please let me know on the Intermit.Tech (QuinLED) Discord server: https://discord.gg/WdbAauG +The initial development of this mod was done with a beta version of the QuinLED-An-Penta, which had a different IO layout for the OLED: The CS pin _was_ IO_0, but has been changed to IO27 with the first v1 public release. Unfortunately, IO27 is used by Ethernet boards, so WLED will not let you enable the OLED screen, if you're using it with Ethernet. Unfortunately, that makes the development I've done to support/show Ethernet information invalid, as it cannot be used. +However, (and I've not tried this, as I don't own a v1 board) you can modify this usermod and try to use IO27 for the OLED and share it with the Ethernet board. It is "just" the chip select pin, so there is a chance that both can coexist and use the same IO. You need to skip WLEDs PinManager for the CS pin, so WLED will not block using it. If you don't know how this works, don't change it. If you know what I'm talking about, try it and please let me know on the Intermit.Tech (QuinLED) Discord server: https://discord.gg/WdbAauG ### My OLED flickers after some time, what should I do? -That's a tricky one: During development I saw that the OLED sometimes starts to "bug out" / flicker and won't work anymore. This seems to be caused by the high PWM interference the board produces. It seems to loose its settings and then doesn't know how to draw anymore. Turns out the only way to fix this is to call the libraries `begin()` method again which will re-initialize the display. -If you're facing this issue, you can enable a setting I've added which will call the `begin()` roughly every 60 seconds between a page change. This will make the page change take ~500ms, but will fix the display. +That's a tricky one. During development I saw that the OLED sometimes starts to "drop out" / flicker and won't work anymore. This seems to be caused by the high PWM interference the board produces. It seems to lose its settings then doesn't know how to draw anymore. Turns out the only way to fix this is to call the libraries `begin()` method again which re-initializes the display. +If you're facing this issue, you can enable a setting which will call the `begin()` roughly every 60 seconds between page changes. This will make the page change take ~500ms, but will fix the display. ## Configuration @@ -53,11 +53,11 @@ Navigate to the "Config" and then to the "Usermods" section. If you compiled WLE * Possible values: Enabled/Disabled * Default: Disabled * OLED-Flip-Screen-180: - * What it does: Flips the screen 180° / upside-down + * What it does: Flips the screen 180° * Possible values: Enabled/Disabled * Default: Disabled * OLED-Seconds-Per-Page: - * What it does: Defines how long the OLED should stay on one page in seconds before changing to the next + * What it does: Number of seconds the OLED should stay on one page before changing pages * Possible values: Enabled/Disabled * Default: 10 * OLED-Fix-Bugged-Screen: @@ -76,4 +76,4 @@ Navigate to the "Config" and then to the "Usermods" section. If you compiled WLE * First implementation. ## Credits -ezcGman | Andy: Find me on the Intermit.Tech (QuinLED) Discord server: https://discord.gg/WdbAauG \ No newline at end of file +ezcGman | Andy: Find me on the Intermit.Tech (QuinLED) Discord server: https://discord.gg/WdbAauG diff --git a/usermods/readme.md b/usermods/readme.md index 0c56efae..8aa8d6ab 100644 --- a/usermods/readme.md +++ b/usermods/readme.md @@ -2,17 +2,17 @@ This folder serves as a repository for usermods (custom `usermod.cpp` files)! -If you have created an usermod that you believe is useful (for example to support a particular sensor, display, feature...), feel free to contribute by opening a pull request! +If you have created a usermod you believe is useful (for example to support a particular sensor, display, feature...), feel free to contribute by opening a pull request! In order for other people to be able to have fun with your usermod, please keep these points in mind: - Create a folder in this folder with a descriptive name (for example `usermod_ds18b20_temp_sensor_mqtt`) - Include your custom files -- If your usermod requires changes to other WLED files, please write a `readme.md` outlining the steps one has to take to use the usermod +- If your usermod requires changes to other WLED files, please write a `readme.md` outlining the steps one needs to take - Create a pull request! - If your feature is useful for the majority of WLED users, I will consider adding it to the base code! -While I do my best to not break too much, keep in mind that as WLED is being updated, usermods might break. +While I do my best to not break too much, keep in mind that as WLED is updated, usermods might break. I am not actively maintaining any usermod in this directory, that is your responsibility as the creator of the usermod. For new usermods, I would recommend trying out the new v2 usermod API, which allows installing multiple usermods at once and new functions! diff --git a/usermods/rgb-rotary-encoder/readme.md b/usermods/rgb-rotary-encoder/readme.md index 2bf0ecb7..ba5aad4d 100644 --- a/usermods/rgb-rotary-encoder/readme.md +++ b/usermods/rgb-rotary-encoder/readme.md @@ -5,8 +5,8 @@ This usermod-v2 adds support for the awesome RGB Rotary Encoder Board by Adam Ze https://user-images.githubusercontent.com/3090131/124680599-0180ab80-dec7-11eb-9065-a6d08ebe0287.mp4 ## Credits -The actual / original code that does the different LED modes is from Adam Zeloof. So I don't take credit for these. But I ported it to WLED, which involved replacing the LED library he used (because, guess what, WLED already has one; so no need to add another one, but use whatever WLED uses), plus the rotary encoder library, because that one was not compatible with ESP, only Arduino. -So it was quite more work than I hoped, but I got there eventually :) +The actual / original code that controls the LED modes is from Adam Zeloof. I take no credit for it. I ported it to WLED, which involved replacing the LED library he used, (because WLED already has one, so no need to add another one) plus the rotary encoder library because it was not compatible with ESP, only Arduino. +It was quite a bit more work than I hoped, but I got there eventually :) ## Requirements * "ESP Rotary" by Lennart Hennigs, v1.5.0 or higher: https://github.com/LennartHennigs/ESPRotary @@ -33,25 +33,25 @@ lib_deps = ${esp8266.lib_deps} ``` ## How to connect the board to your ESP -We gonna need (minimum) three or (maximum) four GPIOs for the board: -* "ea": Basically tells if the encoder goes into one or the other direction -* "eb": Same thing, but the other direction -* "di": LED data in. To actually control the LEDs -* *(optional)* "sw": The integrated switch in the rotary encoder. Can be omitted for the bare functionality of just controlling the brightness +We'll need (minimum) three or (maximum) four GPIOs for the board: +* "ea": reports the encoder direction +* "eb": Same thing, opposite direction +* "di": LED data in. +* *(optional)* "sw": The integrated switch in the rotary encoder. Can be omitted for the bare functionality of controlling only the brightness -We also gonna need some power, so: +We'll also need power: * "vdd": Needs to be connected to **+5V**. -* "gnd": Well, it's GND. +* "gnd": Ground. -You can freely pick the GPIOs, it doesn't matter. Those will be configured in the "Usermods" section in the WLED web panel: +You can freely pick the GPIOs, it doesn't matter. Those will be configured in the "Usermods" section of the WLED web panel: ## Configuration -Navigate to the "Config" and then to the "Usermods" section. If you compiled WLED with `-D RGB_ROTARY_ENCODER`, you will see the config for it there. The settings there are the GPIOs we mentioned before (*Note: The switch pin is not there, as this can just be configured the "normal" button on the "LED Preferences" page*), plus a few more: +Navigate to the "Config" and then to the "Usermods" section. If you compiled WLED with `-D RGB_ROTARY_ENCODER`, you will see the config for it there. The settings there are the aforementioned GPIOs, (*Note: The switch pin is not there, as this can just be configured the "normal" button on the "LED Preferences" page*) plus a few more: * LED pin: * Possible values: Any valid and available GPIO * Default: 3 - * What it does: Pin to control the LED ring + * What it does: controls the LED ring * ea pin: * Possible values: Any valid and available GPIO * Default: 15 @@ -63,7 +63,7 @@ Navigate to the "Config" and then to the "Usermods" section. If you compiled WLE * LED Mode: * Possible values: 1-3 * Default: 3 - * What it does: The usermod provides three different modes of how the LEDs can look like. Here's an example: https://github.com/isotope-engineering/RGB-Encoder-Board/blob/master/images/rgb-encoder-animations.gif + * What it does: The usermod provides three different modes of how the LEDs can appear. Here's an example: https://github.com/isotope-engineering/RGB-Encoder-Board/blob/master/images/rgb-encoder-animations.gif * Up left is "1" * Up right is not supported / doesn't make sense for brightness control * Bottom left is "2" @@ -71,15 +71,15 @@ Navigate to the "Config" and then to the "Usermods" section. If you compiled WLE * LED Brightness: * Possible values: 1-255 * Default: 64 - * What it does: Brightness of the LED ring + * What it does: sets LED ring Brightness * Steps per click: * Possible values: Any positive number * Default: 4 - * What it does: With each "click", a rotary encoder actually increments it's "steps". Most rotary encoder do four "steps" per "click". I know this sounds super weird, so just leave this the default value, unless your rotary encoder behaves weirdly, like with one click, it makes two LEDs light up, or you sometimes need two click for one LED. Then you should play around with this value or write a small sketch using the same "ESP Rotary" library and read out the steps it does. + * What it does: With each "click", a rotary encoder actually increments its "steps". Most rotary encoders produce four "steps" per "click". Leave this at the default value unless your rotary encoder behaves strangely. e.g. with one click, it makes two LEDs light up, or you need two clicks for one LED. If that's the case, adjust this value or write a small sketch using the same "ESP Rotary" library and read out the steps it produce. * Increment per click: * Possible values: Any positive number * Default: 5 - * What it does: Most rotary encoder have 20 "clicks", so basically 20 positions. This value should be set to 100 / `number of clicks` + * What it does: Most rotary encoders have 20 "clicks" or positions. This value should be set to 100/`number of clicks` ## Change log 2021-07 diff --git a/usermods/sensors_to_mqtt/readme.md b/usermods/sensors_to_mqtt/readme.md index 7f2d6407..d427d3e1 100644 --- a/usermods/sensors_to_mqtt/readme.md +++ b/usermods/sensors_to_mqtt/readme.md @@ -1,12 +1,12 @@ -# Sensors To Home Assistant (or mqtt) +# Send sensor data To Home Assistant -This usermod will publish values of the BMP280, CCS811 and Si7021 sensors to Home Assistant via MQTT. +Publishes BMP280, CCS811 and Si7021 measurements to Home Assistant via MQTT. -Its using home assistant automatic device discovery feature. +Uses Home Assistant Automatic Device Discovery. -The use of Home Assistant is not mandatory; it will publish the sensor values via MQTT just fine without it. +The use of Home Assistant is not mandatory. The mod will publish sensor values via MQTT just fine without it. -Its resusing the mqtt connection set in the WLED web user interface. +Uses the MQTT connection set in the WLED web user interface. ## Maintainer @@ -15,12 +15,12 @@ twitter.com/mpronk89 ## Features - Reads BMP280, CCS811 and Si7021 senors -- Publishes via MQTT, configured via webui of wled +- Publishes via MQTT, configured via WLED webUI - Announces device in Home Assistant for easy setup - Efficient energy usage - Updates every 60 seconds -## Example mqtt topics: +## Example MQTT topics: `$mqttDeviceTopic` is set in webui of WLED! @@ -40,7 +40,7 @@ IAQ: $mqttDeviceTopic/iaq ### Requirements 1. BMP280/CCS811/Si7021 sensor. E.g. https://aliexpress.com/item/32979998543.html -2. A microcontroller which can talk i2c, e.g. esp32 +2. A microcontroller that supports i2c. e.g. esp32 ### installation @@ -77,7 +77,7 @@ SDA_PIN = 4; adafruit/Adafruit Si7021 Library @ 1.4.0 ``` -The #ifdefs in `usermods_list.cpp` should do the rest :) +The #ifdefs in `usermods_list.cpp` should do the rest # Credits diff --git a/usermods/seven_segment_display/readme.md b/usermods/seven_segment_display/readme.md index ca52383d..a5294701 100644 --- a/usermods/seven_segment_display/readme.md +++ b/usermods/seven_segment_display/readme.md @@ -1,25 +1,25 @@ # Seven Segment Display -Usermod that uses the overlay feature to create a configurable seven segment display. -This has only been tested on a single configuration. Colon support is entirely untested. +Uses the overlay feature to create a configurable seven segment display. +This has only been tested on a single configuration. Colon support has _not_ been tested. ## Installation Add the compile-time option `-D USERMOD_SEVEN_SEGMENT` to your `platformio.ini` (or `platformio_override.ini`) or use `#define USERMOD_SEVEN_SEGMENT` in `my_config.h`. ## Settings -Settings can be controlled through both the usermod setting page and through MQTT with a raw payload. +Settings can be controlled via both the usermod setting page and through MQTT with a raw payload. ##### Example Topic ```/sevenSeg/perSegment/set``` Payload ```3``` #### perSegment -- ssLEDPerSegment -The number of individual LEDs per segment. There are 7 segments per digit. +The number of individual LEDs per segment. 7 segments per digit. #### perPeriod -- ssLEDPerPeriod -The number of individual LEDs per period. A ':' has 2x periods. +The number of individual LEDs per period. A ':' (colon) has two periods. #### startIdx -- ssStartLED -Index of the LED that the display starts at. Allows a seven segment display to be in the middle of a string. +Index of the LED the display starts at. Enabless a seven segment display to be in the middle of a string. #### timeEnable -- ssTimeEnabled -When true, when displayMask is configured for a time output and no message is set the time will be displayed. +When true, when displayMask is configured for a time output and no message is set, the time will be displayed. #### scrollSpd -- ssScrollSpeed Time, in milliseconds, between message shifts when the length of displayMsg exceeds the length of the displayMask. #### displayMask -- ssDisplayMask @@ -35,9 +35,9 @@ All others for alpha numeric, (will be blank when displaying time) ```HHMMSS ``` ```hh:MM:SS ``` #### displayMsg -- ssDisplayMessage -Message to be displayed across the display. If the length exceeds the length of the displayMask the message will scroll at scrollSpd. To 'remove' a message or revert back to time, if timeEnabled is true, set the message to '~'. +Message to be displayed. If the message length exceeds the length of displayMask, the message will scroll at scrollSpd. To 'remove' a message or revert back to time, if timeEnabled is true, set the message to '~'. #### displayCfg -- ssDisplayConfig -The order that your LEDs are configured. All seven segments in the display need to be wired the same way. +The order your LEDs are configured in. All segments in the display need to be wired the same way.

            -------
          /   A   /          0 - EDCGFAB
diff --git a/usermods/seven_segment_display_reloaded/readme.md b/usermods/seven_segment_display_reloaded/readme.md
index 09479754..d373a7ee 100644
--- a/usermods/seven_segment_display_reloaded/readme.md
+++ b/usermods/seven_segment_display_reloaded/readme.md
@@ -1,6 +1,6 @@
 # Seven Segment Display Reloaded
 
-Usermod that uses the overlay feature to create a configurable seven segment display.
+Uses the overlay feature to create a configurable seven segment display.
 Optimized for maximum configurability and use with seven segment clocks by parallyze (https://www.instructables.com/member/parallyze/instructables/)
 Very loosely based on the existing usermod "seven segment display".
 
@@ -12,26 +12,26 @@ Add the compile-time option `-D USERMOD_SSDR` to your `platformio.ini` (or `plat
 For the auto brightness option, the usermod SN_Photoresistor has to be installed as well. See SN_Photoresistor/readme.md for instructions.
 
 ## Settings
-All settings can be controlled the usermod setting page.
+All settings can be controlled via the usermod settings page.
 Part of the settings can be controlled through MQTT with a raw payload or through a json request to /json/state.
 
 ### enabled
-Enables/disables this overlay usermod
+Enables/disables this usermod
 
 ### inverted
-Enables the inverted mode in which the background should be enabled and the digits should be black (leds off)
+Enables the inverted mode in which the background should be enabled and the digits should be black (LEDs off)
 
 ### Colon-blinking
 Enables the blinking colon(s) if they are defined
 
 ### enable-auto-brightness
-Enables the auto brightness feature. Can be only used with the usermod SN_Photoresistor installed.
+Enables the auto brightness feature. Can be used only when the usermod SN_Photoresistor is installed.
 
 ### auto-brightness-min / auto-brightness-max
 The lux value calculated from usermod SN_Photoresistor will be mapped to the values defined here.
-The mapping is 0 - 1000 lux will be mapped to auto-brightness-min - auto-brightness-max
+The mapping, 0 - 1000 lux, will be mapped to auto-brightness-min and auto-brightness-max
 
-The mA current protection of WLED will override the calculated value if it is too high.
+WLED current protection will override the calculated value if it is too high.
 
 ### Display-Mask
 Defines the type of the time/date display. 
@@ -61,7 +61,7 @@ See following example for usage.
 
 ## Example
 
-Example for Leds definition
+Example of an LED definition:
 ```
   <  A  >
 /\       /\
@@ -74,15 +74,15 @@ E        C
   <  D  >
 ```
 
-Leds or Range of Leds are seperated by a comma ","
+LEDs or Range of LEDs are separated by a comma ","
 
-Segments are seperated by a semicolon ";" and are read as A;B;C;D;E;F;G
+Segments are separated by a semicolon ";" and are read as A;B;C;D;E;F;G
 
-Digits are seperated by colon ":" -> A;B;C;D;E;F;G:A;B;C;D;E;F;G
+Digits are separated by colon ":" -> A;B;C;D;E;F;G:A;B;C;D;E;F;G
 
 Ranges are defined as lower to higher (lower first)
 
-For example, an clock definition for the following clock (https://www.instructables.com/Lazy-7-Quick-Build-Edition/) is
+For example, a clock definition for the following clock (https://www.instructables.com/Lazy-7-Quick-Build-Edition/) is
 
 - hour "59,46;47-48;50-51;52-53;54-55;57-58;49,56:0,13;1-2;4-5;6-7;8-9;11-12;3,10"
 
@@ -96,18 +96,18 @@ or
 
 depending on the orientation.
 
-# The example detailed:
+# Example details:
 hour "59,46;47-48;50-51;52-53;54-55;57-58;49,56:0,13;1-2;4-5;6-7;8-9;11-12;3,10"
 
-there are two digits seperated by ":"
+there are two digits separated by ":"
 
 - 59,46;47-48;50-51;52-53;54-55;57-58;49,56
 - 0,13;1-2;4-5;6-7;8-9;11-12;3,10
 
 In the first digit, 
-the **segment A** consists of the leds number **59 and 46**., **segment B** consists of the leds number **47, 48** and so on
+the **segment A** consists of the LEDs number **59 and 46**., **segment B** consists of the LEDs number **47, 48** and so on
 
-The second digit starts again with **segment A** and leds **0 and 13**, **segment B** consists of the leds number **1 and 2** and so on
+The second digit starts again with **segment A** and LEDs **0 and 13**, **segment B** consists of the LEDs number **1 and 2** and so on
 
 ### first digit of the hour
 - Segment A: 59, 46
@@ -126,4 +126,4 @@ The second digit starts again with **segment A** and leds **0 and 13**, **segmen
 - Segment D: 6, 7
 - Segment E: 8, 9
 - Segment F: 11, 12
-- Segment G: 3, 10
\ No newline at end of file
+- Segment G: 3, 10
diff --git a/usermods/sht/readme.md b/usermods/sht/readme.md
new file mode 100644
index 00000000..0337805b
--- /dev/null
+++ b/usermods/sht/readme.md
@@ -0,0 +1,56 @@
+# SHT
+Usermod to support various SHT i2c sensors like the SHT30, SHT31, SHT35 and SHT85
+
+## Requirements
+* "SHT85" by Rob Tillaart, v0.2 or higher: https://github.com/RobTillaart/SHT85
+
+## Usermod installation
+Simply copy the below block (build task) to your `platformio_override.ini` and compile WLED using this new build task. Or use an existing one, add the buildflag `-D USERMOD_SHT` and the below library dependencies.
+
+ESP32:
+```
+[env:custom_esp32dev_usermod_sht]
+extends = env:esp32dev
+build_flags = ${common.build_flags_esp32}
+  -D USERMOD_SHT
+lib_deps = ${esp32.lib_deps}
+    robtillaart/SHT85@~0.3.3
+```
+
+ESP8266:
+```
+[env:custom_d1_mini_usermod_sht]
+extends = env:d1_mini
+build_flags = ${common.build_flags_esp8266}
+  -D USERMOD_SHT
+lib_deps = ${esp8266.lib_deps}
+    robtillaart/SHT85@~0.3.3
+```
+
+## MQTT Discovery for Home Assistant
+If you're using Home Assistant and want to have the temperature and humidity available as entities in HA, you can tick the "Add-To-Home-Assistant-MQTT-Discovery" option in the usermod settings. If you have an MQTT broker configured under "Sync Settings" and it is connected, the mod will publish the auto discovery message to your broker and HA will instantly find it and create an entity each for the temperature and humidity.
+
+### Publishing readings via MQTT
+Regardless of having MQTT discovery ticked or not, the mod will always report temperature and humidity to the WLED MQTT topic of that instance, if you have a broker configured and it's connected.
+
+## Configuration
+Navigate to the "Config" and then to the "Usermods" section. If you compiled WLED with `-D USERMOD_SHT`, you will see the config for it there:
+* SHT-Type:
+  * What it does: Select the SHT sensor type you want to use
+  * Possible values: SHT30, SHT31, SHT35, SHT85
+  * Default: SHT30
+* Unit:
+  * What it does: Select which unit should be used to display the temperature in the info section. Also used when sending via MQTT discovery, see below.
+  * Possible values: Celsius, Fahrenheit
+  * Default: Celsius
+* Add-To-HA-MQTT-Discovery:
+  * What it does: Makes the temperature and humidity available via MQTT discovery, so they're automatically added to Home Assistant, because that way it's typesafe.
+  * Possible values: Enabled/Disabled
+  * Default: Disabled
+
+## Change log
+2022-12
+* First implementation.
+
+## Credits
+ezcGman | Andy: Find me on the Intermit.Tech (QuinLED) Discord server: https://discord.gg/WdbAauG
diff --git a/usermods/sht/usermod_sht.h b/usermods/sht/usermod_sht.h
new file mode 100644
index 00000000..42b22a79
--- /dev/null
+++ b/usermods/sht/usermod_sht.h
@@ -0,0 +1,492 @@
+#pragma once
+
+#include "SHT85.h"
+
+#define USERMOD_SHT_TYPE_SHT30 0
+#define USERMOD_SHT_TYPE_SHT31 1
+#define USERMOD_SHT_TYPE_SHT35 2
+#define USERMOD_SHT_TYPE_SHT85 3
+
+class ShtUsermod : public Usermod
+{
+  private:
+    bool enabled = false; // Is usermod enabled or not
+    bool firstRunDone = false; // Remembers if the first config load run had been done
+    bool pinAllocDone = true; // Remembers if we have allocated pins
+    bool initDone = false; // Remembers if the mod has been completely initialised
+    bool haMqttDiscovery = false; // Is MQTT discovery enabled or not
+    bool haMqttDiscoveryDone = false; // Remembers if we already published the HA discovery topics
+
+    // SHT vars
+    SHT *shtTempHumidSensor; // Instance of SHT lib
+    byte shtType = 0; // SHT sensor type to be used. Default: SHT30
+    byte unitOfTemp = 0; // Temperature unit to be used. Default: Celsius (0 = Celsius, 1 = Fahrenheit)
+    bool shtInitDone = false; // Remembers if SHT sensor has been initialised
+    bool shtReadDataSuccess = false; // Did we have a successful data read and is a valid temperature and humidity available?
+    const byte shtI2cAddress = 0x44; // i2c address of the sensor. 0x44 is the default for all SHT sensors. Change this, if needed
+    unsigned long shtLastTimeUpdated = 0; // Remembers when we read data the last time
+    bool shtDataRequested = false; // Reading data is done async. This remembers if we asked the sensor to read data
+    float shtCurrentTempC = 0; // Last read temperature in Celsius
+    float shtCurrentTempF = 0; // Last read temperature in Fahrenheit
+    float shtCurrentHumidity = 0; // Last read humidity in RH%
+
+
+    void initShtTempHumiditySensor();
+    void cleanupShtTempHumiditySensor();
+    void cleanup();
+    bool isShtReady();
+
+    void publishTemperatureAndHumidityViaMqtt();
+    void publishHomeAssistantAutodiscovery();
+    void appendDeviceToMqttDiscoveryMessage(JsonDocument& root);
+
+  public:
+    // Strings to reduce flash memory usage (used more than twice)
+    static const char _name[];
+    static const char _enabled[];
+    static const char _shtType[];
+    static const char _unitOfTemp[];
+    static const char _haMqttDiscovery[];
+
+    void setup();
+    void loop();
+    void onMqttConnect(bool sessionPresent);
+    void appendConfigData();
+    void addToConfig(JsonObject &root);
+    bool readFromConfig(JsonObject &root);
+    void addToJsonInfo(JsonObject& root);
+
+    float getTemperatureC();
+    float getTemperatureF();
+    float getHumidity();
+
+    uint16_t getId() { return USERMOD_ID_SHT; }
+};
+
+// Strings to reduce flash memory usage (used more than twice)
+const char ShtUsermod::_name[]    PROGMEM = "SHT-Sensor";
+const char ShtUsermod::_enabled[] PROGMEM = "Enabled";
+const char ShtUsermod::_shtType[] PROGMEM = "SHT-Type";
+const char ShtUsermod::_unitOfTemp[] PROGMEM = "Unit";
+const char ShtUsermod::_haMqttDiscovery[] PROGMEM = "Add-To-HA-MQTT-Discovery";
+
+/**
+ * Initialise SHT sensor.
+ *
+ * Using the correct constructor according to config and initialises it using the
+ * global i2c pins.
+ *
+ * @return void
+ */
+void ShtUsermod::initShtTempHumiditySensor()
+{
+  switch (shtType) {
+    case USERMOD_SHT_TYPE_SHT30: shtTempHumidSensor = (SHT *) new SHT30(); break;
+    case USERMOD_SHT_TYPE_SHT31: shtTempHumidSensor = (SHT *) new SHT31(); break;
+    case USERMOD_SHT_TYPE_SHT35: shtTempHumidSensor = (SHT *) new SHT35(); break;
+    case USERMOD_SHT_TYPE_SHT85: shtTempHumidSensor = (SHT *) new SHT85(); break;
+  }
+
+  shtTempHumidSensor->begin(shtI2cAddress, i2c_sda, i2c_scl);
+  if (shtTempHumidSensor->readStatus() == 0xFFFF) {
+    DEBUG_PRINTF("[%s] SHT init failed!\n", _name);
+    cleanupShtTempHumiditySensor();
+    cleanup();
+    return;
+  }
+
+  shtInitDone = true;
+}
+
+/**
+ * Cleanup the SHT sensor.
+ *
+ * Properly calls "reset" for the sensor then releases it from memory.
+ *
+ * @return void
+ */
+void ShtUsermod::cleanupShtTempHumiditySensor()
+{
+  if (isShtReady()) {
+    shtTempHumidSensor->reset();
+  }
+
+  delete shtTempHumidSensor;
+
+  shtInitDone = false;
+}
+
+/**
+ * Cleanup the mod completely.
+ *
+ * Calls ::cleanupShtTempHumiditySensor() to cleanup the SHT sensor and
+ * deallocates pins.
+ *
+ * @return void
+ */
+void ShtUsermod::cleanup()
+{
+  if (isShtReady()) {
+    cleanupShtTempHumiditySensor();
+  }
+
+  if (pinAllocDone) {
+    PinManagerPinType pins[2] = { { i2c_sda, true }, { i2c_scl, true } };
+    pinManager.deallocateMultiplePins(pins, 2, PinOwner::HW_I2C);
+    pinAllocDone = false;
+  }
+
+  enabled = false;
+}
+
+/**
+ * Checks if the SHT sensor has been initialised.
+  *
+ * @return bool
+ */
+bool ShtUsermod::isShtReady()
+{
+  return shtInitDone;
+}
+
+/**
+ * Publish temperature and humidity to WLED device topic.
+ *
+ * Will add a "/temperature" and "/humidity" topic to the WLED device topic.
+ * Temperature will be written in configured unit.
+ *
+ * @return void
+ */
+void ShtUsermod::publishTemperatureAndHumidityViaMqtt() {
+  if (!WLED_MQTT_CONNECTED) return;
+  char buf[128];
+
+  snprintf_P(buf, 127, PSTR("%s/temperature"), mqttDeviceTopic);
+  mqtt->publish(buf, 0, false, String((unitOfTemp ? getTemperatureF() : getTemperatureC())).c_str());
+  snprintf_P(buf, 127, PSTR("%s/humidity"), mqttDeviceTopic);
+  mqtt->publish(buf, 0, false, String(shtCurrentHumidity).c_str());
+}
+
+/**
+ * If enabled, publishes HA MQTT device discovery topics.
+ *
+ * Will make Home Assistant add temperature and humidity as entities automatically.
+ *
+ * Note: Whenever usermods are part of the WLED integration in HA, this can be dropped.
+ *
+ * @return void
+ */
+void ShtUsermod::publishHomeAssistantAutodiscovery() {
+  if (!WLED_MQTT_CONNECTED) return;
+
+  char json_str[1024], buf[128];
+  size_t payload_size;
+  StaticJsonDocument<1024> json;
+
+  snprintf_P(buf, 127, PSTR("%s Temperature"), serverDescription);
+  json[F("name")] = buf;
+  snprintf_P(buf, 127, PSTR("%s/temperature"), mqttDeviceTopic);
+  json[F("stat_t")] = buf;
+  json[F("dev_cla")] = F("temperature");
+  json[F("stat_cla")] = F("measurement");
+  snprintf_P(buf, 127, PSTR("%s-temperature"), escapedMac.c_str());
+  json[F("uniq_id")] = buf;
+  json[F("unit_of_meas")] = F("°C");
+  appendDeviceToMqttDiscoveryMessage(json);
+  payload_size = serializeJson(json, json_str);
+  snprintf_P(buf, 127, PSTR("homeassistant/sensor/%s/%s-temperature/config"), escapedMac.c_str(), escapedMac.c_str());
+  mqtt->publish(buf, 0, true, json_str, payload_size);
+
+  json.clear();
+
+  snprintf_P(buf, 127, PSTR("%s Humidity"), serverDescription);
+  json[F("name")] = buf;
+  snprintf_P(buf, 127, PSTR("%s/humidity"), mqttDeviceTopic);
+  json[F("stat_t")] = buf;
+  json[F("dev_cla")] = F("humidity");
+  json[F("stat_cla")] = F("measurement");
+  snprintf_P(buf, 127, PSTR("%s-humidity"), escapedMac.c_str());
+  json[F("uniq_id")] = buf;
+  json[F("unit_of_meas")] = F("%");
+  appendDeviceToMqttDiscoveryMessage(json);
+  payload_size = serializeJson(json, json_str);
+  snprintf_P(buf, 127, PSTR("homeassistant/sensor/%s/%s-humidity/config"), escapedMac.c_str(), escapedMac.c_str());
+  mqtt->publish(buf, 0, true, json_str, payload_size);
+
+  haMqttDiscoveryDone = true;
+}
+
+/**
+ * Helper to add device information to MQTT discovery topic.
+ *
+ * @return void
+ */
+void ShtUsermod::appendDeviceToMqttDiscoveryMessage(JsonDocument& root) {
+  JsonObject device = root.createNestedObject("dev");
+  device[F("ids")] = escapedMac.c_str();
+  device[F("name")] = serverDescription;
+  device[F("sw")] = versionString;
+  device[F("mdl")] = ESP.getChipModel();
+  device[F("mf")] = F("espressif");
+}
+
+/**
+ * Setup the mod.
+ *
+ * Allocates i2c pins as PinOwner::HW_I2C, so they can be allocated multiple times.
+ * And calls ::initShtTempHumiditySensor() to initialise the sensor.
+ *
+ * @see Usermod::setup()
+ * @see UsermodManager::setup()
+ *
+ * @return void
+ */
+void ShtUsermod::setup()
+{
+  if (enabled) {
+    PinManagerPinType pins[2] = { { i2c_sda, true }, { i2c_scl, true } };
+    // GPIOs can be set to -1 and allocateMultiplePins() will return true, so check they're gt zero
+    if (i2c_sda < 0 || i2c_scl < 0 || !pinManager.allocateMultiplePins(pins, 2, PinOwner::HW_I2C)) {
+      DEBUG_PRINTF("[%s] SHT pin allocation failed!\n", _name);
+      cleanup();
+      return;
+    }
+    pinAllocDone = true;
+
+    initShtTempHumiditySensor();
+
+    initDone = true;
+  }
+
+  firstRunDone = true;
+}
+
+/**
+ * Actually reading data (async) from the sensor every 30 seconds.
+ *
+ * If last reading is at least 30 seconds, it will trigger a reading using
+ * SHT::requestData(). We will then continiously check SHT::dataReady() if
+ * data is ready to be read. If so, it's read, stored locally and published
+ * via MQTT.
+ *
+ * @see Usermod::loop()
+ * @see UsermodManager::loop()
+ *
+ * @return void
+ */
+void ShtUsermod::loop()
+{
+  if (!enabled || !initDone || strip.isUpdating()) return;
+
+  if (isShtReady()) {
+    if (millis() - shtLastTimeUpdated > 30000 && !shtDataRequested) {
+      shtTempHumidSensor->requestData();
+      shtDataRequested = true;
+
+      shtLastTimeUpdated = millis();
+    }
+
+    if (shtDataRequested) {
+      if (shtTempHumidSensor->dataReady()) {
+        if (shtTempHumidSensor->readData(false)) {
+          shtCurrentTempC = shtTempHumidSensor->getTemperature();
+          shtCurrentTempF = shtTempHumidSensor->getFahrenheit();
+          shtCurrentHumidity = shtTempHumidSensor->getHumidity();
+
+          publishTemperatureAndHumidityViaMqtt();
+          shtReadDataSuccess = true;
+        }
+        else {
+          shtReadDataSuccess = false;
+        }
+
+        shtDataRequested = false;
+      }
+    }
+  }
+}
+
+/**
+ * Whenever MQTT is connected, publish HA autodiscovery topics.
+ *
+ * Is only donce once.
+ *
+ * @see Usermod::onMqttConnect()
+ * @see UsermodManager::onMqttConnect()
+ *
+ * @return void
+ */
+void ShtUsermod::onMqttConnect(bool sessionPresent) {
+  if (haMqttDiscovery && !haMqttDiscoveryDone) publishHomeAssistantAutodiscovery();
+}
+
+/**
+ * Add dropdown for sensor type and unit to UM config page.
+ *
+ * @see Usermod::appendConfigData()
+ * @see UsermodManager::appendConfigData()
+ *
+ * @return void
+ */
+void ShtUsermod::appendConfigData() {
+  oappend(SET_F("dd=addDropdown('"));
+  oappend(_name);
+  oappend(SET_F("','"));
+  oappend(_shtType);
+  oappend(SET_F("');"));
+  oappend(SET_F("addOption(dd,'SHT30',0);"));
+  oappend(SET_F("addOption(dd,'SHT31',1);"));
+  oappend(SET_F("addOption(dd,'SHT35',2);"));
+  oappend(SET_F("addOption(dd,'SHT85',3);"));
+  oappend(SET_F("dd=addDropdown('"));
+  oappend(_name);
+  oappend(SET_F("','"));
+  oappend(_unitOfTemp);
+  oappend(SET_F("');"));
+  oappend(SET_F("addOption(dd,'Celsius',0);"));
+  oappend(SET_F("addOption(dd,'Fahrenheit',1);"));
+}
+
+/**
+ * Add config data to be stored in cfg.json.
+ *
+ * @see Usermod::addToConfig()
+ * @see UsermodManager::addToConfig()
+ *
+ * @return void
+ */
+void ShtUsermod::addToConfig(JsonObject &root)
+{
+  JsonObject top = root.createNestedObject(FPSTR(_name)); // usermodname
+
+  top[FPSTR(_enabled)] = enabled;
+  top[FPSTR(_shtType)] = shtType;
+  top[FPSTR(_unitOfTemp)] = unitOfTemp;
+  top[FPSTR(_haMqttDiscovery)] = haMqttDiscovery;
+}
+
+/**
+ * Apply config on boot or save of UM config page.
+ *
+ * This is called whenever WLED boots and loads cfg.json, or when the UM config
+ * page is saved. Will properly re-instantiate the SHT class upon type change and
+ * publish HA discovery after enabling.
+ *
+ * @see Usermod::readFromConfig()
+ * @see UsermodManager::readFromConfig()
+ *
+ * @return bool
+ */
+bool ShtUsermod::readFromConfig(JsonObject &root)
+{
+  JsonObject top = root[FPSTR(_name)];
+  if (top.isNull()) {
+    DEBUG_PRINTF("[%s] No config found. (Using defaults.)\n", _name);
+    return false;
+  }
+
+  bool oldEnabled = enabled;
+  byte oldShtType = shtType;
+  bool oldHaMqttDiscovery = haMqttDiscovery;
+
+  getJsonValue(top[FPSTR(_enabled)], enabled);
+  getJsonValue(top[FPSTR(_shtType)], shtType);
+  getJsonValue(top[FPSTR(_unitOfTemp)], unitOfTemp);
+  getJsonValue(top[FPSTR(_haMqttDiscovery)], haMqttDiscovery);
+
+  // First run: reading from cfg.json, nothing to do here, will be all done in setup()
+  if (!firstRunDone) {
+    DEBUG_PRINTF("[%s] First run, nothing to do\n", _name);
+  }
+  // Check if mod has been en-/disabled
+  else if (enabled != oldEnabled) {
+    enabled ? setup() : cleanup();
+    DEBUG_PRINTF("[%s] Usermod has been en-/disabled\n", _name);
+  }
+  // Config has been changed, so adopt to changes
+  else if (enabled) {
+    if (oldShtType != shtType) {
+      cleanupShtTempHumiditySensor();
+      initShtTempHumiditySensor();
+    }
+
+    if (oldHaMqttDiscovery != haMqttDiscovery && haMqttDiscovery) {
+      publishHomeAssistantAutodiscovery();
+    }
+
+    DEBUG_PRINTF("[%s] Config (re)loaded\n", _name);
+  }
+
+  return true;
+}
+
+/**
+ * Adds the temperature and humidity actually to the info section and /json info.
+ *
+ * This is called every time the info section is opened ot /json is called.
+ *
+ * @see Usermod::addToJsonInfo()
+ * @see UsermodManager::addToJsonInfo()
+ *
+ * @return void
+ */
+void ShtUsermod::addToJsonInfo(JsonObject& root)
+{
+  if (!enabled && !isShtReady()) {
+    return;
+  }
+
+  JsonObject user = root["u"];
+  if (user.isNull()) user = root.createNestedObject("u");
+
+  JsonArray jsonTemp = user.createNestedArray(F("Temperature"));
+  JsonArray jsonHumidity = user.createNestedArray(F("Humidity"));
+
+  if (shtLastTimeUpdated == 0 || !shtReadDataSuccess) {
+    jsonTemp.add(0);
+    jsonHumidity.add(0);
+    if (shtLastTimeUpdated == 0) {
+      jsonTemp.add(F(" Not read yet"));
+      jsonHumidity.add(F(" Not read yet"));
+    }
+    else {
+      jsonTemp.add(F(" Error"));
+      jsonHumidity.add(F(" Error"));
+    }
+
+    return;
+  }
+
+  jsonHumidity.add(shtCurrentHumidity);
+  jsonHumidity.add(F(" RH"));
+
+  unitOfTemp ? jsonTemp.add(getTemperatureF()) : jsonTemp.add(getTemperatureC());
+  unitOfTemp ? jsonTemp.add(F(" °F")) : jsonTemp.add(F(" °C"));
+}
+
+/**
+ * Getter for last read temperature in Celsius.
+ *
+ * @return float
+ */
+float ShtUsermod::getTemperatureC() {
+  return shtCurrentTempC;
+}
+
+/**
+ * Getter for last read temperature in Fahrenheit.
+ *
+ * @return float
+ */
+float ShtUsermod::getTemperatureF() {
+  return shtCurrentTempF;
+}
+
+/**
+ * Getter for last read humidity in RH%.
+ *
+ * @return float
+ */
+float ShtUsermod::getHumidity() {
+  return shtCurrentHumidity;
+}
\ No newline at end of file
diff --git a/usermods/smartnest/readme.md b/usermods/smartnest/readme.md
index c56f3621..5c3ef807 100644
--- a/usermods/smartnest/readme.md
+++ b/usermods/smartnest/readme.md
@@ -1,6 +1,6 @@
 # Smartnest
 
-This usermod-v2 modification allows integration with `smartnest.cz` service which provides MQTT integration with voice assistants.
+Enables integration with `smartnest.cz` service which provides MQTT integration with voice assistants.
 In order to setup Smartnest follow the [documentation](https://www.docu.smartnest.cz/).
 
 ## MQTT API
@@ -49,7 +49,7 @@ void registerUsermods()
 
 ## Configuration
 
-Usermod has no configuration but relies on the MQTT configuration.\
+Usermod has no configuration, but it relies on the MQTT configuration.\
 Under Config > Sync Interfaces > MQTT:
 * Enable MQTT check box
 * Set the `Broker` field to: `smartnest.cz`
diff --git a/usermods/stairway_wipe_basic/readme.md b/usermods/stairway_wipe_basic/readme.md
index 632b7d85..35bc0d41 100644
--- a/usermods/stairway_wipe_basic/readme.md
+++ b/usermods/stairway_wipe_basic/readme.md
@@ -2,13 +2,13 @@
 
 Quick usermod to accomplish something similar to [this video](https://www.youtube.com/watch?v=NHkju5ncC4A).
 
-This usermod allows you to add a lightstrip alongside or on the steps of a staircase.
+This usermod enables you to add a lightstrip alongside or on the steps of a staircase.
 When the `userVar0` variable is set, the LEDs will gradually turn on in a Wipe effect.
 Both directions are supported by setting userVar0 to 1 and 2, respectively (HTTP API commands `U0=1` and `U0=2`).
 
-After the Wipe is complete, the light will either stay on (Solid effect) indefinitely or after `userVar1` seconds have elapsed.
-If userVar0 is updated (e.g. by triggering a second sensor) the light will slowly fade off.
-This could be extended to also run a Wipe effect in reverse order to turn the LEDs back off.
+After the Wipe is complete, the light will either stay on (Solid effect) indefinitely or extinguish after `userVar1` seconds have elapsed.
+If userVar0 is updated (e.g. by triggering a second sensor) the light will fade slowly until it's off.
+This could be extended to also run a Wipe effect in reverse order to turn the LEDs off.
 
 This is just a basic version to accomplish this using HTTP API calls `U0` and `U1` and/or macros.
-It should be easy to adapt this code however to interface with motion sensors or other input devices.
\ No newline at end of file
+It should be easy to adapt this code to interface with motion sensors or other input devices.
diff --git a/usermods/usermod_rotary_brightness_color/README.md b/usermods/usermod_rotary_brightness_color/README.md
index 9d59a0ba..06a3a0f8 100644
--- a/usermods/usermod_rotary_brightness_color/README.md
+++ b/usermods/usermod_rotary_brightness_color/README.md
@@ -1,18 +1,18 @@
 # Rotary Encoder (Brightness and Color)
 
-V2 usermod that allows changing brightness and color using a rotary encoder, 
+V2 usermod that enables changing brightness and color using a rotary encoder 
 change between modes by pressing a button (many encoders have one included)
 
-but it will wait for AUTOSAVE_SETTLE_MS milliseconds, a "settle" 
+it will wait for AUTOSAVE_SETTLE_MS milliseconds. a "settle" 
 period in case there are other changes (any change will 
-extend the "settle" window).
+extend the "settle" period).
 
 It will additionally load preset AUTOSAVE_PRESET_NUM at startup.
 during the first `loop()`.  Reasoning below.
 
 AutoSaveUsermod is standalone, but if FourLineDisplayUsermod is installed, it will notify the user of the saved changes.
 
-Note: I don't love that WLED doesn't respect the brightness of the preset being auto loaded, so the AutoSaveUsermod will set the AUTOSAVE_PRESET_NUM preset in the first loop, so brightness IS honored. This means WLED will effectively ignore Default brightness and Apply N preset at boot when the AutoSaveUsermod is installed.
+Note: WLED doesn't respect the brightness of the preset being auto loaded, so the AutoSaveUsermod will set the AUTOSAVE_PRESET_NUM preset in the first loop, so brightness IS honored. This means WLED will effectively ignore Default brightness and Apply N preset at boot when the AutoSaveUsermod is installed.
 
 ## Installation
 
diff --git a/usermods/usermod_v2_auto_save/readme.md b/usermods/usermod_v2_auto_save/readme.md
index 8d00fcca..f54d87a7 100644
--- a/usermods/usermod_v2_auto_save/readme.md
+++ b/usermods/usermod_v2_auto_save/readme.md
@@ -9,13 +9,13 @@ to preset number AUTOSAVE_PRESET_NUM after a change to any of:
 * palette
 
 but it will wait for AUTOSAVE_AFTER_SEC seconds,
-a "settle" period in case there are other changes (any change will extend the "settle" window).
+a "settle" period in case there are other changes (any change will extend the "settle" period).
 
 It will additionally load preset AUTOSAVE_PRESET_NUM at startup during the first `loop()`.
 
 AutoSaveUsermod is standalone, but if FourLineDisplayUsermod is installed, it will notify the user of the saved changes.
 
-Note: I don't love that WLED doesn't respect the brightness of the preset being auto loaded, so the AutoSaveUsermod will set the AUTOSAVE_PRESET_NUM preset in the first loop, so brightness IS honored. This means WLED will effectively ignore Default brightness and Apply N preset at boot when the AutoSaveUsermod is installed.
+Note: WLED doesn't respect the brightness of the preset being auto loaded, so the AutoSaveUsermod will set the AUTOSAVE_PRESET_NUM preset in the first loop, so brightness IS honored. This means WLED will effectively ignore Default brightness and Apply N preset at boot when the AutoSaveUsermod is installed.
 
 ## Installation
 
@@ -25,7 +25,7 @@ This file should be placed in the same directory as `platformio.ini`.
 
 ### Define Your Options
 
-* `USERMOD_AUTO_SAVE`           - define this to have this the Auto Save usermod included wled00\usermods_list.cpp
+* `USERMOD_AUTO_SAVE`           - define this to have this usermod included wled00\usermods_list.cpp
 * `AUTOSAVE_AFTER_SEC`          - define the delay time after the settings auto-saving routine should be executed
 * `AUTOSAVE_PRESET_NUM`         - define the preset number used by autosave usermod
 * `USERMOD_AUTO_SAVE_ON_BOOT`   - define if autosave should be enabled on boot
@@ -52,4 +52,4 @@ Note: the Four Line Display usermod requires the libraries `U8g2` and `Wire`.
 2021-02
 * First public release
 2021-04
-* Adaptation for runtime configuration.
\ No newline at end of file
+* Adaptation for runtime configuration.
diff --git a/usermods/usermod_v2_four_line_display/readme.md b/usermods/usermod_v2_four_line_display/readme.md
index 47518be9..26250cb5 100644
--- a/usermods/usermod_v2_four_line_display/readme.md
+++ b/usermods/usermod_v2_four_line_display/readme.md
@@ -2,9 +2,9 @@
 
 First, thanks to the authors of the ssd11306_i2c_oled_u8g2 mod.
 
-This usermod provides a four line display using either
+Provides a four line display using either
 128x32 or 128x64 OLED displays.
-It's can operate independently, but starts to provide
+It can operate independently, but starts to provide
 a relatively complete on-device UI when paired with the 
 Rotary Encoder UI usermod. I strongly encourage you to use 
 them together.
@@ -19,11 +19,11 @@ This file should be placed in the same directory as `platformio.ini`.
 
 ### Define Your Options
 
-* `USERMOD_FOUR_LINE_DISPLAY`  - define this to have this the Four Line Display mod included wled00\usermods_list.cpp - also tells Rotary Encoder usermod, if installed, that the display is available
+* `USERMOD_FOUR_LINE_DISPLAY`  - define this to have this mod included wled00\usermods_list.cpp - also tells Rotary Encoder usermod, if installed, the display is available
 * `FLD_PIN_SCL`                - The display SCL pin, defaults to 5
 * `FLD_PIN_SDA`                - The display SDA pin, defaults to 4
 
-All of the parameters can be configured using Usermods settings page, inluding GPIO pins.
+All of the parameters can be configured via the Usermods settings page, inluding GPIO pins.
 
 ### PlatformIO requirements
 
@@ -44,7 +44,7 @@ UI usermod folder for how to include these using `platformio_override.ini`.
     * 6 = SPI SSD1306 128x32
     * 7 = SPI SSD1306 128x64 (4 double-height lines)
 * `contrast` - set display contrast (higher contrast may reduce display lifetime)
-* `refreshRateSec` - time in seconds for display refresh
+* `refreshRateSec` - display refresh time in seconds
 * `screenTimeOutSec` - screen saver time-out in seconds
 * `flip` - flip/rotate display 180°
 * `sleepMode` - enable/disable screen saver
@@ -60,4 +60,4 @@ UI usermod folder for how to include these using `platformio_override.ini`.
 * Adaptation for runtime configuration.
 
 2021-11
-* Added configuration option description.
\ No newline at end of file
+* Added configuration option description.
diff --git a/usermods/usermod_v2_four_line_display_ALT/readme.md b/usermods/usermod_v2_four_line_display_ALT/readme.md
index 67cde353..ea9f4361 100644
--- a/usermods/usermod_v2_four_line_display_ALT/readme.md
+++ b/usermods/usermod_v2_four_line_display_ALT/readme.md
@@ -4,12 +4,12 @@ Thank you to the authors of the original version of these usermods. It would not
 "usermod_v2_four_line_display"
 "usermod_v2_rotary_encoder_ui"
 
-The core of these usermods are a copy of the originals. The main changes are done to the FourLineDisplay usermod.
+The core of these usermods are a copy of the originals. The main changes are to the FourLineDisplay usermod.
 The display usermod UI has been completely changed.
 
 
 The changes made to the RotaryEncoder usermod were made to support the new UI in the display usermod. 
-Without the display it functions identical to the original.
+Without the display it, functions identical to the original.
 The original "usermod_v2_auto_save" will not work with the display just yet.
 
 Press the encoder to cycle through the options:
@@ -22,7 +22,7 @@ Press the encoder to cycle through the options:
     *Saturation (only if display is used)
 
 Press and hold the encoder to display Network Info
-    if AP is active then it will display AP ssid and Password
+    if AP is active, it will display AP, SSID and password
 
 Also shows if the timer is enabled
 
@@ -42,4 +42,4 @@ Note: the Four Line Display usermod requires the libraries `U8g2` and `Wire`.
 ## Change Log
 
 2021-10
-* First public release
\ No newline at end of file
+* First public release
diff --git a/usermods/usermod_v2_mode_sort/readme.md b/usermods/usermod_v2_mode_sort/readme.md
index b4fe90e7..c24322f3 100644
--- a/usermods/usermod_v2_mode_sort/readme.md
+++ b/usermods/usermod_v2_mode_sort/readme.md
@@ -8,26 +8,26 @@ palettes to other usermods. Notably it provides:
 
 ```char **getModesQStrings()```
 
-Provides an array of char* (pointers) to the names of the
-palettes within JSON_mode_names, in the same order as 
+Provides a char* array (pointers) to the names of the
+palettes contained in JSON_mode_names, in the same order as 
 JSON_mode_names. These strings end in double quote (")
 (or \0 if there is a problem).
 
 ```byte *getModesAlphaIndexes()```
 
-An array of byte designating the indexes of names of the
+A byte array designating the indexes of names of the
 modes in alphabetical order. "Solid" will always remain 
-at the front of the list.
+at the top of the list.
 
 ```char **getPalettesQStrings()```
 
-Provides an array of char* (pointers) to the names of the
-palettes within JSON_palette_names, in the same order as 
+Provides a char* array (pointers) to the names of the
+palettes contained in JSON_palette_names, in the same order as 
 JSON_palette_names. These strings end in double quote (")
 (or \0 if there is a problem).
 
 ```byte *getPalettesAlphaIndexes()```
 
-An array of byte designating the indexes of names of the
+A byte array designating the indexes of names of the
 palettes in alphabetical order. "Default" and those
-starting with "(" will always remain at the front of the list.
+starting with "(" will always remain at the top of the list.
diff --git a/usermods/usermod_v2_ping_pong_clock/readme.md b/usermods/usermod_v2_ping_pong_clock/readme.md
index 8731222f..9f01b3eb 100644
--- a/usermods/usermod_v2_ping_pong_clock/readme.md
+++ b/usermods/usermod_v2_ping_pong_clock/readme.md
@@ -1,8 +1,10 @@
 # Ping Pong LED Clock
 
-This Usermod File contains a modification to use WLED in combination with the Ping Pong Ball LED Clock as built in [Instructables](https://www.instructables.com/Ping-Pong-Ball-LED-Clock/).
+Contains a modification to use WLED in combination with the Ping Pong Ball LED Clock as built in [Instructables](https://www.instructables.com/Ping-Pong-Ball-LED-Clock/).
 
 ## Installation 
 
-To install this Usermod you instruct PlatformIO to compile the Projekt with the USERMOD_PING_PONG_CLOCK flag. WLED then automatically provides you with various settings in the Usermod Page to configure this Usermod.    
-Note: If your clock is bigger or smaller then mine, you may have to update the led indices for the indivdual numbers and the base indices.
+To install this Usermod, you instruct PlatformIO to compile the Project with the USERMOD_PING_PONG_CLOCK flag.
+WLED then automatically provides you with various settings on the Usermod Page.
+
+Note: Depending on the size of your clock, you may have to update the led indices for the indivdual numbers and the base indices.
diff --git a/usermods/usermod_v2_rotary_encoder_ui/readme.md b/usermods/usermod_v2_rotary_encoder_ui/readme.md
index b5a8a924..5e4f3cff 100644
--- a/usermods/usermod_v2_rotary_encoder_ui/readme.md
+++ b/usermods/usermod_v2_rotary_encoder_ui/readme.md
@@ -20,10 +20,10 @@ This file should be placed in the same directory as `platformio.ini`.
 * `USERMOD_FOUR_LINE_DISPLAY`       - define this to have this the Four Line Display mod included wled00\usermods_list.cpp
                                         also tells this usermod that the display is available
                                         (see the Four Line Display usermod `readme.md` for more details)
-* `ENCODER_DT_PIN`                  - The encoders DT pin, defaults to 12
-* `ENCODER_CLK_PIN`                 - The encoders CLK pin, defaults to 14
-* `ENCODER_SW_PIN`                  - The encoders SW pin, defaults to 13
-* `USERMOD_ROTARY_ENCODER_GPIO`     - The GPIO functionality:
+* `ENCODER_DT_PIN`                    - defaults to 12
+* `ENCODER_CLK_PIN`                 - defaults to 14
+* `ENCODER_SW_PIN`                    - defaults to 13
+* `USERMOD_ROTARY_ENCODER_GPIO`     - GPIO functionality:
                                         `INPUT_PULLUP` to use internal pull-up
                                         `INPUT` to use pull-up on the PCB
 
diff --git a/usermods/usermod_v2_rotary_encoder_ui_ALT/readme.md b/usermods/usermod_v2_rotary_encoder_ui_ALT/readme.md
index a140f25b..51636238 100644
--- a/usermods/usermod_v2_rotary_encoder_ui_ALT/readme.md
+++ b/usermods/usermod_v2_rotary_encoder_ui_ALT/readme.md
@@ -4,12 +4,12 @@ Thank you to the authors of the original version of these usermods. It would not
 "usermod_v2_four_line_display"
 "usermod_v2_rotary_encoder_ui"
 
-The core of these usermods are a copy of the originals. The main changes are done to the FourLineDisplay usermod.
+The core of these usermods are a copy of the originals. The main changes are to the FourLineDisplay usermod.
 The display usermod UI has been completely changed.
 
 
 The changes made to the RotaryEncoder usermod were made to support the new UI in the display usermod. 
-Without the display it functions identical to the original.
+Without the display, it functions identical to the original.
 The original "usermod_v2_auto_save" will not work with the display just yet.
 
 Press the encoder to cycle through the options:
@@ -22,17 +22,17 @@ Press the encoder to cycle through the options:
     *Saturation (only if display is used)
 
 Press and hold the encoder to display Network Info
-    if AP is active then it will display AP ssid and Password
+    if AP is active, it will display the AP, SSID and Password
 
-Also shows if the timer is enabled
+Also shows if the timer is enabled.
 
 [See the pair of usermods in action](https://www.youtube.com/watch?v=ulZnBt9z3TI)
 
 ## Installation
 
-Please refer to the original `usermod_v2_rotary_encoder_ui` readme for the main instructions
-Then to activate this alternative usermod add `#define USE_ALT_DISPlAY` to the `usermods_list.cpp` file,
-                                        or add `-D USE_ALT_DISPlAY` to the original `platformio_override.ini.sample` file
+Please refer to the original `usermod_v2_rotary_encoder_ui` readme for the main instructions.
+To activate this alternative usermod, add `#define USE_ALT_DISPlAY` to the `usermods_list.cpp` file, +or add `-D USE_ALT_DISPlAY` to the original `platformio_override.ini.sample` file. ### PlatformIO requirements @@ -42,4 +42,4 @@ Note: the Four Line Display usermod requires the libraries `U8g2` and `Wire`. ## Change Log 2021-10 -* First public release \ No newline at end of file +* First public release diff --git a/usermods/usermod_v2_rotary_encoder_ui_ALT/usermod_v2_rotary_encoder_ui_ALT.h b/usermods/usermod_v2_rotary_encoder_ui_ALT/usermod_v2_rotary_encoder_ui_ALT.h index b5aed94d..35d3e6f3 100644 --- a/usermods/usermod_v2_rotary_encoder_ui_ALT/usermod_v2_rotary_encoder_ui_ALT.h +++ b/usermods/usermod_v2_rotary_encoder_ui_ALT/usermod_v2_rotary_encoder_ui_ALT.h @@ -750,7 +750,7 @@ public: StaticJsonDocument<64> root; char str[64]; sprintf_P(str, PSTR("%d~%d~%s"), presetLow, presetHigh, increase?"":"-"); - root[F("ps")] = str; + root["ps"] = str; deserializeState(root.as(), CALL_MODE_BUTTON_PRESET); /* String apireq = F("win&PL=~"); diff --git a/usermods/usermod_v2_word_clock/readme.md b/usermods/usermod_v2_word_clock/readme.md index 7b81582f..1dde2223 100644 --- a/usermods/usermod_v2_word_clock/readme.md +++ b/usermods/usermod_v2_word_clock/readme.md @@ -1,8 +1,8 @@ # Word Clock Usermod V2 -This usermod can be used to drive a wordclock with a 11x10 pixel matrix with WLED. There are also 4 additional dots for the minutes. -The visualisation is desribed in 4 mask with LED numbers (single dots for minutes, minutes, hours and "clock/Uhr"). The index of the LEDs in the masks always starts with the index 0, even if the ledOffset is not 0. -There are 3 parameters to change the behaviour: +This usermod drives an 11x10 pixel matrix wordclock with WLED. There are 4 additional dots for the minutes. +The visualisation is described by 4 masks with LED numbers (single dots for minutes, minutes, hours and "clock"). The index of the LEDs in the masks always starts at 0, even if the ledOffset is not 0. +There are 3 parameters that control behavior: active: enable/disable usermod diplayItIs: enable/disable display of "Es ist" on the clock @@ -10,23 +10,23 @@ ledOffset: number of LEDs before the wordclock LEDs ### Update for alternatative wiring pattern Based on this fantastic work I added an alternative wiring pattern. -For original you have to use a long wire to connect DO - DI from first line to the next line. +The original used a long wire to connect DO to DI, from one line to the next line. -I wired my clock in meander style. So the first LED in second line is in the right. -With this problem every second line was inverted and showed the wrong letter. +I wired my clock in meander style. So the first LED in the second line is on the right. +With this method, every other line was inverted and showed the wrong letter. -I added a switch in usermod called "meander wiring?" to enable/disable alternativ wiring pattern. +I added a switch in usermod called "meander wiring?" to enable/disable the alternate wiring pattern. ## Installation Copy and update the example `platformio_override.ini.sample` -from the Rotary Encoder UI usermode folder to the root directory of your particular build. +from the Rotary Encoder UI usermod folder to the root directory of your particular build. This file should be placed in the same directory as `platformio.ini`. ### Define Your Options -* `USERMOD_WORDCLOCK` - define this to have this the Auto Save usermod included wled00\usermods_list.cpp +* `USERMOD_WORDCLOCK` - define this to have this usermod included wled00\usermods_list.cpp ### PlatformIO requirements diff --git a/usermods/wizlights/readme.md b/usermods/wizlights/readme.md index 802a3798..a0e0a8b8 100644 --- a/usermods/wizlights/readme.md +++ b/usermods/wizlights/readme.md @@ -1,6 +1,6 @@ # Controlling Wiz lights -This usermod allows the control of [WiZ](https://www.wizconnected.com/en/consumer/) lights that are in the same network as the WLED controller. +Enabless controlling [WiZ](https://www.wizconnected.com/en/consumer/) lights that are part of the same network as the WLED controller. The mod takes the colors from the first few pixels and sends them to the lights. @@ -8,22 +8,22 @@ The mod takes the colors from the first few pixels and sends them to the lights. - Interval (ms) - How frequently to update the WiZ lights, in milliseconds. - - Setting too low may causse ESP to become unresponsive. + - Setting it too low may causse the ESP to become unresponsive. - Send Delay (ms) - An optional millisecond delay after updating each WiZ light. - - Can help smooth out effects when using a larger number of WiZ lights + - Can help smooth out effects when using a large number of WiZ lights - Use Enhanced White - - Enables using the WiZ lights onboard white LEDs instead of sending maximum RGB values. + - Uses the WiZ lights onboard white LEDs instead of sending maximum RGB values. - Tunable with warm and cool LEDs as supported by WiZ bulbs - - Note: Only sent when max RGB value is set, need to have automatic brightness limiter disabled - - ToDo: Have better logic for white value mixing to better take advantage of the lights capabilities + - Note: Only sent when max RGB value is set, the automatic brightness limiter must be disabled + - ToDo: Have better logic for white value mixing to take advantage of the light's capabilities - Always Force Update - - Can be enabled to always send update message to light, even when color matches what was previously sent. + - Can be enabled to always send update message to light even if the new value matches the old value. - Force update every x minutes - - Configuration option to allow adjusting the default force update timeout of 5 minutes. - - Setting to 0 has the same impact as enabling Always Force Update + - adjusts the default force update timeout of 5 minutes. + - Setting to 0 is the same as enabling Always Force Update - -Then enter the IPs for the lights to be controlled, in order. There is currently a limit of 15 devices that can be controled, but that number +Next, enter the IP addresses for the lights to be controlled, in order. The limit is 15 devices, but that number can be easily changed by updating _MAX_WIZ_LIGHTS_. @@ -31,5 +31,5 @@ can be easily changed by updating _MAX_WIZ_LIGHTS_. ## Related project -If you use these lights and python, make sure to check out the [pywizlight](https://github.com/sbidy/pywizlight) project. I learned how to +If you use these lights and python, make sure to check out the [pywizlight](https://github.com/sbidy/pywizlight) project. You can learn how to format the messages to control the lights from that project. diff --git a/usermods/wizlights/wizlights.h b/usermods/wizlights/wizlights.h index c588f00e..08d20493 100644 --- a/usermods/wizlights/wizlights.h +++ b/usermods/wizlights/wizlights.h @@ -75,6 +75,10 @@ class WizLightsUsermod : public Usermod { UDP.endPacket(); } + // Override definition so it compiles + void setup() { + + } // TODO: Check millis() rollover diff --git a/usermods/word-clock-matrix/readme.md b/usermods/word-clock-matrix/readme.md index eb68f515..cfaa93e2 100644 --- a/usermods/word-clock-matrix/readme.md +++ b/usermods/word-clock-matrix/readme.md @@ -2,8 +2,8 @@ By @bwente -See https://www.hackster.io/bwente/word-clock-with-just-two-components-073834 for the hardware guide! -Includes a customizable feature to lower the brightness at night. +See https://www.hackster.io/bwente/word-clock-with-just-two-components-073834 for the hardware guide!
+Includes a customizable feature to reduce the brightness at night. ![image](https://user-images.githubusercontent.com/371964/197094071-f8ccaf59-1d85-4dd2-8e09-1389675291e1.png) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index ad8225fd..6a9ed447 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -24,8 +24,8 @@ Modified heavily for WLED */ -#include "FX.h" #include "wled.h" +#include "FX.h" #include "fcn_declare.h" #define IBN 5100 @@ -3483,6 +3483,7 @@ uint16_t mode_tetrix(void) { if (SEGENV.call == 0) { drop->stack = 0; // reset brick stack size drop->step = 0; + if (SEGMENT.check1) drop->col = 0;// use only one color from palette //for (int i=0; ispeed = float(SEGLEN * FRAMETIME) / float(speed); // set speed drop->pos = SEGLEN; // start at end of segment (no need to subtract 1) - drop->col = random8(0,15)<<4; // limit color choices so there is enough HUE gap + if (!SEGMENT.check1) drop->col = random8(0,15)<<4; // limit color choices so there is enough HUE gap drop->step = 1; // drop state (0 init, 1 forming, 2 falling) drop->brick = (SEGMENT.intensity ? (SEGMENT.intensity>>5)+1 : random8(1,5)) * (1+(SEGLEN>>6)); // size of brick } @@ -3508,7 +3509,7 @@ uint16_t mode_tetrix(void) { if (drop->step == 2) { // falling if (drop->pos > drop->stack) { // fall until top of stack drop->pos -= drop->speed; // may add gravity as: speed += gravity - if (uint16_t(drop->pos) < drop->stack) drop->pos = drop->stack; + if (int(drop->pos) < int(drop->stack)) drop->pos = drop->stack; for (int i=int(drop->pos); ipos)+drop->brick ? SEGMENT.color_from_palette(drop->col, false, false, 0) : SEGCOLOR(1); SEGMENT.setPixelColor(indexToVStrip(i, stripNr), col); @@ -3528,6 +3529,7 @@ uint16_t mode_tetrix(void) { } else { drop->stack = 0; // reset brick stack size drop->step = 0; // proceed with next brick + if (SEGMENT.check1) drop->col += 8; // gradually increase palette index } } } @@ -3538,7 +3540,7 @@ uint16_t mode_tetrix(void) { return FRAMETIME; } -static const char _data_FX_MODE_TETRIX[] PROGMEM = "Tetrix@!,Width;!,!;!;;sx=0,ix=0,pal=11,m12=1"; +static const char _data_FX_MODE_TETRIX[] PROGMEM = "Tetrix@!,Width,,,,One color;!,!;!;;sx=0,ix=0,pal=11,m12=1"; /* diff --git a/wled00/FX.h b/wled00/FX.h index 2241bf74..60b1473c 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -369,9 +369,10 @@ typedef struct Segment { uint32_t call; // call counter uint16_t aux0; // custom var uint16_t aux1; // custom var - byte* data; - CRGB* leds; - static CRGB *_globalLeds; + byte* data; // effect data pointer + CRGB* leds; // local leds[] array (may be a pointer to global) + static CRGB *_globalLeds; // global leds[] array + static uint16_t maxWidth, maxHeight; // these define matrix width & height (max. segment dimensions) private: union { @@ -657,8 +658,6 @@ class WS2812FX { // 96 bytes vPanels(1), panelH(8), panelW(8), - matrixWidth(DEFAULT_LED_COUNT), - matrixHeight(1), matrix{0,0,0,0}, panel{{0,0,0,0}}, #endif @@ -814,9 +813,7 @@ class WS2812FX { // 96 bytes uint16_t panelH, - panelW, - matrixWidth, - matrixHeight; + panelW; typedef struct panel_bitfield_t { bool bottomStart : 1; // starts at bottom? diff --git a/wled00/FX_2Dfcn.cpp b/wled00/FX_2Dfcn.cpp index c0c46888..42d2dde0 100644 --- a/wled00/FX_2Dfcn.cpp +++ b/wled00/FX_2Dfcn.cpp @@ -29,8 +29,8 @@ // setUpMatrix() - constructs ledmap array from matrix of panels with WxH pixels // this converts physical (possibly irregular) LED arrangement into well defined // array of logical pixels: fist entry corresponds to left-topmost logical pixel -// followed by horizontal pixels, when matrixWidth logical pixels are added they -// are followed by next row (down) of matrixWidth pixels (and so forth) +// followed by horizontal pixels, when Segment::maxWidth logical pixels are added they +// are followed by next row (down) of Segment::maxWidth pixels (and so forth) // note: matrix may be comprised of multiple panels each with different orientation // but ledmap takes care of that. ledmap is constructed upon initialization // so matrix should disable regular ledmap processing @@ -41,19 +41,20 @@ void WS2812FX::setUpMatrix() { customMappingTable = nullptr; customMappingSize = 0; + // isMatrix is set in cfg.cpp or set.cpp if (isMatrix) { - matrixWidth = hPanels * panelW; - matrixHeight = vPanels * panelH; + Segment::maxWidth = hPanels * panelW; + Segment::maxHeight = vPanels * panelH; // safety check - if (matrixWidth * matrixHeight > MAX_LEDS) { - matrixWidth = _length; - matrixHeight = 1; + if (Segment::maxWidth * Segment::maxHeight > MAX_LEDS || Segment::maxWidth == 1 || Segment::maxHeight == 1) { + Segment::maxWidth = _length; + Segment::maxHeight = 1; isMatrix = false; return; } - customMappingSize = matrixWidth * matrixHeight; + customMappingSize = Segment::maxWidth * Segment::maxHeight; customMappingTable = new uint16_t[customMappingSize]; if (customMappingTable != nullptr) { @@ -69,7 +70,7 @@ void WS2812FX::setUpMatrix() { x = (matrix.vertical ? matrix.bottomStart : matrix.rightStart) ? h - i - 1 : i; x = matrix.serpentine && j%2 ? h - x - 1 : x; - startL = (matrix.vertical ? y : x) * panelW + (matrix.vertical ? x : y) * matrixWidth * panelH; // logical index (top-left corner) + startL = (matrix.vertical ? y : x) * panelW + (matrix.vertical ? x : y) * Segment::maxWidth * panelH; // logical index (top-left corner) startP = p * panelW * panelH; // physical index (top-left corner) uint8_t H = panel[h*j + i].vertical ? panelW : panelH; @@ -79,7 +80,7 @@ void WS2812FX::setUpMatrix() { y = (panel[h*j + i].vertical ? panel[h*j + i].rightStart : panel[h*j + i].bottomStart) ? H - l - 1 : l; x = (panel[h*j + i].vertical ? panel[h*j + i].bottomStart : panel[h*j + i].rightStart) ? W - k - 1 : k; x = (panel[h*j + i].serpentine && l%2) ? (W - x - 1) : x; - offset = (panel[h*j + i].vertical ? y : x) + (panel[h*j + i].vertical ? x : y) * matrixWidth; + offset = (panel[h*j + i].vertical ? y : x) + (panel[h*j + i].vertical ? x : y) * Segment::maxWidth; customMappingTable[startL + offset] = startP + q; } } @@ -88,22 +89,22 @@ void WS2812FX::setUpMatrix() { #ifdef WLED_DEBUG DEBUG_PRINT(F("Matrix ledmap:")); for (uint16_t i=0; i= customMappingSize) return; // customMappingSize is always W * H of matrix in 2D setup #else uint16_t index = x; @@ -126,7 +127,7 @@ void IRAM_ATTR WS2812FX::setPixelColorXY(int x, int y, uint32_t col) // returns RGBW values of pixel uint32_t WS2812FX::getPixelColorXY(uint16_t x, uint16_t y) { #ifndef WLED_DISABLE_2D - uint16_t index = (y * matrixWidth + x); + uint16_t index = (y * Segment::maxWidth + x); if (index >= customMappingSize) return 0; // customMappingSize is always W * H of matrix in 2D setup #else uint16_t index = x; @@ -151,7 +152,7 @@ uint16_t IRAM_ATTR Segment::XY(uint16_t x, uint16_t y) { void IRAM_ATTR Segment::setPixelColorXY(int x, int y, uint32_t col) { - if (!strip.isMatrix) return; // not a matrix set-up + if (Segment::maxHeight==1) return; // not a matrix set-up if (x >= virtualWidth() || y >= virtualHeight() || x<0 || y<0) return; // if pixel would fall out of virtual segment just exit if (leds) leds[XY(x,y)] = col; @@ -198,7 +199,7 @@ void IRAM_ATTR Segment::setPixelColorXY(int x, int y, uint32_t col) // anti-aliased version of setPixelColorXY() void Segment::setPixelColorXY(float x, float y, uint32_t col, bool aa) { - if (!strip.isMatrix) return; // not a matrix set-up + if (Segment::maxHeight==1) return; // not a matrix set-up if (x<0.0f || x>1.0f || y<0.0f || y>1.0f) return; // not normalized const uint16_t cols = virtualWidth(); diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index d33e6349..99284439 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -75,6 +75,8 @@ /////////////////////////////////////////////////////////////////////////////// uint16_t Segment::_usedSegmentData = 0U; // amount of RAM all segments use for their data[] CRGB *Segment::_globalLeds = nullptr; +uint16_t Segment::maxWidth = DEFAULT_LED_COUNT; +uint16_t Segment::maxHeight = 1; // copy constructor Segment::Segment(const Segment &orig) { @@ -192,7 +194,7 @@ void Segment::setUpLeds() { // deallocation happens in resetIfRequired() as it is called when segment changes or in destructor if (Segment::_globalLeds) #ifndef WLED_DISABLE_2D - leds = &Segment::_globalLeds[start + startY*strip.matrixWidth]; // TODO: remove this hack + leds = &Segment::_globalLeds[start + startY*Segment::maxWidth]; #else leds = &Segment::_globalLeds[start]; #endif @@ -497,7 +499,7 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col) if (i >= virtualLength() || i<0) return; // if pixel would fall out of segment just exit #ifndef WLED_DISABLE_2D - if (is2D()) { // if this does not work use strip.isMatrix + if (is2D()) { uint16_t vH = virtualHeight(); // segment height in logical pixels uint16_t vW = virtualWidth(); switch (map1D2D) { @@ -530,7 +532,7 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col) break; } return; - } else if (strip.isMatrix && (width()==1 || height()==1)) { // TODO remove this hack + } else if (Segment::maxHeight!=1 && (width()==1 || height()==1)) { // we have a vertical or horizontal 1D segment (WARNING: virtual...() may be transposed) int x = 0, y = 0; if (virtualHeight()>1) y = i; @@ -618,7 +620,7 @@ uint32_t Segment::getPixelColor(int i) i &= 0xFFFF; #ifndef WLED_DISABLE_2D - if (is2D()) { // if this does not work use strip.isMatrix + if (is2D()) { uint16_t vH = virtualHeight(); // segment height in logical pixels uint16_t vW = virtualWidth(); switch (map1D2D) { @@ -1322,6 +1324,7 @@ void WS2812FX::setSegment(uint8_t n, uint16_t i1, uint16_t i2, uint8_t grouping, // disabled segments should get removed using purgeSegments() DEBUG_PRINT(F("-- Segment ")); DEBUG_PRINT(n); DEBUG_PRINTLN(F(" marked inactive.")); seg.stop = 0; + seg.options = 0b0000000000000101; // on & selected //if (seg.name) { // delete[] seg.name; // seg.name = nullptr; @@ -1333,10 +1336,10 @@ void WS2812FX::setSegment(uint8_t n, uint16_t i1, uint16_t i2, uint8_t grouping, } if (isMatrix) { #ifndef WLED_DISABLE_2D - if (i1 < matrixWidth) seg.start = i1; - seg.stop = i2 > matrixWidth ? matrixWidth : i2; - if (startY < matrixHeight) seg.startY = startY; - seg.stopY = stopY > matrixHeight ? matrixHeight : MAX(1,stopY); + if (i1 < Segment::maxWidth) seg.start = i1; + seg.stop = i2 > Segment::maxWidth ? Segment::maxWidth : i2; + if (startY < Segment::maxHeight) seg.startY = startY; + seg.stopY = stopY > Segment::maxHeight ? Segment::maxHeight : MAX(1,stopY); #endif } else { if (i1 < _length) seg.start = i1; @@ -1360,7 +1363,7 @@ void WS2812FX::restartRuntime() { void WS2812FX::resetSegments() { _segments.clear(); // destructs all Segment as part of clearing #ifndef WLED_DISABLE_2D - segment seg = isMatrix ? Segment(0, matrixWidth, 0, matrixHeight) : Segment(0, _length); + segment seg = isMatrix ? Segment(0, Segment::maxWidth, 0, Segment::maxHeight) : Segment(0, _length); #else segment seg = Segment(0, _length); #endif @@ -1376,9 +1379,9 @@ void WS2812FX::makeAutoSegments(bool forceReset) { else if (getActiveSegmentsNum() == 1) { size_t i = getLastActiveSegmentId(); _segments[i].start = 0; - _segments[i].stop = matrixWidth; + _segments[i].stop = Segment::maxWidth; _segments[i].startY = 0; - _segments[i].stopY = matrixHeight; + _segments[i].stopY = Segment::maxHeight; _segments[i].grouping = 1; _segments[i].spacing = 0; _mainSegment = i; diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 8b920190..d429f716 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -104,7 +104,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { CJSON(strip.matrix.bottomStart, matrix[F("pb")]); CJSON(strip.matrix.rightStart, matrix[F("pr")]); CJSON(strip.matrix.vertical, matrix[F("pv")]); - CJSON(strip.matrix.serpentine, matrix[F("ps")]); + CJSON(strip.matrix.serpentine, matrix["ps"]); JsonArray panels = matrix[F("panels")]; uint8_t s = 0; @@ -203,14 +203,27 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { int8_t pin = btn["pin"][0] | -1; if (pin > -1 && pinManager.allocatePin(pin, false, PinOwner::Button)) { btnPin[s] = pin; - if (disablePullUp) { - pinMode(btnPin[s], INPUT); - } else { - #ifdef ESP32 - pinMode(btnPin[s], buttonType[s]==BTN_TYPE_PUSH_ACT_HIGH ? INPUT_PULLDOWN : INPUT_PULLUP); - #else - pinMode(btnPin[s], INPUT_PULLUP); - #endif + #ifdef ARDUINO_ARCH_ESP32 + // ESP32 only: check that analog button pin is a valid ADC gpio + if (((buttonType[s] == BTN_TYPE_ANALOG) || (buttonType[s] == BTN_TYPE_ANALOG_INVERTED)) && (digitalPinToAnalogChannel(btnPin[s]) < 0)) + { + // not an ADC analog pin + DEBUG_PRINTF("PIN ALLOC error: GPIO%d for analog button #%d is not an analog pin!\n", btnPin[s], s); + btnPin[s] = -1; + pinManager.deallocatePin(pin,PinOwner::Button); + } + else + #endif + { + if (disablePullUp) { + pinMode(btnPin[s], INPUT); + } else { + #ifdef ESP32 + pinMode(btnPin[s], buttonType[s]==BTN_TYPE_PUSH_ACT_HIGH ? INPUT_PULLDOWN : INPUT_PULLUP); + #else + pinMode(btnPin[s], INPUT_PULLUP); + #endif + } } } else { btnPin[s] = -1; @@ -698,7 +711,7 @@ void serializeConfig() { matrix[F("pb")] = strip.matrix.bottomStart; matrix[F("pr")] = strip.matrix.rightStart; matrix[F("pv")] = strip.matrix.vertical; - matrix[F("ps")] = strip.matrix.serpentine; + matrix["ps"] = strip.matrix.serpentine; JsonArray panels = matrix.createNestedArray(F("panels")); for (uint8_t i=0; i
diff --git a/wled00/data/index.js b/wled00/data/index.js index 93881c08..1ba88f95 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -1,6 +1,5 @@ //page js var loc = false, locip; -var noNewSegs = false; var isOn = false, nlA = false, isLv = false, isInfo = false, isNodes = false, syncSend = false, syncTglRecv = true; var hasWhite = false, hasRGB = false, hasCCT = false; var nlDur = 60, nlTar = 0; @@ -17,6 +16,7 @@ var d = document; var palettesData; var fxdata = []; var pJson = {}, eJson = {}, lJson = {}; +var plJson = {}; // array of playlists var pN = "", pI = 0, pNum = 0; var pmt = 1, pmtLS = 0, pmtLast = 0; var lastinfo = {}; @@ -794,18 +794,14 @@ function populateSegments(s) } gId('segcont').innerHTML = cn; - if (lowestUnused >= maxSeg) { - gId('segutil').innerHTML = 'Maximum number of segments reached.'; - noNewSegs = true; - } else if (noNewSegs) { - resetUtil(); - noNewSegs = false; - } + let noNewSegs = (lowestUnused >= maxSeg); + resetUtil(noNewSegs); + if (gId('selall')) gId('selall').checked = true; for (var i = 0; i <= lSeg; i++) { updateLen(i); updateTrail(gId(`seg${i}bri`)); gId(`segr${i}`).style.display = "none"; - if (!gId(`seg${i}sel`).checked) gId(`selall`).checked = false; + if (!gId(`seg${i}sel`).checked && gId('selall')) gId('selall').checked = false; // uncheck if at least one is unselected. } if (segCount < 2) gId(`segd${lSeg}`).style.display = "none"; if (!isM && !noNewSegs && (cfg.comp.seglen?parseInt(gId(`seg${lSeg}s`).value):0)+parseInt(gId(`seg${lSeg}e`).value)` + '' - + '
Add segment
'; + + `
Add segment
`; } -var plJson = {"0":{ - "ps": [0], - "dur": [100], - "transition": [-1], // to be inited to default transition dur - "repeat": 0, - "r": false, - "end": 0 -}}; - -function makePlSel(el, incPl=false) { +function makePlSel(el, incPl=false) +{ var plSelContent = ""; delete pJson["0"]; // remove filler preset var arr = Object.entries(pJson); @@ -1719,7 +1709,8 @@ function makePlSel(el, incPl=false) { return plSelContent; } -function refreshPlE(p) { +function refreshPlE(p) +{ var plEDiv = gId(`ple${p}`); if (!plEDiv) return; var content = "
Playlist entries
"; @@ -1741,14 +1732,16 @@ function refreshPlE(p) { } // p: preset ID, i: ps index -function addPl(p,i) { +function addPl(p,i) +{ plJson[p].ps.splice(i+1,0,0); plJson[p].dur.splice(i+1,0,plJson[p].dur[i]); plJson[p].transition.splice(i+1,0,plJson[p].transition[i]); refreshPlE(p); } -function delPl(p,i) { +function delPl(p,i) +{ if (plJson[p].ps.length < 2) return; plJson[p].ps.splice(i,1); plJson[p].dur.splice(i,1); @@ -1756,21 +1749,25 @@ function delPl(p,i) { refreshPlE(p); } -function plePs(p,i,field) { +function plePs(p,i,field) +{ plJson[p].ps[i] = parseInt(field.value); } -function pleDur(p,i,field) { +function pleDur(p,i,field) +{ if (field.validity.valid) plJson[p].dur[i] = Math.floor(field.value*10); } -function pleTr(p,i,field) { +function pleTr(p,i,field) +{ if (field.validity.valid) plJson[p].transition[i] = Math.floor(field.value*10); } -function plR(p) { +function plR(p) +{ var pl = plJson[p]; pl.r = gId(`pl${p}rtgl`).checked; if (gId(`pl${p}rptgl`).checked) { // infinite @@ -1784,9 +1781,18 @@ function plR(p) { } } -function makeP(i,pl) { +function makeP(i,pl) +{ var content = ""; if (pl) { + if (i===0) plJson[0] = { + ps: [1], + dur: [100], + transition: [tr], + repeat: 0, + r: false, + end: 0 + }; var rep = plJson[i].repeat ? plJson[i].repeat : 0; content = `