mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
Fix double disable segfaulting interrupts (#2132)
Also fixes DigitalOutput not closing correctly.
This commit is contained in:
committed by
Peter Johnson
parent
6ceafe3cd0
commit
3fcfc8ea72
@@ -118,7 +118,11 @@ void* HAL_CleanInterrupts(HAL_InterruptHandle interruptHandle,
|
|||||||
if (anInterrupt == nullptr) {
|
if (anInterrupt == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
anInterrupt->manager->disable(status);
|
|
||||||
|
if (anInterrupt->manager->isEnabled(status)) {
|
||||||
|
anInterrupt->manager->disable(status);
|
||||||
|
}
|
||||||
|
|
||||||
void* param = anInterrupt->param;
|
void* param = anInterrupt->param;
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
@@ -152,7 +156,10 @@ void HAL_EnableInterrupts(HAL_InterruptHandle interruptHandle,
|
|||||||
*status = HAL_HANDLE_ERROR;
|
*status = HAL_HANDLE_ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
anInterrupt->manager->enable(status);
|
|
||||||
|
if (!anInterrupt->manager->isEnabled(status)) {
|
||||||
|
anInterrupt->manager->enable(status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HAL_DisableInterrupts(HAL_InterruptHandle interruptHandle,
|
void HAL_DisableInterrupts(HAL_InterruptHandle interruptHandle,
|
||||||
@@ -162,7 +169,9 @@ void HAL_DisableInterrupts(HAL_InterruptHandle interruptHandle,
|
|||||||
*status = HAL_HANDLE_ERROR;
|
*status = HAL_HANDLE_ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
anInterrupt->manager->disable(status);
|
if (anInterrupt->manager->isEnabled(status)) {
|
||||||
|
anInterrupt->manager->disable(status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle,
|
int64_t HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle,
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public class DigitalOutput extends DigitalSource implements Sendable, AutoClosea
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
|
super.close();
|
||||||
SendableRegistry.remove(this);
|
SendableRegistry.remove(this);
|
||||||
// Disable the pwm only if we have allocated it
|
// Disable the pwm only if we have allocated it
|
||||||
if (m_pwmGenerator != invalidPwmGenerator) {
|
if (m_pwmGenerator != invalidPwmGenerator) {
|
||||||
|
|||||||
Reference in New Issue
Block a user