mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
fix rx quality calculation
This commit is contained in:
@@ -250,11 +250,7 @@ class RxService : public EMSbus {
|
|||||||
if (telegram_error_count_ == 0) {
|
if (telegram_error_count_ == 0) {
|
||||||
return 100; // all good, 100%
|
return 100; // all good, 100%
|
||||||
}
|
}
|
||||||
if (telegram_error_count_ >= telegram_count_) {
|
uint8_t q = (telegram_error_count_ * 100 / (telegram_count_ + telegram_error_count_));
|
||||||
return 100;
|
|
||||||
}
|
|
||||||
uint8_t q = ((float)telegram_error_count_ / telegram_count_ * 100);
|
|
||||||
|
|
||||||
return (q <= EMS_BUS_QUALITY_RX_THRESHOLD ? 100 : 100 - q);
|
return (q <= EMS_BUS_QUALITY_RX_THRESHOLD ? 100 : 100 - q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user