mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +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:
@@ -225,13 +225,10 @@ public class Watchdog implements Closeable, Comparable<Watchdog> {
|
||||
@SuppressWarnings("resource")
|
||||
private static void updateAlarm(boolean acknowledge) {
|
||||
if (m_watchdogs.isEmpty()) {
|
||||
NotifierJNI.cancelNotifierAlarm(m_notifier);
|
||||
} else if (acknowledge) {
|
||||
NotifierJNI.acknowledgeNotifierAlarm(
|
||||
m_notifier, true, (long) (m_watchdogs.peek().m_expirationTime * 1e6), 0, true);
|
||||
NotifierJNI.cancelNotifierAlarm(m_notifier, acknowledge);
|
||||
} else {
|
||||
NotifierJNI.setNotifierAlarm(
|
||||
m_notifier, (long) (m_watchdogs.peek().m_expirationTime * 1e6), 0, true);
|
||||
m_notifier, (long) (m_watchdogs.peek().m_expirationTime * 1e6), 0, true, acknowledge);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user