From 1ab53aabc82ab54e9bf09234bc6fe4f307e2809c Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 10 Oct 2024 12:49:27 +0200 Subject: [PATCH 1/9] Update TEMPLATES.md --- TEMPLATES.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/TEMPLATES.md b/TEMPLATES.md index 8461635f2..e6ce340d4 100644 --- a/TEMPLATES.md +++ b/TEMPLATES.md @@ -5,7 +5,7 @@ # Templates -Find below the available templates as of August 2024. More template information can be found in the [Tasmota Device Templates Repository](http://blakadder.github.io/templates) +Find below the available templates as of October 2024. More template information can be found in the [Tasmota Device Templates Repository](http://blakadder.github.io/templates) ## Adapter Board ``` @@ -97,7 +97,7 @@ Iotton 9W 700lm {"NAME":"Iotton Light","GPIO":[0,0,0,0,416,417,0,0, iQtech 10W 900lm {"NAME":"iQ-Tech CCT 10W 900LM","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":18} iView 10W 1050lm {"NAME":"iView ISB1000-D","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":18} Kogan 10W Cool & Warm White 1050lm {"NAME":"Kogan 10W CCT","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":48} -Kogan 4.5W 330lm 110 {"NAME":"Kogan White/Wa","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":18} +Kogan 4.5W 330lm 110° {"NAME":"Kogan White/Wa","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":18} Kogan 5W {"NAME":"Kogan Co/Wa","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":18} Kruidvat A60 9W 806lm {"NAME":"Kruidvat E27 806 Lumens","GPIO":[0,0,0,0,416,449,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":48} Laser 10W 1000lm {"NAME":"Laser 10W CCT","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":48} @@ -131,7 +131,7 @@ Nedis C10 350lm {"NAME":"WIFILW10WTE14","GPIO":[0,0,0,0,0,416,0,0,0 Nedis G125 5.5W 350lm Twisted Filament {"NAME":"WIFILF10GDG125","GPIO":[0,0,0,0,0,0,0,0,417,0,416,0,0,0],"FLAG":0,"BASE":18} Nedis PAR16 330lm {"NAME":"Nedis WIFILW30","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":18} Nedis PAR16 4,5W 380lm {"NAME":"Nedis WIFILW10WTGU10","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":18} -Nedis PAR16 4.5W 330lm 110 {"NAME":"WIFILW30","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":18} +Nedis PAR16 4.5W 330lm 110° {"NAME":"WIFILW30","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":18} Nous P2 {"NAME":"NOUS-P2","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":37} Philips Zhirui Candle 250lm {"NAME":"Xiaomi Philips","GPIO":[0,0,0,0,0,0,0,0,417,0,0,416,0,0],"FLAG":0,"BASE":48} Phillips Zhirui 450lm {"NAME":"Xiaomi Philips","GPIO":[0,0,0,0,0,0,0,0,417,0,0,416,0,0],"FLAG":0,"BASE":48} @@ -150,7 +150,7 @@ Sulion Morgan C37 5W 470lm {"NAME":"Sulion Bombilla C37","GPIO":[0,0,0,0,0,0,0 Swisstone 806lm {"NAME":"SwisstoneSH330","GPIO":[0,0,0,0,2912,416,0,0,417,2976,2944,0,0,0],"FLAG":0,"BASE":18} Swisstone SH 310 {"NAME":"Swisstone SH 310","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":18} Treatlife A19 9W 800lm {"NAME":"Treatlife SL20","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":18} -V-Tac PAR16 4.5W 300lm 110 {"NAME":"V-TAC VT-5174","GPIO":[0,0,0,0,0,0,0,0,417,0,416,0,0,0],"FLAG":0,"BASE":18} +V-Tac PAR16 4.5W 300lm 110° {"NAME":"V-TAC VT-5174","GPIO":[0,0,0,0,0,0,0,0,417,0,416,0,0,0],"FLAG":0,"BASE":18} Vestaiot BR30 800lm {"NAME":"Vesta BR30 CCT","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":18} Wipro Garnet NS9100 810lm {"NAME":"Wipro 9W CCT","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":48} Wyze A19 800lm {"NAME":"Wyze Bulb","GPIO":[5728,0,0,0,0,0,0,0,0,416,417,0,0,0],"FLAG":0,"BASE":48} @@ -395,7 +395,7 @@ Nedis A60 Warm White 9W 800lm {"NAME":"WIFILW11WTE27","GPIO":[0,0,0,0,0,416,0,0 Nedis G125 Filament {"NAME":"WIFILF10GDG125","GPIO":[0,0,0,0,0,0,0,0,0,0,416,0,0,0],"FLAG":0,"BASE":18} Nedis PAR16 330lm {"NAME":"Nedis WIFILW31","GPIO":[0,0,0,0,0,416,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18} Nedis ST64 5W 500lm Filament {"NAME":"WIFILF10GDST64","GPIO":[0,0,0,0,0,0,0,0,0,0,416,0,0,0],"FLAG":0,"BASE":18} -Positivo Smart Lampada Retro {"NAME":"POSITIVO SMART LAMPADA RETRO","GPIO":[0,0,0,0,0,0,0,0,0,0,416,0,0,0],"FLAG":0,"BASE":18} +Positivo Smart Lâmpada Retrô {"NAME":"POSITIVO SMART LAMPADA RETRO","GPIO":[0,0,0,0,0,0,0,0,0,0,416,0,0,0],"FLAG":0,"BASE":18} Sealight Vintage Edison A19 {"NAME":"SealightEdison","GPIO":[0,0,0,0,0,416,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18} Shelly Vintage 4W 260lm 2700k {"NAME":"Shelly Vintage","GPIO":[0,0,0,0,416,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18} Shelly Vintage 7W 750lm 2700k {"NAME":"Shelly Vintage","GPIO":[0,0,0,0,416,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18} @@ -558,7 +558,7 @@ Goldair SleepSmart GCPF315 {"NAME":"Goldair Fan","GPIO":[0,0,0,0,0,0,0,0,0,230 Holmes 36" Oscillating Tower {"NAME":"Generic","GPIO":[1,1,1,1,1,1,1,1,1,1,1,1,1,1],"FLAG":0,"BASE":54,"CMND":"TuyaMcu 11,1 | TuyaMcu 12,5 | WebButton1 Power | WebButton2 Oscillation "} Lucci Connect Remote Control {"NAME":"Lucci Fan","GPIO":[0,0,0,0,0,0,0,0,0,2304,0,2272,0,0],"FLAG":0,"BASE":54} QuietCool Gable Mount Attic {"NAME":"QuietCool-AFG-SMT-PRO-2.0","GPIO":[0,0,0,0,0,224,0,0,0,0,0,0,0,0,640,608,0,0,0,225,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"Interlock 1|WebButton1 Low|WebButton2 High|SO8 1"} -Sichler Haushaltsgeraete Column {"NAME":"Sichler Fan","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54} +Sichler Haushaltsgeräte Column {"NAME":"Sichler Fan","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54} Technical Pro {"NAME":"FXA16 Fan","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54,"CMND":"TuyaMCU 12,8"} Zemismart Bladeless {"NAME":"Bladeless Fan","GPIO":[1,2272,1,2304,1,1,0,0,1,1,1,1,1,0],"FLAG":0,"BASE":54} ``` @@ -927,7 +927,7 @@ Zemismart Updated RF Remote Roller Shade {"NAME":"Zemismart M515EGB","GPIO":[1, ## Other ``` Kogan SmarterHome 1.9L Pet Water Fountain {"NAME":"WaterFountain","GPIO":[257,0,259,0,576,32,0,0,224,161,0,480,226,4704],"FLAG":0,"BASE":18} -Tetra Connect Automatic Feeder {"NAME":"Tetra Connect","GPIO":[0,0,0,0,224,288,0,0,98,96,97,0,289,0],"FLAG":0,"BASE":18} +Tetra® Connect Automatic Feeder {"NAME":"Tetra Connect","GPIO":[0,0,0,0,224,288,0,0,98,96,97,0,289,0],"FLAG":0,"BASE":18} ``` ## Outdoor Plug @@ -2037,7 +2037,7 @@ Teckin SB53 1300lm {"NAME":"Teckin SB53","GPIO":[0,0,0,0,416,419,0,0,4 Treatlife A19 8W 650lm {"NAME":"Treatlife RGBW","GPIO":[0,0,0,0,417,416,0,0,420,418,419,0,0,0],"FLAG":0,"BASE":18} V-TAC 10W 806lm {"NAME":"V-TAC VT-5119","GPIO":[0,0,0,0,4032,0,0,0,0,0,4064,0,0,0],"FLAG":0,"BASE":18} V-Tac A60 10W 806lm {"NAME":"V-Tac A60","GPIO":[0,0,0,0,416,417,0,0,418,419,420,0,0,0],"FLAG":0,"BASE":18,"CMND":"SetOption37 13"} -V-Tac PAR16 4.5W 400lm 100 {"NAME":"V-TAC VT5164","GPIO":[0,0,0,0,0,0,0,0,4064,0,4032,0,0,0],"FLAG":0,"BASE":18} +V-Tac PAR16 4.5W 400lm 100° {"NAME":"V-TAC VT5164","GPIO":[0,0,0,0,0,0,0,0,4064,0,4032,0,0,0],"FLAG":0,"BASE":18} Vizia 5W GU10 {"NAME":"Vizia RGBWW","GPIO":[0,0,0,0,419,420,0,0,417,418,416,0,0,1],"FLAG":0,"BASE":18} WdtPro 8W 800lm {"NAME":"WdtPro","GPIO":[0,0,0,0,419,420,0,0,417,418,416,0,0,0],"FLAG":0,"BASE":18} Wipro Garnet 9W 810lm {"NAME":"Wipro","GPIO":[0,0,0,0,416,419,0,0,417,420,418,0,0,0],"FLAG":0,"BASE":18} @@ -2140,7 +2140,7 @@ Kainsy 600lm {"NAME":"KAINSY","GPIO":[32,0,0,0,3008,3040,0,0,0,0 Kkmoon 9W 800lm {"NAME":"KKMOON V21","GPIO":[0,0,0,0,419,0,0,0,417,418,416,0,0,0],"FLAG":0,"BASE":18} Koaanw 650lm {"NAME":"KOAANW Bulb","GPIO":[0,0,0,0,3008,3040,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":27} Kogan 10W Ambient 1050lm {"NAME":"Kogan RGB","GPIO":[0,0,0,0,2912,416,0,0,0,0,2944,0,0,0],"FLAG":0,"BASE":18} -Kogan 4.5W 330lm 110 {"NAME":"Kogan_GU10","GPIO":[0,0,0,0,418,419,0,0,416,0,417,0,0,0],"FLAG":0,"BASE":18} +Kogan 4.5W 330lm 110° {"NAME":"Kogan_GU10","GPIO":[0,0,0,0,418,419,0,0,416,0,417,0,0,0],"FLAG":0,"BASE":18} Kogan Ambient Candle {"NAME":"Kogan_E14","GPIO":[0,0,0,0,416,419,0,0,417,0,418,0,0,0],"FLAG":0,"BASE":18} Kuled 800lm {"NAME":"KULED 60W RGB","GPIO":[0,0,0,0,418,419,0,0,416,0,417,0,0,4704],"FLAG":0,"BASE":18} Laideyi 7W {"NAME":"7W-E14-RGBW-La","GPIO":[0,0,0,0,417,416,0,0,418,0,419,0,0,0],"FLAG":0,"BASE":18} @@ -2590,7 +2590,7 @@ Nedis Dual {"NAME":"SM-SW102U-2","GPIO":[576,0,0,33,225,0,0,0, NEO Coolcam 2Ch Touch Light {"NAME":"Neo NAS-SC01W-2","GPIO":[0,0,0,0,225,0,0,0,32,224,33,0,544,0],"FLAG":0,"BASE":18} Nexete DS-123 {"NAME":"DS-123","GPIO":[544,321,1,32,224,33,0,0,1,225,320,1,1,0],"FLAG":0,"BASE":18} Nexete DS-123 Single {"NAME":"DS-123","GPIO":[544,0,1,33,0,32,0,0,1,224,320,1,1,0],"FLAG":0,"BASE":18} -Novadigital Interruptor Touch Led 1 Boto {"NAME":"Nova Digital Switch 1 Gang","GPIO":[544,0,0,32,224,0,0,0,0,0,288,0,0,0],"FLAG":0,"BASE":18} +Novadigital Interruptor Touch Led 1 Botão {"NAME":"Nova Digital Switch 1 Gang","GPIO":[544,0,0,32,224,0,0,0,0,0,288,0,0,0],"FLAG":0,"BASE":18} PNI SmartHome 1 Key {"NAME":"Tuya Switch 1 key","GPIO":[544,1,1,32,224,1,1,1,1,1,288,1,1,1],"FLAG":0,"BASE":18} PNI SmartHome 2 Keys {"NAME":"Tuya switch 2 key","GPIO":[544,0,289,0,0,32,0,0,33,225,0,224,288,0],"FLAG":0,"BASE":18} Prosto {"NAME":"Prosto WFS-T10","GPIO":[0,0,0,0,0,224,0,0,320,0,64,0,0,0],"FLAG":0,"BASE":18} @@ -2739,7 +2739,7 @@ ZUCZUG 3 Gang {"NAME":"2ph105626a x3","GPIO":[0,288,0,32,34,33,0, ## Switch Module ``` 2 CH Smart Switch {"NAME":"Generic","GPIO":[32,1,1,1,1,225,33,1,224,288,1,1,1,1],"FLAG":0,"BASE":18} -AGL Modulo Relay 01 Canal {"NAME":"AGL-Basic","GPIO":[0,1,0,0,224,32,0,0,0,0,320,0,0,0],"FLAG":0,"BASE":18} +AGL Módulo Relé 01 Canal {"NAME":"AGL-Basic","GPIO":[0,1,0,0,224,32,0,0,0,0,320,0,0,0],"FLAG":0,"BASE":18} Albohes 2 Channel {"NAME":"Albohes SH-08","GPIO":[0,3200,33,3232,321,320,0,0,224,544,32,0,225,1],"FLAG":0,"BASE":18} Athom 10A {"NAME":"CB01-TAS-1","GPIO":[0,0,0,32,320,0,0,0,0,224,0,0,0,1],"FLAG":0,"BASE":18} Athom 2Ch Inching/Self-locking {"NAME":"Athom R02","GPIO":[1,1,1,1,225,224,1,1,1,1,1,1,576,0],"FLAG":0,"BASE":18} From 50ccaede605bdb3a0f8319ccd52ff4774cd3d19e Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:10:01 +0200 Subject: [PATCH 2/9] Fix correct second I2C bus --- tasmota/tasmota_support/support_a_i2c.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasmota/tasmota_support/support_a_i2c.ino b/tasmota/tasmota_support/support_a_i2c.ino index 4a6aef726..11cd6238e 100644 --- a/tasmota/tasmota_support/support_a_i2c.ino +++ b/tasmota/tasmota_support/support_a_i2c.ino @@ -18,8 +18,10 @@ #endif // ESP8266 #ifdef ESP32 +#if SOC_I2C_NUM > 1 #define USE_I2C_BUS2 -#endif +#endif // SOC_I2C_NUM +#endif // ESP32 const uint8_t I2C_RETRY_COUNTER = 3; From 04f3df8bf6cb2ee3503b8360989479dff90dbe2c Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:49:11 +0200 Subject: [PATCH 3/9] Add command ``DaliWeb 1`` to enable light control for broadcast address - Change DaliDimmer range from 0..254 to 0..100 --- CHANGELOG.md | 2 + RELEASENOTES.md | 2 + tasmota/include/tasmota_types.h | 2 +- tasmota/tasmota_support/support_a_i2c.ino | 4 +- tasmota/tasmota_xdrv_driver/xdrv_04_light.ino | 9 ++- tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino | 57 +++++++++++++++---- 6 files changed, 60 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 829437c8a..d1bb269de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. - LVGL port `colorwheel` from LVGL 8 (#22244) - HASPmota `cpicker` and `msgbox` (#22244) - Support for DALI 1 on ESP8266 +- Command ``DaliWeb 1`` to enable light control for broadcast address ### Breaking Changed @@ -16,6 +17,7 @@ All notable changes to this project will be documented in this file. - ESP32 platform update from 2024.09.10 to 2024.09.30 and Framework (Arduino Core) from v3.0.5 to v3.1.0.240926 (#22203) - Berry improve `persist` dirty data handling (#22246) - HASPmota `delete` instead of `delete()` (#22245) +- Command ``DaliDimmer`` range from 0..254 to 0..100 ### Fixed - ESP32 Range Extender compile error with core 3.0.0 (#22205) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 818678882..2d6ad9844 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -117,6 +117,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm ## Changelog v14.2.0.6 ### Added - Command ``SetOption69 1`` to enable Serial Bridge inverted Receive [#22000](https://github.com/arendst/Tasmota/issues/22000) +- Command ``DaliWeb 1`` to enable light control for broadcast address - HX711 optional calibration precision option on command ``Sensor34 2 `` where `` is 1 to 20 [#13983](https://github.com/arendst/Tasmota/issues/13983) - ESP8266 support for one-wire M1601 temperature sensor on DS18x20 GPIO [#21376](https://github.com/arendst/Tasmota/issues/21376) - ESP8266 support for I2C CLK on GPIO16 [#22199](https://github.com/arendst/Tasmota/issues/22199) @@ -153,6 +154,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - Add command entered to command error and command unknown message - Refactored I2C drivers HTU21, BH1750, SHT3x, iAQ and HYT - Energy BL09xx command ``CurrentSet`` input changed from Ampere to milliAmpere +- Command ``DaliDimmer`` range from 0..254 to 0..100 - Energy force Apparent Power equals Active Power when (Calculated) Apparent Power is less than Active Power [#20653](https://github.com/arendst/Tasmota/issues/20653) - Refactor and fix PID sensor (PID_USE_LOCAL_SENSOR) read race condition [#22162](https://github.com/arendst/Tasmota/issues/22162) - SCD30 Lowered I2C clock from 100k to 50k [#15438](https://github.com/arendst/Tasmota/issues/15438) diff --git a/tasmota/include/tasmota_types.h b/tasmota/include/tasmota_types.h index 4a05f8570..a8936407e 100755 --- a/tasmota/include/tasmota_types.h +++ b/tasmota/include/tasmota_types.h @@ -289,7 +289,7 @@ typedef union { uint32_t influxdb_sensor : 1; // bit 10 (v11.0.0.5) - CMND_IFXSENSOR - Enable sensor support in addition to teleperiod support uint32_t ex_serbridge_console : 1; // bit 11 (v11.1.0.4) - (v14.1.0.2) Replaced by CMND_SSERIALMODE uint32_t telegram_disable_af : 1; // bit 12 (v14.0.0.2) - CMND_TMSTATE 6/7 - Disable Telegram auto-fingerprint fix - uint32_t spare13 : 1; // bit 13 + uint32_t dali_web : 1; // bit 13 (v14.2.0.6) - CMND_DALIWEB - Enable Dali web controls uint32_t spare14 : 1; // bit 14 uint32_t spare15 : 1; // bit 15 uint32_t spare16 : 1; // bit 16 diff --git a/tasmota/tasmota_support/support_a_i2c.ino b/tasmota/tasmota_support/support_a_i2c.ino index 11cd6238e..3b03a32c6 100644 --- a/tasmota/tasmota_support/support_a_i2c.ino +++ b/tasmota/tasmota_support/support_a_i2c.ino @@ -18,9 +18,9 @@ #endif // ESP8266 #ifdef ESP32 -#if SOC_I2C_NUM > 1 +#if CONFIG_SOC_HP_I2C_NUM > 1 #define USE_I2C_BUS2 -#endif // SOC_I2C_NUM +#endif // CONFIG_SOC_HP_I2C_NUM #endif // ESP32 const uint8_t I2C_RETRY_COUNTER = 3; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino b/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino index 7fe085f60..047da5b43 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino @@ -29,11 +29,16 @@ * 3 PWM3 RGB no (H801, MagicHome and Arilux LC01) * 4 PWM4 RGBW no (H801, MagicHome and Arilux) * 5 PWM5 RGBCW yes (H801, Arilux LC11) - * 9 reserved no - * 10 reserved yes + * 6 PWM6 + * 7 PWM7 + * 8 reserved + * 9 SERIAL1 no + * 10 SERIAL2 yes * 11 +WS2812 RGB no (One WS2812 RGB or RGBW ledstrip) * 12 AiLight RGBW no * 13 Sonoff B1 RGBCW yes + * 14 reserved + * 15 reserved * * light_scheme WS2812 3+ Colors 1+2 Colors Effect * ------------ ------ --------- ---------- ----------------- diff --git a/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino b/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino index c1e7a6eeb..06fb4086e 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino @@ -19,6 +19,8 @@ -------------------------------------------------------------------------------------------- Version yyyymmdd Action Description -------------------------------------------------------------------------------------------- + 0.1.0.3 20241010 update - Change DaliDimmer range from 0..254 to 0..100 + - Add command DaliWeb 0|1 to enable persistent Web light controls 0.1.0.2 20241008 update - Better receive error detection 0.1.0.1 20241007 update - To stablizie communication send Dali datagram twice like Busch-Jaeger does - Change DaliPower 0..2 to act like Tasmota Power (Off, On, Toggle) @@ -59,10 +61,10 @@ #define D_PRFX_DALI "Dali" const char kDALICommands[] PROGMEM = D_PRFX_DALI "|" // Prefix - "|" D_CMND_POWER "|" D_CMND_DIMMER; + "|" D_CMND_POWER "|" D_CMND_DIMMER "|Web"; void (* const DALICommand[])(void) PROGMEM = { - &CmndDali, &CmndDaliPower, &CmndDaliDimmer }; + &CmndDali, &CmndDaliPower, &CmndDaliDimmer, &CmndDaliWeb }; struct DALI { uint32_t bit_time; @@ -74,6 +76,7 @@ struct DALI { uint8_t dimmer; bool power; bool input_ready; + bool set_power; } *Dali = nullptr; /*********************************************************************************************\ @@ -172,8 +175,9 @@ void DaliPower(uint8_t val) { /***********************************************************/ void ResponseAppendDali(void) { + uint8_t dimmer = changeUIntScale(Dali->dimmer, 0, 254, 0, 100); ResponseAppend_P(PSTR("\"" D_PRFX_DALI "\":{\"Power\":\"%s\",\"Dimmer\":%d,\"Address\":%d,\"Command\":%d}"), - GetStateText(Dali->power), Dali->dimmer, Dali->address, Dali->command); + GetStateText(Dali->power), dimmer, Dali->address, Dali->command); } void ResponseDali(void) { @@ -201,11 +205,11 @@ void DaliInput(void) { } } -void DaliInit(void) { - if (!PinUsed(GPIO_DALI_TX) || !PinUsed(GPIO_DALI_RX)) { return; } +bool DaliInit(void) { + if (!PinUsed(GPIO_DALI_TX) || !PinUsed(GPIO_DALI_RX)) { return false; } Dali = (DALI*)calloc(sizeof(DALI), 1); - if (!Dali) { return; } + if (!Dali) { return false; } Dali->pin_rx = Pin(GPIO_DALI_RX); Dali->pin_tx = Pin(GPIO_DALI_TX); @@ -224,6 +228,23 @@ void DaliInit(void) { Dali->bit_time = ESP.getCpuFreqMHz() * 1000000 / 2400; // Manchester twice 1200 bps = 2400 bps = 417 ms DaliEnableRxInterrupt(); + + if (!Settings->sbflag1.dali_web) { // DaliWeb 0 + return false; + } + + UpdateDevicesPresent(1); + TasmotaGlobal.light_type = LT_SERIAL1; // Single channel + return true; +} + +bool DaliSetChannels(void) { + if (Settings->sbflag1.dali_web) { // DaliWeb 1 + uint8_t value = ((uint8_t*)XdrvMailbox.data)[0]; + if (255 == value) { value = 254; } // Max Dali value + DaliPower(value); + } + return true; } /*********************************************************************************************\ @@ -383,13 +404,24 @@ void CmndDaliPower(void) { } void CmndDaliDimmer(void) { - // DaliDimmer 0..254 - Set power off or dimmer state - if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 254)) { - DaliPower(XdrvMailbox.payload); + // DaliDimmer 0..100 - Set power off or dimmer state + if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 100)) { + uint8_t dimmer = changeUIntScale(XdrvMailbox.payload, 0, 100, 0, 254); + DaliPower(dimmer); } ResponseDali(); } +void CmndDaliWeb(void) { + // DaliWeb 0 - Disable GUI light controls + // DaliWeb 1 - Enable GUI light controls + if (XdrvMailbox.data_len > 0) { + Settings->sbflag1.dali_web = XdrvMailbox.payload &1; + TasmotaGlobal.restart_flag = 2; + } + ResponseCmndStateText(Settings->sbflag1.dali_web); +} + /*********************************************************************************************\ * Presentation \*********************************************************************************************/ @@ -408,8 +440,8 @@ void DaliShow(bool json) { bool Xdrv75(uint32_t function) { bool result = false; - if (FUNC_INIT == function) { - DaliInit(); + if (FUNC_MODULE_INIT == function) { + result = DaliInit(); } else if (Dali) { switch (function) { @@ -419,6 +451,9 @@ bool Xdrv75(uint32_t function) { case FUNC_MQTT_DATA: result = DaliMqtt(); break; + case FUNC_SET_CHANNELS: + result = DaliSetChannels(); + break; case FUNC_JSON_APPEND: DaliShow(true); break; From c7845f18641eada7de51650f01c242e543a354b3 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 10 Oct 2024 18:04:27 +0200 Subject: [PATCH 4/9] Dali add dimmer control --- tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino b/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino index 06fb4086e..462cc840e 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino @@ -190,17 +190,25 @@ void DaliInput(void) { if (Dali->input_ready) { Dali->address = Dali->received_dali_data >> 8; Dali->command = Dali->received_dali_data; + uint8_t dimmer = Dali->dimmer; if (BROADCAST_DP == Dali->address) { Dali->power = (Dali->command); // State if (Dali->power) { Dali->dimmer = Dali->command; // Value } } - // AddLog(LOG_LEVEL_DEBUG, PSTR("DLI: Received 0x%04X"), Dali->received_dali_data); - ResponseDali(); - MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_PRFX_DALI)); - + if (Settings->sbflag1.dali_web) { // DaliWeb 1 + if (dimmer != Dali->dimmer) { + dimmer = changeUIntScale(Dali->dimmer, 0, 254, 0, 100); + char scmnd[20]; + snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_DIMMER " %d"), dimmer); + ExecuteCommand(scmnd, SRC_SWITCH); + } + } else { + ResponseDali(); + MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_PRFX_DALI)); + } Dali->input_ready = false; } } From db47b92bc116754af3d6bceae34df1746227d237 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 10 Oct 2024 18:16:32 +0200 Subject: [PATCH 5/9] Dali add power control --- tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino | 24 ++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino b/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino index 462cc840e..2215b115c 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino @@ -190,22 +190,28 @@ void DaliInput(void) { if (Dali->input_ready) { Dali->address = Dali->received_dali_data >> 8; Dali->command = Dali->received_dali_data; - uint8_t dimmer = Dali->dimmer; + if (BROADCAST_DP == Dali->address) { + uint8_t dimmer = changeUIntScale(Dali->dimmer, 0, 254, 0, 100); + uint8_t power = Dali->power; Dali->power = (Dali->command); // State if (Dali->power) { Dali->dimmer = Dali->command; // Value } + if (Settings->sbflag1.dali_web) { // DaliWeb 1 + char scmnd[20]; + uint8_t dimmer_new = changeUIntScale(Dali->dimmer, 0, 254, 0, 100); + if (power != Dali->power) { + ExecuteCommandPower(1, Dali->power, SRC_SWITCH); // send SRC_SWITCH? to use as flag to prevent loop from inbound states from faceplate interaction + } + else if (dimmer != dimmer_new) { + snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_DIMMER " %d"), dimmer_new); + ExecuteCommand(scmnd, SRC_SWITCH); + } + } } // AddLog(LOG_LEVEL_DEBUG, PSTR("DLI: Received 0x%04X"), Dali->received_dali_data); - if (Settings->sbflag1.dali_web) { // DaliWeb 1 - if (dimmer != Dali->dimmer) { - dimmer = changeUIntScale(Dali->dimmer, 0, 254, 0, 100); - char scmnd[20]; - snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_DIMMER " %d"), dimmer); - ExecuteCommand(scmnd, SRC_SWITCH); - } - } else { + if (!Settings->sbflag1.dali_web) { // DaliWeb 0 ResponseDali(); MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_PRFX_DALI)); } From cc6ec3648f9dde1ba0272bde84aff95990f618e1 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Thu, 10 Oct 2024 19:50:57 +0200 Subject: [PATCH 6/9] Berry Zigbee removed test code (#22263) --- CHANGELOG.md | 1 + lib/libesp32/berry_tasmota/src/be_zigbee.c | 4 +- .../xdrv_52_3_berry_zigbee.ino | 84 +++++++++---------- 3 files changed, 45 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1bb269de..3239fd397 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ All notable changes to this project will be documented in this file. - ESP32 Ethernet using EthClockMode 3 (#22248) ### Removed +- Berry Zigbee removed test code ## [14.2.0.5] 20240926 ### Added diff --git a/lib/libesp32/berry_tasmota/src/be_zigbee.c b/lib/libesp32/berry_tasmota/src/be_zigbee.c index 2471dac49..8c5956796 100644 --- a/lib/libesp32/berry_tasmota/src/be_zigbee.c +++ b/lib/libesp32/berry_tasmota/src/be_zigbee.c @@ -127,8 +127,8 @@ class be_class_zb_coord_ntv (scope: global, name: zb_coord_ntv, strings: weak) { abort, ctype_func(zc_abort) - test_attr, func(zigbee_test_attr) - test_msg, func(zigbee_test_msg) + // test_attr, func(zigbee_test_attr) + // test_msg, func(zigbee_test_msg) } @const_object_info_end */ diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_zigbee.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_zigbee.ino index d169629d7..139ca4805 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_zigbee.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_zigbee.ino @@ -601,38 +601,38 @@ extern "C" { } extern "C" { - int zigbee_test_attr(struct bvm *vm) { - int32_t mode = be_toint(vm, 2); - if (mode < 10) { - // - } else { - Z_attribute *a = new Z_attribute(); - if (mode == 10) { - a->setKeyId(1111, 2222); - a->setUInt(1337); - } else if (mode == 11) { - a->setKeyName("super_attribute"); - a->key_suffix = 2; - a->setFloat(3.14); - } else if (mode == 12) { - a->setKeyName("array"); - a->newJsonArray(); - a->val.arrval->add((int32_t)-1); - a->val.arrval->addStr("foo"); - a->val.arrval->addStr("bar"); - a->val.arrval->addStr("bar\"baz\'toto"); - } else if (mode == 13) { - a->setKeyName("list"); - a->newAttrList(); - Z_attribute &subattr1 = a->val.objval->addAttribute(10,20); - subattr1.setStr("sub1"); - Z_attribute &subattr2 = a->val.objval->addAttribute(11,21); - subattr2.setStr("sub2"); - } - zat_zcl_attribute(vm, a); - } - be_return(vm); - } +// int zigbee_test_attr(struct bvm *vm) { +// int32_t mode = be_toint(vm, 2); +// if (mode < 10) { +// // +// } else { +// Z_attribute *a = new Z_attribute(); +// if (mode == 10) { +// a->setKeyId(1111, 2222); +// a->setUInt(1337); +// } else if (mode == 11) { +// a->setKeyName("super_attribute"); +// a->key_suffix = 2; +// a->setFloat(3.14); +// } else if (mode == 12) { +// a->setKeyName("array"); +// a->newJsonArray(); +// a->val.arrval->add((int32_t)-1); +// a->val.arrval->addStr("foo"); +// a->val.arrval->addStr("bar"); +// a->val.arrval->addStr("bar\"baz\'toto"); +// } else if (mode == 13) { +// a->setKeyName("list"); +// a->newAttrList(); +// Z_attribute &subattr1 = a->val.objval->addAttribute(10,20); +// subattr1.setStr("sub1"); +// Z_attribute &subattr2 = a->val.objval->addAttribute(11,21); +// subattr2.setStr("sub2"); +// } +// zat_zcl_attribute(vm, a); +// } +// be_return(vm); +// } // Creates a zcl_attributes from Z_attribute_list @@ -651,18 +651,18 @@ extern "C" { } } - int zigbee_test_msg(struct bvm *vm) { - Z_attribute_list attr_list; + // int zigbee_test_msg(struct bvm *vm) { + // Z_attribute_list attr_list; - attr_list.lqi = 250; - Z_attribute &subattr1 = attr_list.addAttribute(10,20); - subattr1.setStr("sub1"); - Z_attribute &subattr2 = attr_list.addAttribute(11,21); - subattr2.setStr("sub2"); + // attr_list.lqi = 250; + // Z_attribute &subattr1 = attr_list.addAttribute(10,20); + // subattr1.setStr("sub1"); + // Z_attribute &subattr2 = attr_list.addAttribute(11,21); + // subattr2.setStr("sub2"); - zat_zcl_attribute_list(vm, 100, &attr_list); - be_return(vm); - } + // zat_zcl_attribute_list(vm, 100, &attr_list); + // be_return(vm); + // } } #endif // USE_ZIGBEE From d6a15aa5dc824016023525d308f018838e9a9a6f Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Thu, 10 Oct 2024 23:20:07 +0200 Subject: [PATCH 7/9] Temporarily disable SPI DMA for uDisplay (broken since esp-idf 5.3) (#22264) --- CHANGELOG.md | 1 + lib/lib_display/UDisplay/uDisplay.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3239fd397..a8ec7b42a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ All notable changes to this project will be documented in this file. - ESP32 Dali compile error with core 3.x (#22214) - Dali received data decoding - ESP32 Ethernet using EthClockMode 3 (#22248) +- Temporarily disable SPI DMA for uDisplay (broken since esp-idf 5.3) ### Removed - Berry Zigbee removed test code diff --git a/lib/lib_display/UDisplay/uDisplay.cpp b/lib/lib_display/UDisplay/uDisplay.cpp index fe32897cb..bbb4267bd 100755 --- a/lib/lib_display/UDisplay/uDisplay.cpp +++ b/lib/lib_display/UDisplay/uDisplay.cpp @@ -599,6 +599,10 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) { case 'B': lvgl_param.flushlines = next_val(&lp1); lvgl_param.data = next_val(&lp1); + // temporary fix to disable DMA due to a problem in esp-idf 5.3 +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0) + lvgl_param.use_dma = false; +#endif break; case 'M': rotmap_xmin = next_val(&lp1); From f2c61c44966996691ae08a2a6c7c5cf827219386 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 11 Oct 2024 00:19:29 +0200 Subject: [PATCH 8/9] Fix uDisplay compile error (#22266) * only esp32 --- lib/lib_display/UDisplay/uDisplay.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/lib_display/UDisplay/uDisplay.cpp b/lib/lib_display/UDisplay/uDisplay.cpp index bbb4267bd..e4610223d 100755 --- a/lib/lib_display/UDisplay/uDisplay.cpp +++ b/lib/lib_display/UDisplay/uDisplay.cpp @@ -600,8 +600,10 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) { lvgl_param.flushlines = next_val(&lp1); lvgl_param.data = next_val(&lp1); // temporary fix to disable DMA due to a problem in esp-idf 5.3 +#ifdef ESP32 #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0) lvgl_param.use_dma = false; +#endif #endif break; case 'M': From a839144491bfde1a8461d24259b11de82188e7bb Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 11 Oct 2024 11:54:08 +0200 Subject: [PATCH 9/9] Update changelogs --- CHANGELOG.md | 6 +- RELEASENOTES.md | 4 +- tasmota/tasmota_support/support_a_i2c.ino | 4 +- tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino | 70 ++++++++++++++------ 4 files changed, 57 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8ec7b42a..d1bcfd51b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ All notable changes to this project will be documented in this file. - LVGL port `colorwheel` from LVGL 8 (#22244) - HASPmota `cpicker` and `msgbox` (#22244) - Support for DALI 1 on ESP8266 -- Command ``DaliWeb 1`` to enable light control for broadcast address +- Command ``DaliWeb 1`` to enable light control for Dali broadcast address ### Breaking Changed @@ -26,10 +26,10 @@ All notable changes to this project will be documented in this file. - ESP32 Dali compile error with core 3.x (#22214) - Dali received data decoding - ESP32 Ethernet using EthClockMode 3 (#22248) -- Temporarily disable SPI DMA for uDisplay (broken since esp-idf 5.3) +- ESP32 disable SPI DMA for uDisplay (broken since esp-idf 5.3 (core 3.1.0)) (#22264) ### Removed -- Berry Zigbee removed test code +- Berry Zigbee removed test code (#22263) ## [14.2.0.5] 20240926 ### Added diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 2d6ad9844..86402535f 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -117,7 +117,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm ## Changelog v14.2.0.6 ### Added - Command ``SetOption69 1`` to enable Serial Bridge inverted Receive [#22000](https://github.com/arendst/Tasmota/issues/22000) -- Command ``DaliWeb 1`` to enable light control for broadcast address +- Command ``DaliWeb 1`` to enable light control for Dali broadcast address - HX711 optional calibration precision option on command ``Sensor34 2 `` where `` is 1 to 20 [#13983](https://github.com/arendst/Tasmota/issues/13983) - ESP8266 support for one-wire M1601 temperature sensor on DS18x20 GPIO [#21376](https://github.com/arendst/Tasmota/issues/21376) - ESP8266 support for I2C CLK on GPIO16 [#22199](https://github.com/arendst/Tasmota/issues/22199) @@ -179,6 +179,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - ESP32 Range Extender compile error with core 3.x [#22205](https://github.com/arendst/Tasmota/issues/22205) - ESP32 Dali compile error with core 3.x [#22214](https://github.com/arendst/Tasmota/issues/22214) - ESP32 Ethernet using EthClockMode 3 [#22248](https://github.com/arendst/Tasmota/issues/22248) +- ESP32 disable SPI DMA for uDisplay (broken since esp-idf 5.3 (core 3.1.0)) [#22264](https://github.com/arendst/Tasmota/issues/22264) - Berry avoid `readbytes()` from crashing when file is too large [#22057](https://github.com/arendst/Tasmota/issues/22057) - Berry energy missing attributes [#22116](https://github.com/arendst/Tasmota/issues/22116) - Berry I2C to prepare M5Stack I2C STM32 based devices [#22143](https://github.com/arendst/Tasmota/issues/22143) @@ -196,3 +197,4 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm ### Removed - ESP8266 Analog input support using energy driver as only one channel is available - Berry remove reuse of methods for interface-like code reuse #21500 [#22055](https://github.com/arendst/Tasmota/issues/22055) +- Berry Zigbee removed test code [#22263](https://github.com/arendst/Tasmota/issues/22263) diff --git a/tasmota/tasmota_support/support_a_i2c.ino b/tasmota/tasmota_support/support_a_i2c.ino index 3b03a32c6..d5a602207 100644 --- a/tasmota/tasmota_support/support_a_i2c.ino +++ b/tasmota/tasmota_support/support_a_i2c.ino @@ -18,9 +18,9 @@ #endif // ESP8266 #ifdef ESP32 -#if CONFIG_SOC_HP_I2C_NUM > 1 +#if SOC_HP_I2C_NUM > 1 #define USE_I2C_BUS2 -#endif // CONFIG_SOC_HP_I2C_NUM +#endif // SOC_HP_I2C_NUM #endif // ESP32 const uint8_t I2C_RETRY_COUNTER = 3; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino b/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino index 2215b115c..2789ca948 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_75_dali.ino @@ -55,16 +55,24 @@ #define DALI_DEBUG_PIN 4 #endif -#define BROADCAST_DP 0b11111110 // 0xFE = 254 +#define DALI_BROADCAST_DP 0b11111110 // 0xFE = 254 #define DALI_TOPIC "DALI" #define D_PRFX_DALI "Dali" const char kDALICommands[] PROGMEM = D_PRFX_DALI "|" // Prefix - "|" D_CMND_POWER "|" D_CMND_DIMMER "|Web"; + "|" D_CMND_POWER +#ifdef USE_LIGHT + "|Web" +#endif // USE_LIGHT + "|" D_CMND_DIMMER ; void (* const DALICommand[])(void) PROGMEM = { - &CmndDali, &CmndDaliPower, &CmndDaliDimmer, &CmndDaliWeb }; + &CmndDali, &CmndDaliPower, +#ifdef USE_LIGHT + &CmndDaliWeb, +#endif // USE_LIGHT + &CmndDaliDimmer }; struct DALI { uint32_t bit_time; @@ -75,8 +83,7 @@ struct DALI { uint8_t command; uint8_t dimmer; bool power; - bool input_ready; - bool set_power; + bool available; } *Dali = nullptr; /*********************************************************************************************\ @@ -95,7 +102,7 @@ void DaliDisableRxInterrupt(void) { void IRAM_ATTR DaliReceiveData(void); // Fix ESP8266 ISR not in IRAM! exception void DaliReceiveData(void) { - if (Dali->input_ready) { return; } // Skip if last input is not yet handled + if (Dali->available) { return; } // Skip if last input is not yet handled uint32_t wait = ESP.getCycleCount() + (Dali->bit_time / 2); int bit_state = 0; bool dali_read; @@ -120,7 +127,7 @@ void DaliReceiveData(void) { if (abs(bit_state) <= 2) { // Valid Manchester encoding including start and stop bits if (Dali->received_dali_data != received_dali_data) { // Skip duplicates Dali->received_dali_data = received_dali_data; - Dali->input_ready = true; // Valid data received + Dali->available = true; // Valid data received } } } @@ -150,7 +157,7 @@ void DaliSendDataOnce(uint16_t send_dali_data) { void DaliSendData(uint8_t firstByte, uint8_t secondByte) { Dali->address = firstByte; Dali->command = secondByte; - if (BROADCAST_DP == firstByte) { + if (DALI_BROADCAST_DP == firstByte) { Dali->power = (secondByte); // State if (Dali->power) { Dali->dimmer = secondByte; // Value @@ -169,7 +176,7 @@ void DaliSendData(uint8_t firstByte, uint8_t secondByte) { } void DaliPower(uint8_t val) { - DaliSendData(BROADCAST_DP, val); + DaliSendData(DALI_BROADCAST_DP, val); } /***********************************************************/ @@ -187,35 +194,46 @@ void ResponseDali(void) { } void DaliInput(void) { - if (Dali->input_ready) { + if (Dali->available) { Dali->address = Dali->received_dali_data >> 8; Dali->command = Dali->received_dali_data; - if (BROADCAST_DP == Dali->address) { - uint8_t dimmer = changeUIntScale(Dali->dimmer, 0, 254, 0, 100); - uint8_t power = Dali->power; +#ifdef USE_LIGHT + if (DALI_BROADCAST_DP == Dali->address) { + uint8_t dimmer_old = changeUIntScale(Dali->dimmer, 0, 254, 0, 100); + uint8_t power_old = Dali->power; Dali->power = (Dali->command); // State if (Dali->power) { Dali->dimmer = Dali->command; // Value } if (Settings->sbflag1.dali_web) { // DaliWeb 1 - char scmnd[20]; uint8_t dimmer_new = changeUIntScale(Dali->dimmer, 0, 254, 0, 100); - if (power != Dali->power) { - ExecuteCommandPower(1, Dali->power, SRC_SWITCH); // send SRC_SWITCH? to use as flag to prevent loop from inbound states from faceplate interaction + if (power_old != Dali->power) { + ExecuteCommandPower(LightDevice(), Dali->power, SRC_SWITCH); } - else if (dimmer != dimmer_new) { + else if (dimmer_old != dimmer_new) { + char scmnd[20]; snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_DIMMER " %d"), dimmer_new); ExecuteCommand(scmnd, SRC_SWITCH); } } } -// AddLog(LOG_LEVEL_DEBUG, PSTR("DLI: Received 0x%04X"), Dali->received_dali_data); if (!Settings->sbflag1.dali_web) { // DaliWeb 0 ResponseDali(); MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_PRFX_DALI)); } - Dali->input_ready = false; +#else + if (DALI_BROADCAST_DP == Dali->address) { + Dali->power = (Dali->command); // State + if (Dali->power) { + Dali->dimmer = Dali->command; // Value + } + } + ResponseDali(); + MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_PRFX_DALI)); +#endif // USE_LIGHT + + Dali->available = false; } } @@ -243,6 +261,7 @@ bool DaliInit(void) { DaliEnableRxInterrupt(); +#ifdef USE_LIGHT if (!Settings->sbflag1.dali_web) { // DaliWeb 0 return false; } @@ -250,8 +269,12 @@ bool DaliInit(void) { UpdateDevicesPresent(1); TasmotaGlobal.light_type = LT_SERIAL1; // Single channel return true; +#else + return false; +#endif // USE_LIGHT } +#ifdef USE_LIGHT bool DaliSetChannels(void) { if (Settings->sbflag1.dali_web) { // DaliWeb 1 uint8_t value = ((uint8_t*)XdrvMailbox.data)[0]; @@ -260,6 +283,7 @@ bool DaliSetChannels(void) { } return true; } +#endif // USE_LIGHT /*********************************************************************************************\ * Experimental - Not functioning @@ -298,7 +322,7 @@ bool DaliMqtt(void) { int DALIindex = 0; int ADRindex = 0; int CMDindex = 0; - uint8_t DALIaddr = BROADCAST_DP; + uint8_t DALIaddr = DALI_BROADCAST_DP; if (strcasecmp_P(items[cnt - 3], PSTR(DALI_TOPIC)) != 0) { // dali // cmnd @@ -355,7 +379,7 @@ bool DaliJsonParse(void) { int DALIindex = 0; int ADRindex = 0; int8_t DALIdim = -1; - uint8_t DALIaddr = BROADCAST_DP; + uint8_t DALIaddr = DALI_BROADCAST_DP; JsonParserToken val = root[PSTR("cmd")]; if (val) { @@ -426,6 +450,7 @@ void CmndDaliDimmer(void) { ResponseDali(); } +#ifdef USE_LIGHT void CmndDaliWeb(void) { // DaliWeb 0 - Disable GUI light controls // DaliWeb 1 - Enable GUI light controls @@ -435,6 +460,7 @@ void CmndDaliWeb(void) { } ResponseCmndStateText(Settings->sbflag1.dali_web); } +#endif // USE_LIGHT /*********************************************************************************************\ * Presentation @@ -465,9 +491,11 @@ bool Xdrv75(uint32_t function) { case FUNC_MQTT_DATA: result = DaliMqtt(); break; +#ifdef USE_LIGHT case FUNC_SET_CHANNELS: result = DaliSetChannels(); break; +#endif // USE_LIGHT case FUNC_JSON_APPEND: DaliShow(true); break;