mirror of https://github.com/arendst/Tasmota.git
Add command ``DaliWeb 1`` to enable light control for broadcast address
- Change DaliDimmer range from 0..254 to 0..100
This commit is contained in:
parent
50ccaede60
commit
04f3df8bf6
|
@ -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)
|
||||
|
|
|
@ -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 <weight in gram> <precision>`` where `<precision>` 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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
* ------------ ------ --------- ---------- -----------------
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue