From 42f6bf61826bb054c90dec2978926d74b25897c9 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Fri, 14 Oct 2022 14:28:08 +0200 Subject: [PATCH] fix rx quality calculation --- src/telegram.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/telegram.h b/src/telegram.h index cafa60b42..710558f57 100644 --- a/src/telegram.h +++ b/src/telegram.h @@ -250,11 +250,7 @@ class RxService : public EMSbus { if (telegram_error_count_ == 0) { return 100; // all good, 100% } - if (telegram_error_count_ >= telegram_count_) { - return 100; - } - uint8_t q = ((float)telegram_error_count_ / telegram_count_ * 100); - + uint8_t q = (telegram_error_count_ * 100 / (telegram_count_ + telegram_error_count_)); return (q <= EMS_BUS_QUALITY_RX_THRESHOLD ? 100 : 100 - q); }