mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
don't count errors if Rx queue is full
This commit is contained in:
@@ -145,7 +145,7 @@ void RxService::add(uint8_t * data, uint8_t length) {
|
|||||||
// validate the CRC. if it fails then increment the number of corrupt/incomplete telegrams and only report to console/syslog
|
// validate the CRC. if it fails then increment the number of corrupt/incomplete telegrams and only report to console/syslog
|
||||||
uint8_t crc = calculate_crc(data, length - 1);
|
uint8_t crc = calculate_crc(data, length - 1);
|
||||||
if (data[length - 1] != crc) {
|
if (data[length - 1] != crc) {
|
||||||
increment_telegram_error_count();
|
telegram_error_count_++;
|
||||||
LOG_ERROR(F("Rx: %s (CRC %02X != %02X)"), Helpers::data_to_hex(data, length).c_str(), data[length - 1], crc);
|
LOG_ERROR(F("Rx: %s (CRC %02X != %02X)"), Helpers::data_to_hex(data, length).c_str(), data[length - 1], crc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,6 @@ void RxService::add(uint8_t * data, uint8_t length) {
|
|||||||
// check if queue is full, if so remove top item to make space
|
// check if queue is full, if so remove top item to make space
|
||||||
if (rx_telegrams_.size() >= MAX_RX_TELEGRAMS) {
|
if (rx_telegrams_.size() >= MAX_RX_TELEGRAMS) {
|
||||||
rx_telegrams_.pop_front();
|
rx_telegrams_.pop_front();
|
||||||
increment_telegram_error_count();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rx_telegrams_.emplace_back(rx_telegram_id_++, std::move(telegram)); // add to queue
|
rx_telegrams_.emplace_back(rx_telegram_id_++, std::move(telegram)); // add to queue
|
||||||
|
|||||||
Reference in New Issue
Block a user