Skip to content

Commit

Permalink
expose more faults in PDH and PH
Browse files Browse the repository at this point in the history
  • Loading branch information
rzblue committed Aug 1, 2024
1 parent 2c99845 commit b990c62
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ public class PowerDistributionStickyFaults {
/** The device's CAN controller experienced a "Bus Off" event. */
public final boolean CanBusOff;

/** The hardware on the device has malfunctioned. */
public final boolean HardwareFault;

/** The firmware on the device has malfunctioned. */
public final boolean FirmwareFault;

/** The device has rebooted. */
public final boolean HasReset;

Expand Down Expand Up @@ -166,6 +172,8 @@ public PowerDistributionStickyFaults(int faults) {
Brownout = (faults & 0x1000000) != 0;
CanWarning = (faults & 0x2000000) != 0;
CanBusOff = (faults & 0x4000000) != 0;
HasReset = (faults & 0x8000000) != 0;
HardwareFault = (faults & 0x8000000) != 0;
FirmwareFault = (faults & 0x10000000) != 0;
HasReset = (faults & 0x20000000) != 0;
}
}
10 changes: 9 additions & 1 deletion hal/src/main/java/edu/wpi/first/hal/REVPHStickyFaults.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public class REVPHStickyFaults {
/** The device's CAN controller experienced a "Bus Off" event. */
public final boolean CanBusOff;

/** The hardware on the device has malfunctioned. */
public final boolean HardwareFault;

/** The firmware on the device has malfunctioned. */
public final boolean FirmwareFault;

/** The device has rebooted. */
public final boolean HasReset;

Expand All @@ -40,6 +46,8 @@ public REVPHStickyFaults(int faults) {
Brownout = (faults & 0x8) != 0;
CanWarning = (faults & 0x10) != 0;
CanBusOff = (faults & 0x20) != 0;
HasReset = (faults & 0x40) != 0;
HardwareFault = (faults & 0x40) != 0;
FirmwareFault = (faults & 0x80) != 0;
HasReset = (faults & 0x100) != 0;
}
}
2 changes: 2 additions & 0 deletions hal/src/main/native/athena/REVPDH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,8 @@ void HAL_GetREVPDHStickyFaults(HAL_REVPDHHandle handle,
stickyFaults->brownout = status4.sticky_brownout_fault;
stickyFaults->canWarning = status4.sticky_can_warning_fault;
stickyFaults->canBusOff = status4.sticky_can_bus_off_fault;
stickyFaults->hardwareFault = status4.sticky_hardware_fault;
stickyFaults->firmwareFault = status4.sticky_firmware_fault;
stickyFaults->hasReset = status4.sticky_has_reset_fault;
}

Expand Down
2 changes: 2 additions & 0 deletions hal/src/main/native/athena/REVPH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,8 @@ void HAL_GetREVPHStickyFaults(HAL_REVPHHandle handle,
stickyFaults->brownout = status1.sticky_brownout_fault;
stickyFaults->canWarning = status1.sticky_can_warning_fault;
stickyFaults->canBusOff = status1.sticky_can_bus_off_fault;
stickyFaults->hardwareFault = status1.sticky_hardware_fault;
stickyFaults->firmwareFault = status1.sticky_firmware_fault;
stickyFaults->hasReset = status1.sticky_has_reset_fault;
}

Expand Down
4 changes: 4 additions & 0 deletions hal/src/main/native/include/hal/PowerDistribution.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ struct HAL_PowerDistributionStickyFaults {
uint32_t canWarning : 1;
/** The device's CAN controller experienced a "Bus Off" event. */
uint32_t canBusOff : 1;
/** The hardware on the device has malfunctioned. */
uint32_t hardwareFault : 1;
/** The firmware on the device has malfunctioned. */
uint32_t firmwareFault : 1;
/** The device has rebooted. */
uint32_t hasReset : 1;
};
Expand Down
4 changes: 4 additions & 0 deletions hal/src/main/native/include/hal/REVPH.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ struct HAL_REVPHStickyFaults {
uint32_t canWarning : 1;
/** The device's CAN controller experienced a "Bus Off" event. */
uint32_t canBusOff : 1;
/** The hardware on the device has malfunctioned. */
uint32_t hardwareFault : 1;
/** The firmware on the device has malfunctioned. */
uint32_t firmwareFault : 1;
/** The device has rebooted. */
uint32_t hasReset : 1;
};
Expand Down
4 changes: 4 additions & 0 deletions wpilibc/src/main/native/include/frc/PneumaticHub.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ class PneumaticHub : public PneumaticsBase {
uint32_t CanWarning : 1;
/** The device's CAN controller experienced a "Bus Off" event. */
uint32_t CanBusOff : 1;
/** The hardware on the device has malfunctioned. */
uint32_t HardwareFault : 1;
/** The firmware on the device has malfunctioned. */
uint32_t FirmwareFault : 1;
/** The device has rebooted. */
uint32_t HasReset : 1;
};
Expand Down
4 changes: 4 additions & 0 deletions wpilibc/src/main/native/include/frc/PowerDistribution.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ class PowerDistribution : public wpi::Sendable,
uint32_t CanWarning : 1;
/** The device's CAN controller experienced a "Bus Off" event. */
uint32_t CanBusOff : 1;
/** The hardware on the device has malfunctioned. */
uint32_t HardwareFault : 1;
/** The firmware on the device has malfunctioned. */
uint32_t FirmwareFault : 1;
/** The device has rebooted. */
uint32_t HasReset : 1;

Expand Down

0 comments on commit b990c62

Please sign in to comment.