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] 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;