From ced2d2df4749104ec6b86c94cc1a1b0fd084bc7f Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 27 Jul 2020 18:56:37 +0200 Subject: [PATCH] tx_mode optimizations --- src/emsesp.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 5cc61a255..a0f55df89 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -111,12 +111,13 @@ void EMSESP::watch_id(uint16_t watch_id) { // change the tx_mode // resets all counters and bumps the UART void EMSESP::reset_tx(uint8_t const tx_mode) { - txservice_.telegram_read_count(0); - txservice_.telegram_write_count(0); - txservice_.telegram_fail_count(0); - if (tx_mode) { - EMSuart::stop(); - EMSuart::start(tx_mode); + EMSuart::stop(); + + txservice_.start(); + + EMSuart::start(tx_mode); + + if (tx_mode != 0) { EMSESP::fetch_device_values(); } } @@ -773,6 +774,7 @@ void EMSESP::loop() { // if we're doing an OTA upload, skip MQTT and EMS if (system_.upload_status()) { + delay(1); // slow down OTA update to avoid getting killed by task watchdog (task_wdt) return; }