mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal] Notifier: simplify ack API (#8457)
Adding an ack parameter to both set and cancel is cleaner than adding all the set alarm parameters to the ack function. It also provides an ack-and-cancel method.
This commit is contained in:
@@ -75,18 +75,12 @@ void Watchdog::Impl::UpdateAlarm(bool acknowledge) {
|
||||
return;
|
||||
}
|
||||
if (m_watchdogs.empty()) {
|
||||
HAL_CancelNotifierAlarm(notifier, &status);
|
||||
} else if (acknowledge) {
|
||||
HAL_AcknowledgeNotifierAlarm(
|
||||
notifier, true,
|
||||
static_cast<uint64_t>(m_watchdogs.top()->m_expirationTime.value() *
|
||||
1e6),
|
||||
0, true, &status);
|
||||
HAL_CancelNotifierAlarm(notifier, acknowledge, &status);
|
||||
} else {
|
||||
HAL_SetNotifierAlarm(notifier,
|
||||
static_cast<uint64_t>(
|
||||
m_watchdogs.top()->m_expirationTime.value() * 1e6),
|
||||
0, true, &status);
|
||||
0, true, acknowledge, &status);
|
||||
}
|
||||
WPILIB_CheckErrorStatus(status, "updating watchdog notifier alarm");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user