mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 00:39:50 +03:00
don't wait in rx loop
This commit is contained in:
@@ -74,7 +74,7 @@ upload_protocol = espota
|
|||||||
upload_flags =
|
upload_flags =
|
||||||
--port=8266
|
--port=8266
|
||||||
--auth=neo
|
--auth=neo
|
||||||
upload_port = 192.168.0.20
|
;upload_port = 192.168.0.20
|
||||||
|
|
||||||
[env:esp8266]
|
[env:esp8266]
|
||||||
build_type = release
|
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.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
|
; 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
|
build_flags = ${common.build_flags} ${common.debug_flags} -D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||||
|
upload_port = 192.168.0.20
|
||||||
|
|
||||||
[env:esp32]
|
[env:esp32]
|
||||||
build_type = release
|
build_type = release
|
||||||
@@ -101,3 +102,4 @@ platform = espressif32
|
|||||||
board = wemos_d1_mini32
|
board = wemos_d1_mini32
|
||||||
lib_deps = ${common.libs_core} ${common.libs_esp32}
|
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
|
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
|
||||||
|
|||||||
@@ -222,10 +222,10 @@ void RxService::start() {
|
|||||||
void RxService::loop() {
|
void RxService::loop() {
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
// give rx some breathing space
|
// give rx some breathing space
|
||||||
if ((uuid::get_uptime() - last_rx_check_) < RX_LOOP_WAIT) {
|
//if ((uuid::get_uptime() - last_rx_check_) < RX_LOOP_WAIT) {
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
last_rx_check_ = uuid::get_uptime();
|
//last_rx_check_ = uuid::get_uptime();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (!rx_telegrams_.empty()) {
|
while (!rx_telegrams_.empty()) {
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ static intr_handle_t uart_handle;
|
|||||||
static RingbufHandle_t buf_handle = NULL;
|
static RingbufHandle_t buf_handle = NULL;
|
||||||
static bool drop_next_rx = true;
|
static bool drop_next_rx = true;
|
||||||
static uint8_t tx_mode_ = 0xFF;
|
static uint8_t tx_mode_ = 0xFF;
|
||||||
|
static uint32_t emsRxTime;
|
||||||
|
|
||||||
|
#define EMS_RX_TO_TX_TIMEOUT 20
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Task to handle the incoming data
|
* 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))) {
|
if ((!drop_next_rx) && ((length == 2) || (length > 4))) {
|
||||||
int baseType = 0;
|
int baseType = 0;
|
||||||
xRingbufferSendFromISR(buf_handle, rxbuf, length - 1, &baseType);
|
xRingbufferSendFromISR(buf_handle, rxbuf, length - 1, &baseType);
|
||||||
|
emsRxTime = millis();
|
||||||
}
|
}
|
||||||
drop_next_rx = false;
|
drop_next_rx = false;
|
||||||
}
|
}
|
||||||
@@ -135,6 +139,9 @@ void EMSuart::send_poll(uint8_t data) {
|
|||||||
* returns code, 1=success
|
* returns code, 1=success
|
||||||
*/
|
*/
|
||||||
EMSUART_STATUS EMSuart::transmit(uint8_t * buf, uint8_t len) {
|
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) {
|
if (len > 0) {
|
||||||
for (uint8_t i = 0; i < len; i++) {
|
for (uint8_t i = 0; i < len; i++) {
|
||||||
EMS_UART.fifo.rw_byte = buf[i];
|
EMS_UART.fifo.rw_byte = buf[i];
|
||||||
|
|||||||
Reference in New Issue
Block a user