Skip to content

Commit

Permalink
serial enable hardware swap
Browse files Browse the repository at this point in the history
  • Loading branch information
gemu2015 committed Sep 12, 2023
1 parent 1c4d25c commit 6f26b08
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 6f26b08

Please sign in to comment.