pub fn verify_watchdog(
slave_number: u32,
data: &mut [u8],
watchdog_timeout_ms: u32,
watchdog_counter: u8,
slave_watchdog_control_offsets: &Vec<Vec<Range<usize>>>,
slave_watchdog_status_offsets: &Vec<Vec<Range<usize>>>,
slave_watchdog_timestamps: &mut Vec<Instant>,
slave_is_watchdog_responding: &mut Vec<bool>,
slave_previous_watchdog_counter: &mut Vec<u8>,
slave_name_from_id: &impl Fn(u16) -> String,
) -> bool
Expand description
verify the watchdog of the slaves verify that the slaves are still writing checking if the watchdog counter is the same as the previous cycle
- if the counter is the same, check for how long has it been the same
- if it is the same for more than 1s the slave is considered not responding
- if the counter is different, update the timestamp
- write the watchdog counter to the controlword
§Arguments
slave_number
- The number of slavesdata
- The domain datawatchdog_timeout_ms
- The timeout for the watchdog in millisecondswatchdog_counter
- The watchdog counter to be writtenslave_watchdog_control_offsets
- The controlword offsets for each slaveslave_watchdog_status_offsets
- The statusword offsets for each slaveslave_watchdog_timestamps
- The timestamps of the last watchdog update for each slaveslave_is_watchdog_responding
- The flag to check if each slave is respondingslave_previous_watchdog_counter
- The buffer to store the previous watchdog counter for each slaveslave_name_from_id
- A function to get the slave name from the id
§Returns
bool
- The flag to check if all the slaves are responding