mirror of https://github.com/arendst/Tasmota.git
Add Tuya Dimmer 10 second heartbeat
Some newer dimmer modules require the stock firmware method of sending a heartbeat packet every 10-11 seconds to the secondary MCU. This was tested on 2 other Tuya based dimmers that did not require this heartbeat packet and no adverse impacts have been found.
This commit is contained in:
parent
768cf56ee8
commit
39615c0700
|
@ -52,6 +52,7 @@ uint8_t tuya_cmd_status = 0; // Current status of serial-read
|
|||
uint8_t tuya_cmd_checksum = 0; // Checksum of tuya command
|
||||
uint8_t tuya_data_len = 0; // Data lenght of command
|
||||
int8_t tuya_wifi_state = -2; // Keep MCU wifi-status in sync with WifiState()
|
||||
uint8_t tuya_heartbeat_timer = 0; // 10 second heartbeat timer for tuya module
|
||||
|
||||
char *tuya_buffer = nullptr; // Serial receive buffer
|
||||
int tuya_byte_counter = 0; // Index in serial receive buffer
|
||||
|
@ -294,6 +295,7 @@ void TuyaInit(void)
|
|||
TuyaSendCmd(TUYA_CMD_MCU_CONF);
|
||||
}
|
||||
}
|
||||
tuya_heartbeat_timer = 0; // init heartbeat timer when dimmer init is done
|
||||
}
|
||||
|
||||
void TuyaSerialInput(void)
|
||||
|
@ -410,6 +412,11 @@ bool Xdrv16(uint8_t function)
|
|||
break;
|
||||
case FUNC_EVERY_SECOND:
|
||||
if(TuyaSerial && tuya_wifi_state!=WifiState()) { TuyaSetWifiLed(); }
|
||||
tuya_heartbeat_timer++;
|
||||
if (tuya_heartbeat_timer > 10) {
|
||||
tuya_heartbeat_timer = 0;
|
||||
TuyaSendCmd(TUYA_CMD_HEARTBEAT);
|
||||
}
|
||||
break;
|
||||
case FUNC_SET_CHANNELS:
|
||||
result = TuyaSetChannels();
|
||||
|
|
Loading…
Reference in New Issue