Merge branch 'main' into hex-palette
This commit is contained in:
commit
b436a660f1
@ -1,5 +1,12 @@
|
|||||||
## WLED changelog
|
## WLED changelog
|
||||||
|
|
||||||
|
### WLED release 0.14.0-b1
|
||||||
|
|
||||||
|
#### Build 2212222
|
||||||
|
|
||||||
|
- Version bump to v0.14.0-b1 "Hoshi"
|
||||||
|
- Full changelog TBD
|
||||||
|
|
||||||
### WLED release 0.13.3
|
### WLED release 0.13.3
|
||||||
|
|
||||||
- Version bump to v0.13.3 "Toki"
|
- Version bump to v0.13.3 "Toki"
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wled",
|
"name": "wled",
|
||||||
"version": "0.14.0-b0",
|
"version": "0.14.0-b1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wled",
|
"name": "wled",
|
||||||
"version": "0.14.0-b0",
|
"version": "0.14.0-b1",
|
||||||
"description": "Tools for WLED project",
|
"description": "Tools for WLED project",
|
||||||
"main": "tools/cdata.js",
|
"main": "tools/cdata.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
@ -214,6 +214,7 @@ build_flags = -g
|
|||||||
-D CONFIG_ASYNC_TCP_USE_WDT=0
|
-D CONFIG_ASYNC_TCP_USE_WDT=0
|
||||||
#use LITTLEFS library by lorol in ESP32 core 1.x.x instead of built-in in 2.x.x
|
#use LITTLEFS library by lorol in ESP32 core 1.x.x instead of built-in in 2.x.x
|
||||||
-D LOROL_LITTLEFS
|
-D LOROL_LITTLEFS
|
||||||
|
; -DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when builing with arduino-esp32 >=2.0.3
|
||||||
|
|
||||||
default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
|
default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
|
||||||
|
|
||||||
@ -230,6 +231,9 @@ build_flags = -g
|
|||||||
-DCONFIG_IDF_TARGET_ESP32S2
|
-DCONFIG_IDF_TARGET_ESP32S2
|
||||||
-D CONFIG_ASYNC_TCP_USE_WDT=0
|
-D CONFIG_ASYNC_TCP_USE_WDT=0
|
||||||
-DCO
|
-DCO
|
||||||
|
-DARDUINO_USB_MODE=0 ;; this flag is mandatory for ESP32-S2 !
|
||||||
|
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
|
||||||
|
;; ARDUINO_USB_CDC_ON_BOOT, ARDUINO_USB_MSC_ON_BOOT, ARDUINO_USB_DFU_ON_BOOT
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
@ -243,6 +247,9 @@ build_flags = -g
|
|||||||
-DCONFIG_IDF_TARGET_ESP32C3
|
-DCONFIG_IDF_TARGET_ESP32C3
|
||||||
-D CONFIG_ASYNC_TCP_USE_WDT=0
|
-D CONFIG_ASYNC_TCP_USE_WDT=0
|
||||||
-DCO
|
-DCO
|
||||||
|
-DARDUINO_USB_MODE=1 ;; this flag is mandatory for ESP32-C3
|
||||||
|
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
|
||||||
|
;; ARDUINO_USB_CDC_ON_BOOT
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
@ -258,6 +265,8 @@ build_flags = -g
|
|||||||
-DCONFIG_IDF_TARGET_ESP32S3
|
-DCONFIG_IDF_TARGET_ESP32S3
|
||||||
-D CONFIG_ASYNC_TCP_USE_WDT=0
|
-D CONFIG_ASYNC_TCP_USE_WDT=0
|
||||||
-DCO
|
-DCO
|
||||||
|
;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry:
|
||||||
|
;; ARDUINO_USB_MODE, ARDUINO_USB_CDC_ON_BOOT, ARDUINO_USB_MSC_ON_BOOT, ARDUINO_USB_DFU_ON_BOOT
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
@ -276,7 +285,7 @@ platform = ${common.platform_wled_default}
|
|||||||
platform_packages = ${common.platform_packages}
|
platform_packages = ${common.platform_packages}
|
||||||
board_build.ldscript = ${common.ldscript_4m1m}
|
board_build.ldscript = ${common.ldscript_4m1m}
|
||||||
build_unflags = ${common.build_unflags}
|
build_unflags = ${common.build_unflags}
|
||||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 #-DWLED_DISABLE_2D
|
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D WLED_DISABLE_BLYNK #-DWLED_DISABLE_2D
|
||||||
lib_deps = ${esp8266.lib_deps}
|
lib_deps = ${esp8266.lib_deps}
|
||||||
monitor_filters = esp8266_exception_decoder
|
monitor_filters = esp8266_exception_decoder
|
||||||
|
|
||||||
@ -286,7 +295,7 @@ platform = ${common.platform_wled_default}
|
|||||||
platform_packages = ${common.platform_packages}
|
platform_packages = ${common.platform_packages}
|
||||||
board_build.ldscript = ${common.ldscript_2m512k}
|
board_build.ldscript = ${common.ldscript_2m512k}
|
||||||
build_unflags = ${common.build_unflags}
|
build_unflags = ${common.build_unflags}
|
||||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP02
|
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP02 -D WLED_DISABLE_BLYNK
|
||||||
lib_deps = ${esp8266.lib_deps}
|
lib_deps = ${esp8266.lib_deps}
|
||||||
|
|
||||||
[env:esp01_1m_full]
|
[env:esp01_1m_full]
|
||||||
@ -295,7 +304,7 @@ platform = ${common.platform_wled_default}
|
|||||||
platform_packages = ${common.platform_packages}
|
platform_packages = ${common.platform_packages}
|
||||||
board_build.ldscript = ${common.ldscript_1m128k}
|
board_build.ldscript = ${common.ldscript_1m128k}
|
||||||
build_unflags = ${common.build_unflags}
|
build_unflags = ${common.build_unflags}
|
||||||
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01 -D WLED_DISABLE_OTA
|
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01 -D WLED_DISABLE_OTA -D WLED_DISABLE_BLYNK
|
||||||
lib_deps = ${esp8266.lib_deps}
|
lib_deps = ${esp8266.lib_deps}
|
||||||
|
|
||||||
[env:esp07]
|
[env:esp07]
|
||||||
@ -341,7 +350,7 @@ board = esp32dev
|
|||||||
platform = ${esp32.platform}
|
platform = ${esp32.platform}
|
||||||
platform_packages = ${esp32.platform_packages}
|
platform_packages = ${esp32.platform_packages}
|
||||||
build_unflags = ${common.build_unflags}
|
build_unflags = ${common.build_unflags}
|
||||||
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32 #-D WLED_DISABLE_BLYNK #-D WLED_DISABLE_BROWNOUT_DET
|
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32 -D WLED_DISABLE_BLYNK #-D WLED_DISABLE_BROWNOUT_DET
|
||||||
lib_deps = ${esp32.lib_deps}
|
lib_deps = ${esp32.lib_deps}
|
||||||
monitor_filters = esp32_exception_decoder
|
monitor_filters = esp32_exception_decoder
|
||||||
board_build.partitions = ${esp32.default_partitions}
|
board_build.partitions = ${esp32.default_partitions}
|
||||||
@ -351,7 +360,7 @@ board = esp32dev
|
|||||||
platform = ${esp32.platform}
|
platform = ${esp32.platform}
|
||||||
platform_packages = ${esp32.platform_packages}
|
platform_packages = ${esp32.platform_packages}
|
||||||
build_unflags = ${common.build_unflags}
|
build_unflags = ${common.build_unflags}
|
||||||
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_qio80 #-D WLED_DISABLE_BLYNK #-D WLED_DISABLE_BROWNOUT_DET
|
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_qio80 -D WLED_DISABLE_BLYNK #-D WLED_DISABLE_BROWNOUT_DET
|
||||||
lib_deps = ${esp32.lib_deps}
|
lib_deps = ${esp32.lib_deps}
|
||||||
monitor_filters = esp32_exception_decoder
|
monitor_filters = esp32_exception_decoder
|
||||||
board_build.partitions = ${esp32.default_partitions}
|
board_build.partitions = ${esp32.default_partitions}
|
||||||
@ -387,6 +396,7 @@ board = esp32-c3-devkitm-1
|
|||||||
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
|
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
|
||||||
build_flags = ${common.build_flags} ${esp32c3.build_flags} #-D WLED_RELEASE_NAME=ESP32-C3
|
build_flags = ${common.build_flags} ${esp32c3.build_flags} #-D WLED_RELEASE_NAME=ESP32-C3
|
||||||
-D WLED_WATCHDOG_TIMEOUT=0
|
-D WLED_WATCHDOG_TIMEOUT=0
|
||||||
|
; -DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual USB
|
||||||
upload_speed = 460800
|
upload_speed = 460800
|
||||||
build_unflags = ${common.build_unflags}
|
build_unflags = ${common.build_unflags}
|
||||||
lib_deps = ${esp32c3.lib_deps}
|
lib_deps = ${esp32c3.lib_deps}
|
||||||
|
56
usermods/sht/readme.md
Normal file
56
usermods/sht/readme.md
Normal file
@ -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
|
492
usermods/sht/usermod_sht.h
Normal file
492
usermods/sht/usermod_sht.h
Normal file
@ -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;
|
||||||
|
}
|
@ -100,6 +100,7 @@
|
|||||||
#define USERMOD_ID_BOBLIGHT 36 //Usermod "boblight.h"
|
#define USERMOD_ID_BOBLIGHT 36 //Usermod "boblight.h"
|
||||||
#define USERMOD_ID_SD_CARD 37 //Usermod "usermod_sd_card.h"
|
#define USERMOD_ID_SD_CARD 37 //Usermod "usermod_sd_card.h"
|
||||||
#define USERMOD_ID_PWM_OUTPUTS 38 //Usermod "usermod_pwm_outputs.h
|
#define USERMOD_ID_PWM_OUTPUTS 38 //Usermod "usermod_pwm_outputs.h
|
||||||
|
#define USERMOD_ID_SHT 39 //Usermod "usermod_sht.h
|
||||||
|
|
||||||
//Access point behavior
|
//Access point behavior
|
||||||
#define AP_BEHAVIOR_BOOT_NO_CONN 0 //Open AP when no connection after boot
|
#define AP_BEHAVIOR_BOOT_NO_CONN 0 //Open AP when no connection after boot
|
||||||
|
@ -273,9 +273,9 @@ function onLoad()
|
|||||||
function updateTablinks(tabI)
|
function updateTablinks(tabI)
|
||||||
{
|
{
|
||||||
var tablinks = gEBCN("tablinks");
|
var tablinks = gEBCN("tablinks");
|
||||||
for (var i of tablinks) i.classList.remove("active");
|
for (var i of tablinks) i.classList.remove('active');
|
||||||
if (pcMode) return;
|
if (pcMode) return;
|
||||||
tablinks[tabI].classList.add("active");
|
tablinks[tabI].classList.add('active');
|
||||||
}
|
}
|
||||||
|
|
||||||
function openTab(tabI, force = false)
|
function openTab(tabI, force = false)
|
||||||
@ -291,13 +291,13 @@ var timeout;
|
|||||||
function showToast(text, error = false)
|
function showToast(text, error = false)
|
||||||
{
|
{
|
||||||
if (error) gId('connind').style.backgroundColor = "var(--c-r)";
|
if (error) gId('connind').style.backgroundColor = "var(--c-r)";
|
||||||
var x = gId("toast");
|
var x = gId('toast');
|
||||||
//if (error) text += '<i class="icons btn-icon" style="transform:rotate(45deg);position:absolute;top:10px;right:0px;" onclick="clearErrorToast(100);"></i>';
|
//if (error) text += '<i class="icons btn-icon" style="transform:rotate(45deg);position:absolute;top:10px;right:0px;" onclick="clearErrorToast(100);"></i>';
|
||||||
x.innerHTML = text;
|
x.innerHTML = text;
|
||||||
x.classList.add(error ? "error":"show");
|
x.classList.add(error ? 'error':'show');
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
x.style.animation = 'none';
|
x.style.animation = 'none';
|
||||||
timeout = setTimeout(()=>{ x.classList.remove("show"); }, 2900);
|
timeout = setTimeout(()=>{ x.classList.remove('show'); }, 2900);
|
||||||
if (error) console.log(text);
|
if (error) console.log(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,12 +308,12 @@ function showErrorToast()
|
|||||||
|
|
||||||
function clearErrorToast(n=5000)
|
function clearErrorToast(n=5000)
|
||||||
{
|
{
|
||||||
var x = gId("toast");
|
var x = gId('toast');
|
||||||
if (x.classList.contains("error")) {
|
if (x.classList.contains('error')) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
timeout = setTimeout(()=>{
|
timeout = setTimeout(()=>{
|
||||||
x.classList.remove("show");
|
x.classList.remove('show');
|
||||||
x.classList.remove("error");
|
x.classList.remove('error');
|
||||||
}, n);
|
}, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -544,8 +544,8 @@ function populateQL()
|
|||||||
for (var key of (pQL||[])) {
|
for (var key of (pQL||[])) {
|
||||||
cn += `<button class="btn btn-xs psts" id="p${key[0]}qlb" title="${key[2]?key[2]:''}" onclick="setPreset(${key[0]});">${key[1]}</button>`;
|
cn += `<button class="btn btn-xs psts" id="p${key[0]}qlb" title="${key[2]?key[2]:''}" onclick="setPreset(${key[0]});">${key[1]}</button>`;
|
||||||
}
|
}
|
||||||
gId('pql').classList.add("expanded");
|
gId('pql').classList.add('expanded');
|
||||||
} else gId('pql').classList.remove("expanded");
|
} else gId('pql').classList.remove('expanded');
|
||||||
gId('pql').innerHTML = cn;
|
gId('pql').innerHTML = cn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,8 +610,8 @@ function parseInfo(i) {
|
|||||||
mh = i.leds.matrix ? i.leds.matrix.h : 0;
|
mh = i.leds.matrix ? i.leds.matrix.h : 0;
|
||||||
isM = mw>0 && mh>0;
|
isM = mw>0 && mh>0;
|
||||||
if (!isM) {
|
if (!isM) {
|
||||||
gId("filter1D").classList.add("hide");
|
gId("filter1D").classList.add('hide');
|
||||||
//gId("filter2D").classList.add("hide");
|
//gId("filter2D").classList.add('hide');
|
||||||
hideModes("2D");
|
hideModes("2D");
|
||||||
}
|
}
|
||||||
// if (i.noaudio) {
|
// if (i.noaudio) {
|
||||||
@ -697,7 +697,7 @@ function populateSegments(s)
|
|||||||
if (i > lSeg) lSeg = i;
|
if (i > lSeg) lSeg = i;
|
||||||
|
|
||||||
let sg = gId(`seg${i}`);
|
let sg = gId(`seg${i}`);
|
||||||
let exp = sg ? (sg.classList.contains("expanded") || (i===0 && cfg.comp.segexp)) : false;
|
let exp = sg ? (sg.classList.contains('expanded') || (i===0 && cfg.comp.segexp)) : false;
|
||||||
|
|
||||||
let segp = `<div id="segp${i}" class="sbs">
|
let segp = `<div id="segp${i}" class="sbs">
|
||||||
<i class="icons e-icon pwr ${inst.on ? "act":""}" id="seg${i}pwr" onclick="setSegPwr(${i})"></i>
|
<i class="icons e-icon pwr ${inst.on ? "act":""}" id="seg${i}pwr" onclick="setSegPwr(${i})"></i>
|
||||||
@ -812,9 +812,9 @@ function populateSegments(s)
|
|||||||
for (const k of (li.maps||[])) cont += `<option value="${k}">${k==0?'Default':'ledmap'+k+'.json'}</option>`;
|
for (const k of (li.maps||[])) cont += `<option value="${k}">${k==0?'Default':'ledmap'+k+'.json'}</option>`;
|
||||||
cont += "</select></div>";
|
cont += "</select></div>";
|
||||||
gId("ledmap").innerHTML = cont;
|
gId("ledmap").innerHTML = cont;
|
||||||
gId("ledmap").classList.remove("hide");
|
gId("ledmap").classList.remove('hide');
|
||||||
} else {
|
} else {
|
||||||
gId("ledmap").classList.add("hide");
|
gId("ledmap").classList.add('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1057,20 +1057,20 @@ function updateLen(s)
|
|||||||
let tPL = gId(`seg${s}lbtm`);
|
let tPL = gId(`seg${s}lbtm`);
|
||||||
if (stop-start>1 && stopY-startY>1) {
|
if (stop-start>1 && stopY-startY>1) {
|
||||||
// 2D segment
|
// 2D segment
|
||||||
if (tPL) tPL.classList.remove("hide"); // unhide transpose checkbox
|
if (tPL) tPL.classList.remove('hide'); // unhide transpose checkbox
|
||||||
let sE = gId('fxlist').querySelector(`.lstI[data-id="${selectedFx}"]`);
|
let sE = gId('fxlist').querySelector(`.lstI[data-id="${selectedFx}"]`);
|
||||||
if (sE) {
|
if (sE) {
|
||||||
let sN = sE.querySelector(".lstIname").innerText;
|
let sN = sE.querySelector(".lstIname").innerText;
|
||||||
let seg = gId(`seg${s}map2D`);
|
let seg = gId(`seg${s}map2D`);
|
||||||
if (seg) {
|
if (seg) {
|
||||||
if(sN.indexOf("\u25A6")<0) seg.classList.remove("hide"); // unhide mapping for 1D effects (| in name)
|
if(sN.indexOf("\u25A6")<0) seg.classList.remove('hide'); // unhide mapping for 1D effects (| in name)
|
||||||
else seg.classList.add("hide"); // hide mapping otherwise
|
else seg.classList.add('hide'); // hide mapping otherwise
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 1D segment in 2D set-up
|
// 1D segment in 2D set-up
|
||||||
if (tPL) {
|
if (tPL) {
|
||||||
tPL.classList.add("hide"); // hide transpose checkbox
|
tPL.classList.add('hide'); // hide transpose checkbox
|
||||||
gId(`seg${s}tp`).checked = false; // and uncheck it
|
gId(`seg${s}tp`).checked = false; // and uncheck it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1102,7 +1102,7 @@ function updatePA()
|
|||||||
ps = gEBCN("psts"); for (let p of ps) p.classList.remove('selected');
|
ps = gEBCN("psts"); for (let p of ps) p.classList.remove('selected');
|
||||||
if (currentPreset > 0) {
|
if (currentPreset > 0) {
|
||||||
var acv = gId(`p${currentPreset}o`);
|
var acv = gId(`p${currentPreset}o`);
|
||||||
if (acv /*&& !acv.classList.contains("expanded")*/) {
|
if (acv /*&& !acv.classList.contains('expanded')*/) {
|
||||||
acv.classList.add('selected');
|
acv.classList.add('selected');
|
||||||
/*
|
/*
|
||||||
// scroll selected preset into view (on WS refresh)
|
// scroll selected preset into view (on WS refresh)
|
||||||
@ -1119,13 +1119,13 @@ function updatePA()
|
|||||||
|
|
||||||
function updateUI()
|
function updateUI()
|
||||||
{
|
{
|
||||||
gId('buttonPower').className = (isOn) ? "active":"";
|
gId('buttonPower').className = (isOn) ? 'active':'';
|
||||||
gId('buttonNl').className = (nlA) ? "active":"";
|
gId('buttonNl').className = (nlA) ? 'active':'';
|
||||||
gId('buttonSync').className = (syncSend) ? "active":"";
|
gId('buttonSync').className = (syncSend) ? 'active':'';
|
||||||
showNodes();
|
showNodes();
|
||||||
|
|
||||||
updateSelectedPalette();
|
|
||||||
updateSelectedFx();
|
updateSelectedFx();
|
||||||
|
updateSelectedPalette(selectedPal); // must be after updateSelectedFx() to un-hide color slots for * palettes
|
||||||
|
|
||||||
updateTrail(gId('sliderBri'));
|
updateTrail(gId('sliderBri'));
|
||||||
updateTrail(gId('sliderSpeed'));
|
updateTrail(gId('sliderSpeed'));
|
||||||
@ -1159,17 +1159,27 @@ function updateUI()
|
|||||||
updatePSliders();
|
updatePSliders();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSelectedPalette()
|
function updateSelectedPalette(s)
|
||||||
{
|
{
|
||||||
var parent = gId('pallist');
|
var parent = gId('pallist');
|
||||||
var selPaletteInput = parent.querySelector(`input[name="palette"][value="${selectedPal}"]`);
|
var selPaletteInput = parent.querySelector(`input[name="palette"][value="${s}"]`);
|
||||||
if (selPaletteInput) selPaletteInput.checked = true;
|
if (selPaletteInput) selPaletteInput.checked = true;
|
||||||
|
|
||||||
var selElement = parent.querySelector('.selected');
|
var selElement = parent.querySelector('.selected');
|
||||||
if (selElement) selElement.classList.remove('selected');
|
if (selElement) selElement.classList.remove('selected');
|
||||||
|
|
||||||
var selectedPalette = parent.querySelector(`.lstI[data-id="${selectedPal}"]`);
|
var selectedPalette = parent.querySelector(`.lstI[data-id="${s}"]`);
|
||||||
if (selectedPalette) parent.querySelector(`.lstI[data-id="${selectedPal}"]`).classList.add('selected');
|
if (selectedPalette) parent.querySelector(`.lstI[data-id="${s}"]`).classList.add('selected');
|
||||||
|
|
||||||
|
// in case of special palettes (* Colors...), force show color selectors (if hidden by effect data)
|
||||||
|
let cd = gId('csl').children; // color selectors
|
||||||
|
if (s > 1 && s < 6) {
|
||||||
|
cd[0].classList.remove('hide'); // * Color 1
|
||||||
|
if (s > 2) cd[1].classList.remove('hide'); // * Color 1 & 2
|
||||||
|
if (s == 5) cd[2].classList.remove('hide'); // all colors
|
||||||
|
} else {
|
||||||
|
for (let i of cd) if (i.dataset.hide == '1') i.classList.add('hide');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSelectedFx()
|
function updateSelectedFx()
|
||||||
@ -1191,9 +1201,9 @@ function updateSelectedFx()
|
|||||||
|
|
||||||
var selectedName = selectedEffect.querySelector(".lstIname").innerText;
|
var selectedName = selectedEffect.querySelector(".lstIname").innerText;
|
||||||
var segs = gId("segcont").querySelectorAll(`div[data-map="map2D"]`);
|
var segs = gId("segcont").querySelectorAll(`div[data-map="map2D"]`);
|
||||||
for (const seg of segs) if (selectedName.indexOf("\u25A6")<0) seg.classList.remove("hide"); else seg.classList.add("hide");
|
for (const seg of segs) if (selectedName.indexOf("\u25A6")<0) seg.classList.remove('hide'); else seg.classList.add('hide');
|
||||||
var segs = gId("segcont").querySelectorAll(`div[data-snd="si"]`);
|
var segs = gId("segcont").querySelectorAll(`div[data-snd="si"]`);
|
||||||
for (const seg of segs) if (selectedName.indexOf("\u266A")<0 && selectedName.indexOf("\266B")<0) seg.classList.add("hide"); else seg.classList.remove("hide"); // also "♫ "?
|
for (const seg of segs) if (selectedName.indexOf("\u266A")<0 && selectedName.indexOf("\266B")<0) seg.classList.add('hide'); else seg.classList.remove('hide'); // also "♫ "?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1394,9 +1404,9 @@ function setEffectParameters(idx)
|
|||||||
else if (i==0) label.innerHTML = "Effect speed";
|
else if (i==0) label.innerHTML = "Effect speed";
|
||||||
else if (i==1) label.innerHTML = "Effect intensity";
|
else if (i==1) label.innerHTML = "Effect intensity";
|
||||||
else label.innerHTML = "Custom" + (i-1);
|
else label.innerHTML = "Custom" + (i-1);
|
||||||
slider.classList.remove("hide");
|
slider.classList.remove('hide');
|
||||||
} else {
|
} else {
|
||||||
slider.classList.add("hide");
|
slider.classList.add('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (slOnOff.length>5) { // up to 3 checkboxes
|
if (slOnOff.length>5) { // up to 3 checkboxes
|
||||||
@ -1422,14 +1432,14 @@ function setEffectParameters(idx)
|
|||||||
// set html color items on/off
|
// set html color items on/off
|
||||||
var cslLabel = '';
|
var cslLabel = '';
|
||||||
var sep = '';
|
var sep = '';
|
||||||
var hide = true;
|
|
||||||
var cslCnt = 0, oCsel = csel;
|
var cslCnt = 0, oCsel = csel;
|
||||||
for (let i=0; i<gId("csl").children.length; i++) {
|
for (let i=0; i<gId("csl").children.length; i++) {
|
||||||
var btn = gId("csl" + i);
|
var btn = gId("csl" + i);
|
||||||
// if no controlDefined or coOnOff has a value
|
// if no controlDefined or coOnOff has a value
|
||||||
if (coOnOff.length>i && coOnOff[i] != "") {
|
if (coOnOff.length>i && coOnOff[i] != "") {
|
||||||
btn.style.display = "inline";
|
btn.classList.remove('hide');
|
||||||
if (coOnOff.length>i && coOnOff[i] != "!") {
|
btn.dataset.hide = 0;
|
||||||
|
if (coOnOff[i] != "!") {
|
||||||
var abbreviation = coOnOff[i].substr(0,2);
|
var abbreviation = coOnOff[i].substr(0,2);
|
||||||
btn.innerHTML = abbreviation;
|
btn.innerHTML = abbreviation;
|
||||||
if (abbreviation != coOnOff[i]) {
|
if (abbreviation != coOnOff[i]) {
|
||||||
@ -1440,17 +1450,18 @@ function setEffectParameters(idx)
|
|||||||
else if (i==0) btn.innerHTML = "Fx";
|
else if (i==0) btn.innerHTML = "Fx";
|
||||||
else if (i==1) btn.innerHTML = "Bg";
|
else if (i==1) btn.innerHTML = "Bg";
|
||||||
else btn.innerHTML = "Cs";
|
else btn.innerHTML = "Cs";
|
||||||
hide = false;
|
|
||||||
if (!cslCnt || oCsel==i) selectSlot(i); // select 1st displayed slot or old one
|
if (!cslCnt || oCsel==i) selectSlot(i); // select 1st displayed slot or old one
|
||||||
cslCnt++;
|
cslCnt++;
|
||||||
} else if (!controlDefined) { // if no controls then all buttons should be shown for color 1..3
|
} else if (!controlDefined) { // if no controls then all buttons should be shown for color 1..3
|
||||||
btn.style.display = "inline";
|
btn.classList.remove('hide');
|
||||||
|
btn.dataset.hide = 0;
|
||||||
btn.innerHTML = `${i+1}`;
|
btn.innerHTML = `${i+1}`;
|
||||||
hide = false;
|
|
||||||
if (!cslCnt || oCsel==i) selectSlot(i); // select 1st displayed slot or old one
|
if (!cslCnt || oCsel==i) selectSlot(i); // select 1st displayed slot or old one
|
||||||
cslCnt++;
|
cslCnt++;
|
||||||
} else {
|
} else {
|
||||||
btn.style.display = "none";
|
btn.classList.add('hide');
|
||||||
|
btn.dataset.hide = 1;
|
||||||
|
btn.innerHTML = `${i+1}`; // name hidden buttons 1..3 for * palettes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gId("cslLabel").innerHTML = cslLabel;
|
gId("cslLabel").innerHTML = cslLabel;
|
||||||
@ -1474,13 +1485,6 @@ function setEffectParameters(idx)
|
|||||||
pall.innerHTML = '<i class="icons sel-icon" onclick="tglHex()"></i> Color palette not used';
|
pall.innerHTML = '<i class="icons sel-icon" onclick="tglHex()"></i> Color palette not used';
|
||||||
palw.style.display = "none";
|
palw.style.display = "none";
|
||||||
}
|
}
|
||||||
// not all color selectors shown, hide palettes created from color selectors
|
|
||||||
for (let e of (gId('pallist').querySelectorAll('.lstI')||[])) {
|
|
||||||
let fltr = "* C";
|
|
||||||
if (cslCnt==1 && csel==0) fltr = "* Colors";
|
|
||||||
else if (cslCnt==2) fltr = "* Colors Only";
|
|
||||||
if (cslCnt < 3 && e.querySelector('.lstIname').innerText.indexOf(fltr)>=0) e.classList.add('hide'); else e.classList.remove('hide');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var jsonTimeout;
|
var jsonTimeout;
|
||||||
@ -1949,7 +1953,7 @@ function tglSegn(s)
|
|||||||
{
|
{
|
||||||
let t = gId(s<100?`seg${s}t`:`p${s-100}txt`);
|
let t = gId(s<100?`seg${s}t`:`p${s-100}txt`);
|
||||||
if (t) {
|
if (t) {
|
||||||
t.classList.toggle("show");
|
t.classList.toggle('show');
|
||||||
t.focus();
|
t.focus();
|
||||||
t.select();
|
t.select();
|
||||||
}
|
}
|
||||||
@ -1989,7 +1993,7 @@ function rptSeg(s)
|
|||||||
var rev = gId(`seg${s}rev`).checked;
|
var rev = gId(`seg${s}rev`).checked;
|
||||||
var mi = gId(`seg${s}mi`).checked;
|
var mi = gId(`seg${s}mi`).checked;
|
||||||
var sel = gId(`seg${s}sel`).checked;
|
var sel = gId(`seg${s}sel`).checked;
|
||||||
var pwr = gId(`seg${s}pwr`).classList.contains("act");
|
var pwr = gId(`seg${s}pwr`).classList.contains('act');
|
||||||
var obj = {"seg": {"id": s, "n": name, "start": start, "stop": (cfg.comp.seglen?start:0)+stop, "rev": rev, "mi": mi, "on": pwr, "bri": parseInt(gId(`seg${s}bri`).value), "sel": sel}};
|
var obj = {"seg": {"id": s, "n": name, "start": start, "stop": (cfg.comp.seglen?start:0)+stop, "rev": rev, "mi": mi, "on": pwr, "bri": parseInt(gId(`seg${s}bri`).value), "sel": sel}};
|
||||||
if (gId(`seg${s}grp`)) {
|
if (gId(`seg${s}grp`)) {
|
||||||
var grp = parseInt(gId(`seg${s}grp`).value);
|
var grp = parseInt(gId(`seg${s}grp`).value);
|
||||||
@ -2100,7 +2104,7 @@ function setTp(s)
|
|||||||
|
|
||||||
function setSegPwr(s)
|
function setSegPwr(s)
|
||||||
{
|
{
|
||||||
var pwr = gId(`seg${s}pwr`).classList.contains("act");
|
var pwr = gId(`seg${s}pwr`).classList.contains('act');
|
||||||
var obj = {"seg": {"id": s, "on": !pwr}};
|
var obj = {"seg": {"id": s, "on": !pwr}};
|
||||||
requestJson(obj);
|
requestJson(obj);
|
||||||
}
|
}
|
||||||
@ -2294,7 +2298,7 @@ function delP(i) {
|
|||||||
requestJson(obj);
|
requestJson(obj);
|
||||||
delete pJson[i];
|
delete pJson[i];
|
||||||
populatePresets();
|
populatePresets();
|
||||||
gId('putil').classList.add("staybot");
|
gId('putil').classList.add('staybot');
|
||||||
} else {
|
} else {
|
||||||
bt.style.color = "var(--c-r)";
|
bt.style.color = "var(--c-r)";
|
||||||
bt.innerHTML = "<i class='icons btn-icon'></i>Delete!";
|
bt.innerHTML = "<i class='icons btn-icon'></i>Delete!";
|
||||||
@ -2569,7 +2573,7 @@ function hideModes(txt)
|
|||||||
let f = false;
|
let f = false;
|
||||||
if (txt==="2D") f = iT.indexOf("\u25A6") >= 0 && iT.indexOf("\u22EE") < 0; // 2D && !1D
|
if (txt==="2D") f = iT.indexOf("\u25A6") >= 0 && iT.indexOf("\u22EE") < 0; // 2D && !1D
|
||||||
else f = iT.indexOf(txt) >= 0;
|
else f = iT.indexOf(txt) >= 0;
|
||||||
if (f) e.classList.add("hide"); //else e.classList.remove("hide");
|
if (f) e.classList.add('hide'); //else e.classList.remove('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2640,9 +2644,9 @@ function expand(i)
|
|||||||
{
|
{
|
||||||
var seg = i<100 ? gId('seg' +i) : gId(`p${i-100}o`);
|
var seg = i<100 ? gId('seg' +i) : gId(`p${i-100}o`);
|
||||||
let ps = gId("pcont").children; // preset wrapper
|
let ps = gId("pcont").children; // preset wrapper
|
||||||
if (i>100) for (let p of ps) { p.classList.remove("selected"); if (p!==seg) p.classList.remove("expanded"); } // collapse all other presets & remove selected
|
if (i>100) for (let p of ps) { p.classList.remove('selected'); if (p!==seg) p.classList.remove('expanded'); } // collapse all other presets & remove selected
|
||||||
|
|
||||||
seg.classList.toggle("expanded");
|
seg.classList.toggle('expanded');
|
||||||
|
|
||||||
// presets
|
// presets
|
||||||
if (i >= 100) {
|
if (i >= 100) {
|
||||||
@ -2664,11 +2668,11 @@ function expand(i)
|
|||||||
gId(`p${p}api`).value = papi;
|
gId(`p${p}api`).value = papi;
|
||||||
if (papi.indexOf("Please") == 0) gId(`p${p}cstgl`).checked = false;
|
if (papi.indexOf("Please") == 0) gId(`p${p}cstgl`).checked = false;
|
||||||
tglCs(p);
|
tglCs(p);
|
||||||
gId('putil').classList.remove("staybot");
|
gId('putil').classList.remove('staybot');
|
||||||
} else {
|
} else {
|
||||||
updatePA();
|
updatePA();
|
||||||
gId('seg' +i).innerHTML = "";
|
gId('seg' +i).innerHTML = "";
|
||||||
gId('putil').classList.add("staybot");
|
gId('putil').classList.add('staybot');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,44 +44,44 @@ const char PAGE_dmxmap[] PROGMEM = R"=====()=====";
|
|||||||
const uint16_t PAGE_update_length = 615;
|
const uint16_t PAGE_update_length = 615;
|
||||||
const uint8_t PAGE_update[] PROGMEM = {
|
const uint8_t PAGE_update[] PROGMEM = {
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x75, 0x53, 0x5d, 0x6f, 0xd4, 0x30,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x75, 0x53, 0x5d, 0x6f, 0xd4, 0x30,
|
||||||
0x10, 0x7c, 0xcf, 0xaf, 0x70, 0xfd, 0x74, 0x27, 0x71, 0x4e, 0x41, 0xbc, 0x50, 0x92, 0x14, 0x8e,
|
0x10, 0x7c, 0xcf, 0xaf, 0x70, 0xfd, 0x74, 0x27, 0x71, 0x4e, 0x8b, 0x78, 0xa1, 0x24, 0x29, 0x1c,
|
||||||
0x56, 0xa8, 0x12, 0x52, 0x4f, 0x6a, 0x0b, 0xe2, 0x09, 0x39, 0xf6, 0x26, 0x31, 0xe7, 0xd8, 0xa9,
|
0xad, 0x50, 0x25, 0xa4, 0x56, 0x6a, 0x0b, 0xe2, 0x09, 0x39, 0xf6, 0xe6, 0x62, 0xce, 0xb1, 0x53,
|
||||||
0xbd, 0xb9, 0xd3, 0x09, 0xf5, 0xbf, 0xb3, 0x71, 0xee, 0x0a, 0xe2, 0xe3, 0x25, 0x8a, 0xb3, 0xb3,
|
0x7b, 0x73, 0xa7, 0xa8, 0xea, 0x7f, 0x67, 0xe3, 0xdc, 0x15, 0xc4, 0xc7, 0x4b, 0x14, 0x67, 0x67,
|
||||||
0xe3, 0xdd, 0x99, 0x49, 0x71, 0x76, 0x75, 0xfb, 0xe1, 0xfe, 0xeb, 0xe6, 0x9a, 0x75, 0xd8, 0xdb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d0, 0x33, 0xba, 0x1e, 0x11, 0x29, 0x92, 0x33, 0x7c, 0x96, 0x91, 0xc8, 0x66, 0xa3, 0xce, 0x8a,
|
0xd0, 0x33, 0xba, 0x1e, 0x10, 0x29, 0x92, 0x33, 0x7c, 0x96, 0x91, 0xc8, 0x66, 0xa3, 0x4e, 0x8a,
|
||||||
0x7c, 0x2e, 0xff, 0x03, 0x3a, 0x1f, 0x26, 0xed, 0x95, 0x35, 0x6a, 0x5b, 0xf2, 0xf5, 0x24, 0xfd,
|
0x7c, 0x2e, 0xff, 0x03, 0x3a, 0x1f, 0x26, 0xed, 0x95, 0x35, 0x6a, 0x5b, 0xf2, 0xf5, 0x24, 0xfd,
|
||||||
0x9a, 0x92, 0xfe, 0xab, 0x29, 0x79, 0x54, 0x15, 0xda, 0xec, 0xb2, 0x64, 0xe5, 0x94, 0x53, 0xa2,
|
0x9a, 0x92, 0xfe, 0xab, 0x29, 0x79, 0x54, 0x15, 0xda, 0xec, 0xb2, 0x64, 0xe5, 0x94, 0x53, 0xa2,
|
||||||
0xa9, 0x12, 0x3b, 0x85, 0x4f, 0x08, 0x41, 0xe0, 0x44, 0xbe, 0x49, 0xcb, 0x32, 0xed, 0x99, 0xf3,
|
0xa9, 0x12, 0x3b, 0x85, 0x4f, 0x08, 0x41, 0xe0, 0x44, 0x7e, 0x9b, 0x96, 0x65, 0xda, 0x33, 0xe7,
|
||||||
0xc8, 0x94, 0xf5, 0x74, 0xf0, 0x81, 0x66, 0x6d, 0x02, 0xc4, 0x2e, 0xf9, 0x31, 0xc8, 0x16, 0xd8,
|
0x91, 0x29, 0xeb, 0xe9, 0xe0, 0x03, 0xcd, 0xda, 0x04, 0x88, 0x6d, 0xf2, 0xa3, 0x97, 0x1b, 0x60,
|
||||||
0xc5, 0xb2, 0xc8, 0x89, 0x6f, 0x5a, 0x77, 0x0a, 0xdd, 0x94, 0xc0, 0xe9, 0xd7, 0xfe, 0x09, 0x43,
|
0xe7, 0xcb, 0x22, 0x27, 0xbe, 0x69, 0xdd, 0x29, 0x74, 0x53, 0x02, 0xa7, 0x5f, 0xfb, 0x27, 0xff,
|
||||||
0x44, 0x4f, 0x48, 0xf0, 0x03, 0x00, 0x00
|
0x66, 0x0a, 0x46, 0xf0, 0x03, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1620,22 +1620,22 @@ const uint8_t PAGE_settings_sec[] PROGMEM = {
|
|||||||
0xa3, 0x31, 0x1e, 0x59, 0x6d, 0xaa, 0x34, 0xe9, 0xd0, 0xfe, 0x6a, 0x81, 0x32, 0x9c, 0x55, 0xe3,
|
0xa3, 0x31, 0x1e, 0x59, 0x6d, 0xaa, 0x34, 0xe9, 0xd0, 0xfe, 0x6a, 0x81, 0x32, 0x9c, 0x55, 0xe3,
|
||||||
0x1e, 0x5e, 0x8e, 0xd1, 0x91, 0x32, 0x89, 0xd6, 0x7a, 0xa6, 0x64, 0x44, 0x3d, 0x61, 0x84, 0xea,
|
0x1e, 0x5e, 0x8e, 0xd1, 0x91, 0x32, 0x89, 0xd6, 0x7a, 0xa6, 0x64, 0x44, 0x3d, 0x61, 0x84, 0xea,
|
||||||
0x2d, 0xcc, 0x94, 0x7e, 0x4c, 0xf9, 0x34, 0xce, 0x51, 0x32, 0xf9, 0x80, 0xa6, 0x29, 0x14, 0x3a,
|
0x2d, 0xcc, 0x94, 0x7e, 0x4c, 0xf9, 0x34, 0xce, 0x51, 0x32, 0xf9, 0x80, 0xa6, 0x29, 0x14, 0x3a,
|
||||||
0xec, 0x56, 0x1a, 0x22, 0x1b, 0xd6, 0xef, 0xed, 0x3e, 0xef, 0xf5, 0x77, 0xc6, 0xfd, 0x15, 0x6f,
|
0xec, 0x56, 0x1a, 0x22, 0x1b, 0xd6, 0xef, 0xed, 0x3e, 0xef, 0xf5, 0x77, 0xc6, 0xbb, 0x2b, 0xde,
|
||||||
0xfd, 0x8c, 0x86, 0x85, 0x9a, 0xa9, 0xc8, 0xbf, 0x1e, 0xa8, 0x69, 0xd6, 0xc6, 0xee, 0x80, 0x19,
|
0xfa, 0x19, 0x0d, 0x0b, 0x35, 0x53, 0x91, 0x7f, 0x3d, 0x50, 0xd3, 0xac, 0x8d, 0xdd, 0x01, 0x33,
|
||||||
0x77, 0x12, 0x23, 0x53, 0x45, 0xa1, 0xda, 0xb9, 0xaf, 0x7f, 0x73, 0x2b, 0xaa, 0xb7, 0xa4, 0x77,
|
0xee, 0x24, 0x46, 0xa6, 0x8a, 0x42, 0xb5, 0x73, 0x5f, 0xff, 0xe6, 0x56, 0x54, 0x6f, 0x49, 0xef,
|
||||||
0x10, 0x58, 0x50, 0xc9, 0x9a, 0x52, 0x6d, 0x29, 0x13, 0x05, 0xe6, 0x71, 0xa8, 0x0e, 0xb3, 0x55,
|
0x20, 0xb0, 0xa0, 0x92, 0x35, 0xa5, 0xda, 0x52, 0x26, 0x0a, 0xcc, 0xe3, 0x50, 0x1d, 0x66, 0xab,
|
||||||
0x02, 0x77, 0x8e, 0x58, 0x56, 0xa1, 0x78, 0xf8, 0x59, 0x5f, 0x1f, 0x51, 0x06, 0xd0, 0xfd, 0x9b,
|
0x04, 0xee, 0x1c, 0xb1, 0xac, 0x42, 0xf1, 0xf0, 0xb3, 0xbe, 0x3e, 0xa2, 0x0c, 0xa0, 0xfb, 0x37,
|
||||||
0x25, 0x9e, 0xa3, 0xa8, 0x5b, 0x9a, 0x51, 0x03, 0x08, 0xc4, 0x40, 0x91, 0xf5, 0x2f, 0x15, 0xbe,
|
0x4b, 0x3c, 0x47, 0x51, 0xb7, 0x34, 0xa3, 0x06, 0x10, 0x88, 0x81, 0x22, 0xeb, 0x5f, 0x2a, 0x7c,
|
||||||
0x25, 0xde, 0x6a, 0x2d, 0xea, 0x74, 0x93, 0x80, 0xed, 0xf5, 0x77, 0x7f, 0xdd, 0xd9, 0xeb, 0xef,
|
0x4b, 0xbc, 0xd5, 0x5a, 0xd4, 0xe9, 0x26, 0x01, 0xdb, 0xeb, 0xef, 0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b6, 0xd4, 0xec, 0x4a, 0xd9,
|
0xc9, 0x29, 0x73, 0xfd, 0x8b, 0x96, 0xf9, 0x47, 0x2a, 0x11, 0x3e, 0x6d, 0xa9, 0xd9, 0x95, 0xb2,
|
||||||
0x42, 0x5c, 0x51, 0xff, 0x0a, 0xf0, 0xdd, 0xf6, 0xf6, 0xdb, 0xee, 0xb6, 0xf3, 0x53, 0xed, 0x6d,
|
0x85, 0xb8, 0xa2, 0xfe, 0x15, 0xe0, 0xbb, 0xed, 0xed, 0xb7, 0xdd, 0x6d, 0xe7, 0xa7, 0xda, 0xdb,
|
||||||
0x44, 0x35, 0x07, 0x1f, 0xd4, 0xd5, 0x53, 0x8b, 0x4f, 0xbf, 0x32, 0xfe, 0x0f, 0xf4, 0xde, 0xf4,
|
0x88, 0x6a, 0x0e, 0x3e, 0xa8, 0xab, 0xa7, 0x16, 0x9f, 0x7e, 0x65, 0xfc, 0x1f, 0x6e, 0x01, 0x28,
|
||||||
0x46, 0x75, 0x14, 0x00, 0x00
|
0x3c, 0x75, 0x14, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
3815
wled00/html_ui.h
3815
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -189,7 +189,7 @@ void sendImprovInfoResponse() {
|
|||||||
out[11] = 4; //Firmware len ("WLED")
|
out[11] = 4; //Firmware len ("WLED")
|
||||||
out[12] = 'W'; out[13] = 'L'; out[14] = 'E'; out[15] = 'D';
|
out[12] = 'W'; out[13] = 'L'; out[14] = 'E'; out[15] = 'D';
|
||||||
uint8_t lengthSum = 17;
|
uint8_t lengthSum = 17;
|
||||||
uint8_t vlen = sprintf_P(out+lengthSum,PSTR("0.14.0-b0/%i"),VERSION);
|
uint8_t vlen = sprintf_P(out+lengthSum,PSTR("0.14.0-b1/%i"),VERSION);
|
||||||
out[16] = vlen; lengthSum += vlen;
|
out[16] = vlen; lengthSum += vlen;
|
||||||
uint8_t hlen = 7;
|
uint8_t hlen = 7;
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
|
@ -180,6 +180,10 @@
|
|||||||
#include "../usermods/pwm_outputs/usermod_pwm_outputs.h"
|
#include "../usermods/pwm_outputs/usermod_pwm_outputs.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USERMOD_SHT
|
||||||
|
#include "../usermods/sht/usermod_sht.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void registerUsermods()
|
void registerUsermods()
|
||||||
{
|
{
|
||||||
@ -340,4 +344,8 @@ void registerUsermods()
|
|||||||
#ifdef USERMOD_PWM_OUTPUTS
|
#ifdef USERMOD_PWM_OUTPUTS
|
||||||
usermods.add(new PwmOutputsUsermod());
|
usermods.add(new PwmOutputsUsermod());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USERMOD_SHT
|
||||||
|
usermods.add(new ShtUsermod());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,10 @@ void WLED::setup()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.setTimeout(50);
|
#if !ARDUINO_USB_CDC_ON_BOOT
|
||||||
|
Serial.setTimeout(50); // this causes troubles on new MCUs that have a "virtual" USB Serial (HWCDC)
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
#if defined(WLED_DEBUG) && defined(ARDUINO_ARCH_ESP32) && (defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) || ARDUINO_USB_CDC_ON_BOOT)
|
#if defined(WLED_DEBUG) && defined(ARDUINO_ARCH_ESP32) && (defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) || ARDUINO_USB_CDC_ON_BOOT)
|
||||||
delay(2500); // allow CDC USB serial to initialise
|
delay(2500); // allow CDC USB serial to initialise
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
/*
|
/*
|
||||||
Main sketch, global variable declarations
|
Main sketch, global variable declarations
|
||||||
@title WLED project sketch
|
@title WLED project sketch
|
||||||
@version 0.14.0-b0
|
@version 0.14.0-b1
|
||||||
@author Christian Schwinne
|
@author Christian Schwinne
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2212180
|
#define VERSION 2212222
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
@ -71,6 +71,7 @@
|
|||||||
#include <user_interface.h>
|
#include <user_interface.h>
|
||||||
}
|
}
|
||||||
#else // ESP32
|
#else // ESP32
|
||||||
|
#include <HardwareSerial.h> // ensure we have the correct "Serial" on new MCUs (depends on ARDUINO_USB_MODE and ARDUINO_USB_CDC_ON_BOOT)
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <ETH.h>
|
#include <ETH.h>
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
|
@ -71,7 +71,7 @@ void createEditHandler(bool enable) {
|
|||||||
editHandler = &server.addHandler(new SPIFFSEditor("","",WLED_FS));//http_username,http_password));
|
editHandler = &server.addHandler(new SPIFFSEditor("","",WLED_FS));//http_username,http_password));
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
editHandler = server.on("/edit", HTTP_GET, [](AsyncWebServerRequest *request){
|
editHandler = &server.on("/edit", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
serveMessage(request, 501, "Not implemented", F("The FS editor is disabled in this build."), 254);
|
serveMessage(request, 501, "Not implemented", F("The FS editor is disabled in this build."), 254);
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user