[hal,wpilib] Rename FPGA clock to monotonic clock (#8672)

- Remove status return from HAL level (clock getting should never fail)
- Remove 32-bit timestamp expand function
- Make monotonic_clock.hpp (formerly fpga_clock.hpp) header-only and
move to root hal include directory
This commit is contained in:
Peter Johnson
2026-03-15 15:08:41 -07:00
committed by GitHub
parent 1a5b023235
commit e944ae9aca
59 changed files with 233 additions and 358 deletions

View File

@@ -25,7 +25,7 @@ public abstract class MotorSafety {
private double m_expiration = kDefaultSafetyExpiration;
private boolean m_enabled;
private double m_stopTime = Timer.getFPGATimestamp();
private double m_stopTime = Timer.getMonotonicTimestamp();
private final Object m_thisMutex = new Object();
private static final Set<MotorSafety> m_instanceList = new LinkedHashSet<>();
private static final Object m_listMutex = new Object();
@@ -83,7 +83,7 @@ public abstract class MotorSafety {
*/
public void feed() {
synchronized (m_thisMutex) {
m_stopTime = Timer.getFPGATimestamp() + m_expiration;
m_stopTime = Timer.getMonotonicTimestamp() + m_expiration;
}
}
@@ -116,7 +116,7 @@ public abstract class MotorSafety {
*/
public boolean isAlive() {
synchronized (m_thisMutex) {
return !m_enabled || m_stopTime > Timer.getFPGATimestamp();
return !m_enabled || m_stopTime > Timer.getMonotonicTimestamp();
}
}
@@ -138,7 +138,7 @@ public abstract class MotorSafety {
return;
}
if (stopTime < Timer.getFPGATimestamp()) {
if (stopTime < Timer.getMonotonicTimestamp()) {
DriverStation.reportError(
getDescription()
+ "... Output not updated often enough. See https://docs.wpilib.org/motorsafety for more information.",