ccs: modbus wrapper: consolidate max errors

This commit is contained in:
Alex Janka 2025-01-15 12:06:23 +11:00
parent 9bd1243129
commit 76c33534be

View file

@ -67,11 +67,7 @@ struct Counters {
protocol: usize,
}
const MAX_GATEWAY_ERRORS: usize = 3;
const MAX_TIMEOUTS: usize = 3;
const MAX_PROTOCOL_ERRORS: usize = 3;
const MAX_ERRORS: usize = 2;
impl Counters {
fn reset(&mut self) {
@ -79,9 +75,7 @@ impl Counters {
}
const fn any_above_max(&self) -> bool {
self.gateway > MAX_GATEWAY_ERRORS
|| self.timeout > MAX_TIMEOUTS
|| self.protocol > MAX_PROTOCOL_ERRORS
self.gateway > MAX_ERRORS || self.timeout > MAX_ERRORS || self.protocol > MAX_ERRORS
}
}