fix hardware serial port swap on ESP8266 (#19505)

This commit is contained in:
gemu 2023-09-13 09:09:01 +02:00 committed by GitHub
parent 088ac1815b
commit cb4671ee88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -189,7 +189,9 @@ void Script_ticker4_end(void) {
}
#endif
#ifndef HARDWARE_FALLBACK
#define HARDWARE_FALLBACK 2
#endif
// EEPROM MACROS
// i2c eeprom
@ -4989,7 +4991,7 @@ extern char *SML_GetSVal(uint32_t index);
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));
@ -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;
}