[hal, wpilib] Expose sticky hardware and firmware faults in PDH and PH (#6900)

This commit is contained in:
Ryan Blue
2024-08-02 22:13:43 -04:00
committed by GitHub
parent 01c47e5bcc
commit 7938d79648
8 changed files with 38 additions and 2 deletions

View File

@@ -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;
@@ -166,6 +172,8 @@ public class PowerDistributionStickyFaults {
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;
}
}

View File

@@ -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;
@@ -40,6 +46,8 @@ public class REVPHStickyFaults {
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;
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
};

View File

@@ -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;
};

View File

@@ -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;
};

View File

@@ -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;