diff --git a/platformio.ini b/platformio.ini index 204efcd28..f94869833 100644 --- a/platformio.ini +++ b/platformio.ini @@ -74,7 +74,7 @@ upload_protocol = espota upload_flags = --port=8266 --auth=neo -upload_port = 192.168.0.20 +;upload_port = 192.168.0.20 [env:esp8266] build_type = release @@ -87,6 +87,7 @@ board_build.f_cpu = 160000000L ; 160MHz board_build.ldscript = eagle.flash.4m1m.ld ; 1019 KB sketch, 1000 KB SPIFFS. 4KB EEPROM, 4KB RFCAL, 12KB WIFI stack, 2052 KB OTA & buffer ; board_build.ldscript = eagle.flash.4m2m.ld ; 1019 KB sketch, 2024 KB SPIFFS. 4KB EEPROM, 4KB RFCAL, 12KB WIFI stack, 1028 KB OTA & buffer build_flags = ${common.build_flags} ${common.debug_flags} -D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY +upload_port = 192.168.0.20 [env:esp32] build_type = release @@ -101,3 +102,4 @@ platform = espressif32 board = wemos_d1_mini32 lib_deps = ${common.libs_core} ${common.libs_esp32} build_flags = ${common.build_flags} ${common.debug_flags} -D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH -D WEMOS_D1_32 +upload_port = 192.168.0.23 diff --git a/src/telegram.cpp b/src/telegram.cpp index 8fd6bf852..07026b4b8 100644 --- a/src/telegram.cpp +++ b/src/telegram.cpp @@ -222,10 +222,10 @@ void RxService::start() { void RxService::loop() { #ifndef EMSESP_STANDALONE // give rx some breathing space - if ((uuid::get_uptime() - last_rx_check_) < RX_LOOP_WAIT) { - return; - } - last_rx_check_ = uuid::get_uptime(); + //if ((uuid::get_uptime() - last_rx_check_) < RX_LOOP_WAIT) { + // return; + //} + //last_rx_check_ = uuid::get_uptime(); #endif while (!rx_telegrams_.empty()) { diff --git a/src/uart/emsuart_esp32.cpp b/src/uart/emsuart_esp32.cpp index 13461ca0b..b56b97e30 100644 --- a/src/uart/emsuart_esp32.cpp +++ b/src/uart/emsuart_esp32.cpp @@ -32,6 +32,9 @@ static intr_handle_t uart_handle; static RingbufHandle_t buf_handle = NULL; static bool drop_next_rx = true; static uint8_t tx_mode_ = 0xFF; +static uint32_t emsRxTime; + +#define EMS_RX_TO_TX_TIMEOUT 20 /* * Task to handle the incoming data @@ -69,6 +72,7 @@ void IRAM_ATTR EMSuart::emsuart_rx_intr_handler(void * para) { if ((!drop_next_rx) && ((length == 2) || (length > 4))) { int baseType = 0; xRingbufferSendFromISR(buf_handle, rxbuf, length - 1, &baseType); + emsRxTime = millis(); } drop_next_rx = false; } @@ -135,6 +139,9 @@ void EMSuart::send_poll(uint8_t data) { * returns code, 1=success */ EMSUART_STATUS EMSuart::transmit(uint8_t * buf, uint8_t len) { + if (millis() -emsRxTime > EMS_RX_TO_TX_TIMEOUT) { + return EMS_TX_WTD_TIMEOUT; + } if (len > 0) { for (uint8_t i = 0; i < len; i++) { EMS_UART.fifo.rw_byte = buf[i];