ccs: modbus wrapper: consolidate max errors
This commit is contained in:
parent
9bd1243129
commit
76c33534be
1 changed files with 2 additions and 8 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue