mirror of https://github.com/arendst/Tasmota.git
TuyaMCU baud rate
This commit is contained in:
parent
8afba31107
commit
03db100197
|
@ -116,7 +116,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
|
||||||
uint32_t max6675 : 1; // bit 12 (v8.3.1.2) - SetOption94 - Implement simpler MAX6675 protocol instead of MAX31855
|
uint32_t max6675 : 1; // bit 12 (v8.3.1.2) - SetOption94 - Implement simpler MAX6675 protocol instead of MAX31855
|
||||||
uint32_t network_wifi : 1; // bit 13 (v8.3.1.3) - CMND_WIFI
|
uint32_t network_wifi : 1; // bit 13 (v8.3.1.3) - CMND_WIFI
|
||||||
uint32_t network_ethernet : 1; // bit 14 (v8.3.1.3) = CMND_ETHERNET
|
uint32_t network_ethernet : 1; // bit 14 (v8.3.1.3) = CMND_ETHERNET
|
||||||
uint32_t spare15 : 1;
|
uint32_t tuyamcu_baudrate : 1; // bit 15 (v8.3.1.6) - SetOption97 - Set Baud rate for TuyaMCU serial communication (0 = 9600 or 1 = 115200)
|
||||||
uint32_t spare16 : 1;
|
uint32_t spare16 : 1;
|
||||||
uint32_t spare17 : 1;
|
uint32_t spare17 : 1;
|
||||||
uint32_t spare18 : 1;
|
uint32_t spare18 : 1;
|
||||||
|
|
|
@ -899,6 +899,7 @@ void CmndSetoption(void)
|
||||||
switch (pindex) {
|
switch (pindex) {
|
||||||
case 3: // SetOption85 - Enable Device Groups
|
case 3: // SetOption85 - Enable Device Groups
|
||||||
case 6: // SetOption88 - PWM Dimmer Buttons control remote devices
|
case 6: // SetOption88 - PWM Dimmer Buttons control remote devices
|
||||||
|
case 15: // SetOption97 - Set Baud rate for TuyaMCU serial communication (0 = 9600 or 1 = 115200)
|
||||||
restart_flag = 2;
|
restart_flag = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -641,13 +641,16 @@ bool TuyaModuleSelected(void)
|
||||||
|
|
||||||
void TuyaInit(void)
|
void TuyaInit(void)
|
||||||
{
|
{
|
||||||
|
int baudrate = 9600;
|
||||||
|
if (Settings.flag4.tuyamcu_baudrate) { baudrate = 115200; } // SetOption97 - Set Baud rate for TuyaMCU serial communication (0 = 9600 or 1 = 115200)
|
||||||
|
|
||||||
Tuya.buffer = (char*)(malloc(TUYA_BUFFER_SIZE));
|
Tuya.buffer = (char*)(malloc(TUYA_BUFFER_SIZE));
|
||||||
if (Tuya.buffer != nullptr) {
|
if (Tuya.buffer != nullptr) {
|
||||||
TuyaSerial = new TasmotaSerial(Pin(GPIO_TUYA_RX), Pin(GPIO_TUYA_TX), 2);
|
TuyaSerial = new TasmotaSerial(Pin(GPIO_TUYA_RX), Pin(GPIO_TUYA_TX), 2);
|
||||||
if (TuyaSerial->begin(9600)) {
|
if (TuyaSerial->begin(baudrate)) {
|
||||||
if (TuyaSerial->hardwareSerial()) { ClaimSerial(); }
|
if (TuyaSerial->hardwareSerial()) { ClaimSerial(); }
|
||||||
// Get MCU Configuration
|
// Get MCU Configuration
|
||||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Request MCU configuration"));
|
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Request MCU configuration at %d baud rate"));
|
||||||
|
|
||||||
TuyaSendCmd(TUYA_CMD_QUERY_PRODUCT);
|
TuyaSendCmd(TUYA_CMD_QUERY_PRODUCT);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue