mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Check for fatal interrupt status on multiple interrupt methods to avoid hanging program (fixes artf3602)
Change-Id: I31cb499fd1641deec26001b719fd0a6f07d20692
This commit is contained in:
@@ -91,6 +91,7 @@ void InterruptableSensorBase::AllocateInterrupts(bool watcher)
|
||||
*/
|
||||
void InterruptableSensorBase::CancelInterrupts()
|
||||
{
|
||||
if (StatusIsFatal()) return;
|
||||
wpi_assert(m_interrupt != NULL);
|
||||
int32_t status = 0;
|
||||
cleanInterrupts(m_interrupt, &status);
|
||||
@@ -108,6 +109,7 @@ void InterruptableSensorBase::CancelInterrupts()
|
||||
*/
|
||||
InterruptableSensorBase::WaitResult InterruptableSensorBase::WaitForInterrupt(float timeout, bool ignorePrevious)
|
||||
{
|
||||
if (StatusIsFatal()) return InterruptableSensorBase::kTimeout;
|
||||
wpi_assert(m_interrupt != NULL);
|
||||
int32_t status = 0;
|
||||
uint32_t result;
|
||||
@@ -125,6 +127,7 @@ InterruptableSensorBase::WaitResult InterruptableSensorBase::WaitForInterrupt(fl
|
||||
*/
|
||||
void InterruptableSensorBase::EnableInterrupts()
|
||||
{
|
||||
if (StatusIsFatal()) return;
|
||||
wpi_assert(m_interrupt != NULL);
|
||||
int32_t status = 0;
|
||||
enableInterrupts(m_interrupt, &status);
|
||||
@@ -136,6 +139,7 @@ void InterruptableSensorBase::EnableInterrupts()
|
||||
*/
|
||||
void InterruptableSensorBase::DisableInterrupts()
|
||||
{
|
||||
if (StatusIsFatal()) return;
|
||||
wpi_assert(m_interrupt != NULL);
|
||||
int32_t status = 0;
|
||||
disableInterrupts(m_interrupt, &status);
|
||||
@@ -151,6 +155,7 @@ void InterruptableSensorBase::DisableInterrupts()
|
||||
*/
|
||||
double InterruptableSensorBase::ReadRisingTimestamp()
|
||||
{
|
||||
if (StatusIsFatal()) return 0.0;
|
||||
wpi_assert(m_interrupt != NULL);
|
||||
int32_t status = 0;
|
||||
double timestamp = readRisingTimestamp(m_interrupt, &status);
|
||||
@@ -167,6 +172,7 @@ double InterruptableSensorBase::ReadRisingTimestamp()
|
||||
*/
|
||||
double InterruptableSensorBase::ReadFallingTimestamp()
|
||||
{
|
||||
if (StatusIsFatal()) return 0.0;
|
||||
wpi_assert(m_interrupt != NULL);
|
||||
int32_t status = 0;
|
||||
double timestamp = readFallingTimestamp(m_interrupt, &status);
|
||||
|
||||
Reference in New Issue
Block a user