mirror of https://github.com/arendst/Tasmota.git
parent
c0c198f957
commit
604a03e617
|
@ -913,7 +913,14 @@ void SetSerialBegin(void) {
|
||||||
TasmotaGlobal.baudrate = Settings.baudrate * 300;
|
TasmotaGlobal.baudrate = Settings.baudrate * 300;
|
||||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_SERIAL "Set to %s %d bit/s"), GetSerialConfig().c_str(), TasmotaGlobal.baudrate);
|
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_SERIAL "Set to %s %d bit/s"), GetSerialConfig().c_str(), TasmotaGlobal.baudrate);
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
|
Serial.end();
|
||||||
|
delay(10); // Allow time to cleanup queues - if not used hangs ESP32
|
||||||
|
#ifdef ESP8266
|
||||||
Serial.begin(TasmotaGlobal.baudrate, (SerialConfig)pgm_read_byte(kTasmotaSerialConfig + Settings.serial_config));
|
Serial.begin(TasmotaGlobal.baudrate, (SerialConfig)pgm_read_byte(kTasmotaSerialConfig + Settings.serial_config));
|
||||||
|
#else // ESP32
|
||||||
|
uint32_t config = pgm_read_dword(kTasmotaSerialConfig + Settings.serial_config);
|
||||||
|
Serial.begin(TasmotaGlobal.baudrate, config);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSerialConfig(uint32_t serial_config) {
|
void SetSerialConfig(uint32_t serial_config) {
|
||||||
|
|
|
@ -348,6 +348,7 @@ enum TasmotaSerialConfig {
|
||||||
TS_SERIAL_5O1, TS_SERIAL_6O1, TS_SERIAL_7O1, TS_SERIAL_8O1,
|
TS_SERIAL_5O1, TS_SERIAL_6O1, TS_SERIAL_7O1, TS_SERIAL_8O1,
|
||||||
TS_SERIAL_5O2, TS_SERIAL_6O2, TS_SERIAL_7O2, TS_SERIAL_8O2 };
|
TS_SERIAL_5O2, TS_SERIAL_6O2, TS_SERIAL_7O2, TS_SERIAL_8O2 };
|
||||||
|
|
||||||
|
#ifdef ESP8266
|
||||||
const SerConfu8 kTasmotaSerialConfig[] PROGMEM = {
|
const SerConfu8 kTasmotaSerialConfig[] PROGMEM = {
|
||||||
SERIAL_5N1, SERIAL_6N1, SERIAL_7N1, SERIAL_8N1,
|
SERIAL_5N1, SERIAL_6N1, SERIAL_7N1, SERIAL_8N1,
|
||||||
SERIAL_5N2, SERIAL_6N2, SERIAL_7N2, SERIAL_8N2,
|
SERIAL_5N2, SERIAL_6N2, SERIAL_7N2, SERIAL_8N2,
|
||||||
|
@ -356,6 +357,16 @@ const SerConfu8 kTasmotaSerialConfig[] PROGMEM = {
|
||||||
SERIAL_5O1, SERIAL_6O1, SERIAL_7O1, SERIAL_8O1,
|
SERIAL_5O1, SERIAL_6O1, SERIAL_7O1, SERIAL_8O1,
|
||||||
SERIAL_5O2, SERIAL_6O2, SERIAL_7O2, SERIAL_8O2
|
SERIAL_5O2, SERIAL_6O2, SERIAL_7O2, SERIAL_8O2
|
||||||
};
|
};
|
||||||
|
#else // ESP32
|
||||||
|
const uint32_t kTasmotaSerialConfig[] PROGMEM = {
|
||||||
|
SERIAL_5N1, SERIAL_6N1, SERIAL_7N1, SERIAL_8N1,
|
||||||
|
SERIAL_5N2, SERIAL_6N2, SERIAL_7N2, SERIAL_8N2,
|
||||||
|
SERIAL_5E1, SERIAL_6E1, SERIAL_7E1, SERIAL_8E1,
|
||||||
|
SERIAL_5E2, SERIAL_6E2, SERIAL_7E2, SERIAL_8E2,
|
||||||
|
SERIAL_5O1, SERIAL_6O1, SERIAL_7O1, SERIAL_8O1,
|
||||||
|
SERIAL_5O2, SERIAL_6O2, SERIAL_7O2, SERIAL_8O2
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
enum TuyaSupportedFunctions { TUYA_MCU_FUNC_NONE,
|
enum TuyaSupportedFunctions { TUYA_MCU_FUNC_NONE,
|
||||||
TUYA_MCU_FUNC_SWT1 = 1, TUYA_MCU_FUNC_SWT2, TUYA_MCU_FUNC_SWT3, TUYA_MCU_FUNC_SWT4,
|
TUYA_MCU_FUNC_SWT1 = 1, TUYA_MCU_FUNC_SWT2, TUYA_MCU_FUNC_SWT3, TUYA_MCU_FUNC_SWT4,
|
||||||
|
|
Loading…
Reference in New Issue