diff --git a/charge-controller-supervisor/src/controller/tristar/modbus_wrapper.rs b/charge-controller-supervisor/src/controller/tristar/modbus_wrapper.rs index 9357871..e6afb6f 100644 --- a/charge-controller-supervisor/src/controller/tristar/modbus_wrapper.rs +++ b/charge-controller-supervisor/src/controller/tristar/modbus_wrapper.rs @@ -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 } }