Merge pull request #13143 from barbudor/serial_console_swap

Serial.swap if TXD/RXD on GPIO13/15 (ESP8266)
This commit is contained in:
Theo Arends 2021-09-20 11:15:08 +02:00 committed by GitHub
commit 9173175a2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -1017,6 +1017,11 @@ void SetSerialBegin(void) {
Serial.flush();
#ifdef ESP8266
Serial.begin(TasmotaGlobal.baudrate, (SerialConfig)pgm_read_byte(kTasmotaSerialConfig + Settings->serial_config));
if (15==Pin(GPIO_TXD,0) && 13==Pin(GPIO_RXD,0)) {
Serial.flush();
Serial.swap();
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_SERIAL "Serial pins swapped to alternate"));
}
#endif // ESP8266
#ifdef ESP32
delay(10); // Allow time to cleanup queues - if not used hangs ESP32

View File

@ -408,6 +408,14 @@ void setup(void) {
BerryInit();
#endif // USE_BERRY
#ifdef ESP8266
if (15==Pin(GPIO_TXD,0) && 13==Pin(GPIO_RXD,0)) {
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_SERIAL "Swapping Serial pins to alternate"));
Serial.flush();
Serial.swap();
}
#endif
XdrvCall(FUNC_PRE_INIT);
XsnsCall(FUNC_PRE_INIT);