don't count errors if Rx queue is full

This commit is contained in:
proddy
2020-11-28 23:34:54 +01:00
parent 08e2c519e6
commit 5c4f85948d

View File

@@ -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
uint8_t crc = calculate_crc(data, length - 1);
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);
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
if (rx_telegrams_.size() >= MAX_RX_TELEGRAMS) {
rx_telegrams_.pop_front();
increment_telegram_error_count();
}
rx_telegrams_.emplace_back(rx_telegram_id_++, std::move(telegram)); // add to queue