Skip to content

Commit

Permalink
fix hardware serial port swap on ESP8266 (#19505)
Browse files Browse the repository at this point in the history
  • Loading branch information
gemu2015 authored Sep 13, 2023
1 parent 088ac18 commit cb4671e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ void Script_ticker4_end(void) {
}
#endif


#ifndef HARDWARE_FALLBACK
#define HARDWARE_FALLBACK 2
#endif

// EEPROM MACROS
// i2c eeprom
Expand Down Expand Up @@ -4988,8 +4990,8 @@ extern char *SML_GetSVal(uint32_t index);
if (Is_gpio_used(rxpin) || Is_gpio_used(txpin)) {
AddLog(LOG_LEVEL_INFO, PSTR("SCR: warning, pins already used"));
}

glob_script_mem.sp = new TasmotaSerial(rxpin, txpin, 1, 0, rxbsiz);
glob_script_mem.sp = new TasmotaSerial(rxpin, txpin, HARDWARE_FALLBACK, 0, rxbsiz);

if (glob_script_mem.sp) {
fvar = glob_script_mem.sp->begin(br, ConvertSerialConfig(sconfig));
Expand All @@ -5003,8 +5005,9 @@ extern char *SML_GetSVal(uint32_t index);
#endif
AddLog(LOG_LEVEL_INFO, PSTR("SCR: Serial port set to %s %d bit/s at rx=%d tx=%d rbu=%d uart=%d"), GetSerialConfig().c_str(), (uint32_t)br, (uint32_t)rxpin, (uint32_t)txpin, (uint32_t)rxbsiz, uart);
Settings->serial_config = savc;
if (rxpin == 3 and txpin == 1) ClaimSerial();

if (glob_script_mem.sp->hardwareSerial()) {
ClaimSerial();
}
} else {
fvar = -2;
}
Expand Down

0 comments on commit cb4671e

Please sign in to comment.