mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
reset tx-retry-conter, increase receive priority
This commit is contained in:
@@ -49,6 +49,8 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
|||||||
LOG_DEBUG(F("Registering new Boiler with device ID 0x%02X"), device_id);
|
LOG_DEBUG(F("Registering new Boiler with device ID 0x%02X"), device_id);
|
||||||
|
|
||||||
// the telegram handlers...
|
// the telegram handlers...
|
||||||
|
register_telegram_type(0x10, F("UBAErrorMessage1"), false, nullptr);
|
||||||
|
register_telegram_type(0x11, F("UBAErrorMessage2"), false, nullptr);
|
||||||
register_telegram_type(0x18, F("UBAMonitorFast"), false, std::bind(&Boiler::process_UBAMonitorFast, this, _1));
|
register_telegram_type(0x18, F("UBAMonitorFast"), false, std::bind(&Boiler::process_UBAMonitorFast, this, _1));
|
||||||
register_telegram_type(0x19, F("UBAMonitorSlow"), true, std::bind(&Boiler::process_UBAMonitorSlow, this, _1));
|
register_telegram_type(0x19, F("UBAMonitorSlow"), true, std::bind(&Boiler::process_UBAMonitorSlow, this, _1));
|
||||||
register_telegram_type(0x34, F("UBAMonitorWW"), false, std::bind(&Boiler::process_UBAMonitorWW, this, _1));
|
register_telegram_type(0x34, F("UBAMonitorWW"), false, std::bind(&Boiler::process_UBAMonitorWW, this, _1));
|
||||||
|
|||||||
@@ -582,9 +582,11 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
|||||||
txservice_.send_poll(); // close the bus
|
txservice_.send_poll(); // close the bus
|
||||||
txservice_.post_send_query(); // follow up with any post-read
|
txservice_.post_send_query(); // follow up with any post-read
|
||||||
tx_successful = true;
|
tx_successful = true;
|
||||||
|
txservice_.reset_retry_count();
|
||||||
} else if (first_value == TxService::TX_WRITE_FAIL) {
|
} else if (first_value == TxService::TX_WRITE_FAIL) {
|
||||||
LOG_ERROR(F("Last Tx write rejected by host"));
|
LOG_ERROR(F("Last Tx write rejected by host"));
|
||||||
txservice_.send_poll(); // close the bus
|
txservice_.send_poll(); // close the bus
|
||||||
|
txservice_.reset_retry_count();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// got a telegram with data in it. See if the src/dest matches that from the last one we sent
|
// got a telegram with data in it. See if the src/dest matches that from the last one we sent
|
||||||
@@ -595,6 +597,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
|||||||
LOG_DEBUG(F("Last Tx read successful"));
|
LOG_DEBUG(F("Last Tx read successful"));
|
||||||
txservice_.increment_telegram_read_count();
|
txservice_.increment_telegram_read_count();
|
||||||
txservice_.send_poll(); // close the bus
|
txservice_.send_poll(); // close the bus
|
||||||
|
txservice_.reset_retry_count();
|
||||||
tx_successful = true;
|
tx_successful = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ void TxService::send() {
|
|||||||
|
|
||||||
// if there's nothing in the queue to transmit, send back a poll and quit
|
// if there's nothing in the queue to transmit, send back a poll and quit
|
||||||
if (tx_telegrams_.empty()) {
|
if (tx_telegrams_.empty()) {
|
||||||
send_poll();
|
//send_poll();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ void EMSuart::start(uint8_t tx_mode) {
|
|||||||
drop_next_rx = true;
|
drop_next_rx = true;
|
||||||
buf_handle = xRingbufferCreate(128, RINGBUF_TYPE_NOSPLIT);
|
buf_handle = xRingbufferCreate(128, RINGBUF_TYPE_NOSPLIT);
|
||||||
ESP_ERROR_CHECK(uart_isr_register(EMSUART_UART, emsuart_rx_intr_handler, NULL, ESP_INTR_FLAG_IRAM, &uart_handle));
|
ESP_ERROR_CHECK(uart_isr_register(EMSUART_UART, emsuart_rx_intr_handler, NULL, ESP_INTR_FLAG_IRAM, &uart_handle));
|
||||||
xTaskCreate(emsuart_recvTask, "emsuart_recvTask", 2048, NULL, 12, NULL);
|
xTaskCreate(emsuart_recvTask, "emsuart_recvTask", 2048, NULL, configMAX_PRIORITIES -1, NULL);
|
||||||
EMS_UART.int_ena.brk_det = 1; // activate only break
|
EMS_UART.int_ena.brk_det = 1; // activate only break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#define EMS_MAXBUFFERS 3 // buffers for circular filling to avoid collisions
|
#define EMS_MAXBUFFERS 3 // buffers for circular filling to avoid collisions
|
||||||
#define EMS_MAXBUFFERSIZE 33 // max size of the buffer. EMS packets are max 32 bytes, plus extra 2 for BRKs
|
#define EMS_MAXBUFFERSIZE 33 // max size of the buffer. EMS packets are max 32 bytes, plus extra 2 for BRKs
|
||||||
|
|
||||||
#define EMSUART_recvTaskPrio 1 // 0, 1 or 2. 0 being the lowest
|
#define EMSUART_recvTaskPrio 2 // 0, 1 or 2. 0 being the lowest
|
||||||
#define EMSUART_recvTaskQueueLen 10 // number of queued Rx triggers
|
#define EMSUART_recvTaskQueueLen 10 // number of queued Rx triggers
|
||||||
|
|
||||||
#define EMS_TXMODE_DEFAULT 1
|
#define EMS_TXMODE_DEFAULT 1
|
||||||
|
|||||||
Reference in New Issue
Block a user