mirror of https://github.com/arendst/Tasmota.git
Fix ESP32(C3) DALI transmit stability by disabling interrupts
This commit is contained in:
parent
0fd16f8725
commit
16a145f809
|
@ -13,8 +13,8 @@ All notable changes to this project will be documented in this file.
|
||||||
- Mitsubishi Electric HVAC Compressor Frequency for MiElHVAC (#22347)
|
- Mitsubishi Electric HVAC Compressor Frequency for MiElHVAC (#22347)
|
||||||
- SolaxX1 Meter mode (#22330)
|
- SolaxX1 Meter mode (#22330)
|
||||||
- DALI inverted signal configuration using GPIO DALI RX_i/TX_i
|
- DALI inverted signal configuration using GPIO DALI RX_i/TX_i
|
||||||
- Experimental support for Shelly DALI Dimmer Gen3 (See template in file xdrv_75_dali.ino)
|
- Support for Shelly DALI Dimmer Gen3 (See tips and template in file xdrv_75_dali.ino)
|
||||||
- HASPmota `haspmota.get_pages()` to get the sorted list of pages
|
- HASPmota `haspmota.get_pages()` to get the sorted list of pages (#22358)
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
|
|
||||||
|
|
|
@ -121,12 +121,13 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
||||||
- DALI command `DaliGroup` to add gear to groups
|
- DALI command `DaliGroup` to add gear to groups
|
||||||
- DALI command `DaliTarget` to set light control broadcast, group number or gear number
|
- DALI command `DaliTarget` to set light control broadcast, group number or gear number
|
||||||
- DALI inverted signal configuration using GPIO DALI RX_i/TX_i
|
- DALI inverted signal configuration using GPIO DALI RX_i/TX_i
|
||||||
- Experimental support for Shelly DALI Dimmer Gen3 (See template in file xdrv_75_dali.ino)
|
- Support for Shelly DALI Dimmer Gen3 (See tips and template in file xdrv_75_dali.ino)
|
||||||
- Mitsubishi Electric HVAC Operation time for MiElHVAC [#22334](https://github.com/arendst/Tasmota/issues/22334)
|
- Mitsubishi Electric HVAC Operation time for MiElHVAC [#22334](https://github.com/arendst/Tasmota/issues/22334)
|
||||||
- Mitsubishi Electric HVAC Outdoor Temperature for MiElHVAC [#22345](https://github.com/arendst/Tasmota/issues/22345)
|
- Mitsubishi Electric HVAC Outdoor Temperature for MiElHVAC [#22345](https://github.com/arendst/Tasmota/issues/22345)
|
||||||
- Mitsubishi Electric HVAC Compressor Frequency for MiElHVAC [#22347](https://github.com/arendst/Tasmota/issues/22347)
|
- Mitsubishi Electric HVAC Compressor Frequency for MiElHVAC [#22347](https://github.com/arendst/Tasmota/issues/22347)
|
||||||
- SolaxX1 Meter mode [#22330](https://github.com/arendst/Tasmota/issues/22330)
|
- SolaxX1 Meter mode [#22330](https://github.com/arendst/Tasmota/issues/22330)
|
||||||
- BLE track devices with RPA [#22300](https://github.com/arendst/Tasmota/issues/22300)
|
- BLE track devices with RPA [#22300](https://github.com/arendst/Tasmota/issues/22300)
|
||||||
|
- HASPmota `haspmota.get_pages()` to get the sorted list of pages [#22358](https://github.com/arendst/Tasmota/issues/22358)
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
--------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------
|
||||||
Version yyyymmdd Action Description
|
Version yyyymmdd Action Description
|
||||||
--------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------
|
||||||
|
1.0.0.2 20241025 update - Fix GPIO detection
|
||||||
|
- Fix ESP32(C3) transmit stability by disabling interrupts
|
||||||
1.0.0.1 20241024 update - Change from signal invert defines to GPIO config DALI RX_i/DALI TX_i
|
1.0.0.1 20241024 update - Change from signal invert defines to GPIO config DALI RX_i/DALI TX_i
|
||||||
- Fix inverted DALI signal support
|
- Fix inverted DALI signal support
|
||||||
- Experimental support for Shelly DALI Dimmer Gen3
|
- Experimental support for Shelly DALI Dimmer Gen3
|
||||||
|
@ -67,11 +69,11 @@
|
||||||
* DaliSend <0xA3>,<byte2>,<byte3>,<byte4> - Set DALI parameter using DTR0 and do not expect a DALI backward frame
|
* DaliSend <0xA3>,<byte2>,<byte3>,<byte4> - Set DALI parameter using DTR0 and do not expect a DALI backward frame
|
||||||
* DaliQuery <byte1>,<byte2> - Execute DALI code and report result (DALI backward frame)
|
* DaliQuery <byte1>,<byte2> - Execute DALI code and report result (DALI backward frame)
|
||||||
* DaliScan 1|2 - Reset (0) or (1)/and commission device short addresses
|
* DaliScan 1|2 - Reset (0) or (1)/and commission device short addresses
|
||||||
* DaliGear 1..64 - Set max short address to speed up scanning - default is 64
|
* DaliGear 1..64 - Set max short address to speed up scanning - default 64
|
||||||
* DaliGroup<1..16> [+]|-<device>,<device>... - Add(+) or Remove(-) devices to/from group
|
* DaliGroup<1..16> [+]|-<device>,<device>... - Add(+) or Remove(-) devices to/from group
|
||||||
* DaliPower<broadcast>|<device>|<group> 0..254 - Control power (0 = Off, 1 = Last dimmer, 2 = Toggle, 3..254 = absolute light brightness)
|
* DaliPower<broadcast>|<device>|<group> 0..254 - Control power (0 = Off, 1 = Last dimmer, 2 = Toggle, 3..254 = absolute light brightness)
|
||||||
* DaliDimmer<broadcast>|<device>|<group> 0..100 - Control dimmer (0 = Off, 1..100 = precentage of brightness)
|
* DaliDimmer<broadcast>|<device>|<group> 0..100 - Control dimmer (0 = Off, 1..100 = precentage of brightness)
|
||||||
* DaliLight 0|1 - Enable Tasmota light control for DaliTarget device
|
* DaliLight 0|1 - Enable Tasmota light control for DaliTarget device - default 1
|
||||||
* DaliTarget <broadcast>|<device>|<group> - Set Tasmota light control device (0, 1..64, 101..116) - default 0
|
* DaliTarget <broadcast>|<device>|<group> - Set Tasmota light control device (0, 1..64, 101..116) - default 0
|
||||||
*
|
*
|
||||||
* DALI background information
|
* DALI background information
|
||||||
|
@ -83,10 +85,10 @@
|
||||||
* Special command 101CCCC1 to 110CCCC1
|
* Special command 101CCCC1 to 110CCCC1
|
||||||
* A = Address bit, S = 0 Direct Arc Power control, S = 1 Command, C = Special command
|
* A = Address bit, S = 0 Direct Arc Power control, S = 1 Command, C = Special command
|
||||||
*
|
*
|
||||||
* Shelly DALI Dimmer Gen3 (ESP32C3-8M)
|
* Shelly DALI Dimmer Gen3 (ESP32C3-8M) - GPIO3 controls DALI power. In following template it is always ON. Max output is 16V/10mA (= 5 DALI gear)
|
||||||
* Template {"NAME":"Shelly DALI Dimmer Gen3","GPIO":[34,4736,1,3840,11360,11392,128,129,1,1,576,0,0,0,0,0,0,0,0,1,1,1],"FLAG":0,"BASE":1}
|
* Template {"NAME":"Shelly DALI Dimmer Gen3","GPIO":[34,4736,0,3840,11360,11392,128,129,0,1,576,0,0,0,0,0,0,0,0,1,1,1],"FLAG":0,"BASE":1}
|
||||||
* AdcGpio1 10000,10000,4000 <- Temperature parameters
|
* AdcGpio1 10000,10000,4000 <- Temperature parameters
|
||||||
* Backlog ButtonTopic 0; SetOption1 1; SetOption11 0; SetOption32 20
|
* Backlog ButtonTopic 0; SetOption1 1; SetOption11 0; SetOption32 20; DimmerStep 5; LedTable 0
|
||||||
* rule1 on button1#state=2 do dimmer + endon on button2#state=2 do dimmer - endon on button1#state=3 do power 2 endon on button2#state=3 do power 2 endon
|
* rule1 on button1#state=2 do dimmer + endon on button2#state=2 do dimmer - endon on button1#state=3 do power 2 endon on button2#state=3 do power 2 endon
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
|
@ -449,8 +451,14 @@ void DaliSendDataOnce(uint16_t send_dali_data) {
|
||||||
bool dali_read;
|
bool dali_read;
|
||||||
bool collision = false;
|
bool collision = false;
|
||||||
uint32_t bit_pos = 15;
|
uint32_t bit_pos = 15;
|
||||||
uint32_t wait = ESP.getCycleCount();
|
|
||||||
uint32_t bit_number = 0;
|
uint32_t bit_number = 0;
|
||||||
|
|
||||||
|
#ifdef ESP32
|
||||||
|
{portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
|
||||||
|
portENTER_CRITICAL(&mux);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint32_t wait = ESP.getCycleCount();
|
||||||
while (bit_number < 35) { // 417 * 35 = 14.7 ms
|
while (bit_number < 35) { // 417 * 35 = 14.7 ms
|
||||||
if (!collision) {
|
if (!collision) {
|
||||||
if (0 == (bit_number &1)) { // Even bit
|
if (0 == (bit_number &1)) { // Even bit
|
||||||
|
@ -482,6 +490,11 @@ void DaliSendDataOnce(uint16_t send_dali_data) {
|
||||||
|
|
||||||
bit_number++;
|
bit_number++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ESP32
|
||||||
|
portEXIT_CRITICAL(&mux);}
|
||||||
|
#endif
|
||||||
|
|
||||||
// delayMicroseconds(1100); // Adds to total 15.8 ms
|
// delayMicroseconds(1100); // Adds to total 15.8 ms
|
||||||
Dali->last_activity = millis();
|
Dali->last_activity = millis();
|
||||||
}
|
}
|
||||||
|
@ -516,7 +529,7 @@ void DaliSendData(uint32_t adr, uint32_t cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DALI_DEBUG
|
#ifdef DALI_DEBUG
|
||||||
AddLog(LOG_LEVEL_DEBUG, PSTR("DLI: SendData Repeat %d, Adr 0x%02X, Cmd 0x%02x"), repeat, adr, cmd);
|
AddLog(LOG_LEVEL_DEBUG, PSTR("DLI: Tx 0x%d%02X%02X"), repeat, adr, cmd);
|
||||||
#endif // DALI_DEBUG
|
#endif // DALI_DEBUG
|
||||||
|
|
||||||
uint16_t send_dali_data = adr << 8 | cmd;
|
uint16_t send_dali_data = adr << 8 | cmd;
|
||||||
|
@ -547,7 +560,7 @@ int DaliSendWaitResponse(uint32_t adr, uint32_t cmd, uint32_t timeout) {
|
||||||
Dali->response = false;
|
Dali->response = false;
|
||||||
|
|
||||||
#ifdef DALI_DEBUG
|
#ifdef DALI_DEBUG
|
||||||
AddLog(LOG_LEVEL_DEBUG, PSTR("DLI: SendWaitResponse result %d = 0x%04X"), result, result);
|
AddLog(LOG_LEVEL_DEBUG, PSTR("DLI: Rx 0x%05X"), result);
|
||||||
#endif // DALI_DEBUG
|
#endif // DALI_DEBUG
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -603,8 +616,9 @@ uint32_t DaliGearPresent(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DaliInitLight(void) {
|
void DaliInitLight(void) {
|
||||||
// Taken from Shelly Dali Dimmer ;-)
|
|
||||||
Settings->light_fade = 0; // Use Dali fading
|
Settings->light_fade = 0; // Use Dali fading
|
||||||
|
Settings->light_correction = 0; // Use Dali light correction
|
||||||
|
// Taken from Shelly Dali Dimmer ;-)
|
||||||
DaliSendData(DALI_DATA_TRANSFER_REGISTER0, DALI_INIT_FADE); // Fade x second
|
DaliSendData(DALI_DATA_TRANSFER_REGISTER0, DALI_INIT_FADE); // Fade x second
|
||||||
DaliSendData(0xFF, DALI_SET_FADE_TIME);
|
DaliSendData(0xFF, DALI_SET_FADE_TIME);
|
||||||
DaliSendData(DALI_DATA_TRANSFER_REGISTER0, 0); // Power off after gear power restore
|
DaliSendData(DALI_DATA_TRANSFER_REGISTER0, 0); // Power off after gear power restore
|
||||||
|
@ -830,6 +844,7 @@ void DaliEverySecond(void) {
|
||||||
bool DaliSetChannels(void) {
|
bool DaliSetChannels(void) {
|
||||||
if (Settings->sbflag1.dali_light) { // DaliLight 1
|
if (Settings->sbflag1.dali_light) { // DaliLight 1
|
||||||
Settings->light_fade = 0; // Use Dali fading
|
Settings->light_fade = 0; // Use Dali fading
|
||||||
|
Settings->light_correction = 0; // Use Dali light correction
|
||||||
if (Dali->light_sync) { // Block local loop
|
if (Dali->light_sync) { // Block local loop
|
||||||
Dali->light_sync = false;
|
Dali->light_sync = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -848,7 +863,7 @@ bool DaliInit(void) {
|
||||||
Dali = (DALI*)calloc(sizeof(DALI), 1);
|
Dali = (DALI*)calloc(sizeof(DALI), 1);
|
||||||
if (!Dali) { return false; }
|
if (!Dali) { return false; }
|
||||||
|
|
||||||
Dali->pin_tx = -1;
|
Dali->pin_tx = 255;
|
||||||
if (PinUsed(GPIO_DALI_TX)) {
|
if (PinUsed(GPIO_DALI_TX)) {
|
||||||
Dali->pin_tx = Pin(GPIO_DALI_TX);
|
Dali->pin_tx = Pin(GPIO_DALI_TX);
|
||||||
}
|
}
|
||||||
|
@ -856,7 +871,7 @@ bool DaliInit(void) {
|
||||||
Dali->pin_tx = Pin(GPIO_DALI_TX_INV);
|
Dali->pin_tx = Pin(GPIO_DALI_TX_INV);
|
||||||
Dali->invert_tx = true;
|
Dali->invert_tx = true;
|
||||||
}
|
}
|
||||||
Dali->pin_rx = -1;
|
Dali->pin_rx = 255;
|
||||||
if (PinUsed(GPIO_DALI_RX)) {
|
if (PinUsed(GPIO_DALI_RX)) {
|
||||||
Dali->pin_rx = Pin(GPIO_DALI_RX);
|
Dali->pin_rx = Pin(GPIO_DALI_RX);
|
||||||
}
|
}
|
||||||
|
@ -864,7 +879,7 @@ bool DaliInit(void) {
|
||||||
Dali->pin_rx = Pin(GPIO_DALI_RX_INV);
|
Dali->pin_rx = Pin(GPIO_DALI_RX_INV);
|
||||||
Dali->invert_rx = true;
|
Dali->invert_rx = true;
|
||||||
}
|
}
|
||||||
if ((-1 == Dali->pin_tx) || (-1 == Dali->pin_rx)) {
|
if ((255 == Dali->pin_tx) || (255 == Dali->pin_rx)) {
|
||||||
free(Dali);
|
free(Dali);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -893,6 +908,7 @@ bool DaliInit(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings->light_fade = 0; // Use Dali fading instead
|
Settings->light_fade = 0; // Use Dali fading instead
|
||||||
|
Settings->light_correction = 0; // Use Dali light correction
|
||||||
UpdateDevicesPresent(1);
|
UpdateDevicesPresent(1);
|
||||||
TasmotaGlobal.light_type = LT_SERIAL1; // Single channel
|
TasmotaGlobal.light_type = LT_SERIAL1; // Single channel
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue