mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 18:47:21 +08:00
Safety: keep initialized constant flags when safety disabled
This commit is contained in:
committed by
Igor Mišić
parent
44c4b8fa85
commit
71103e6114
@@ -44,16 +44,16 @@ Safety::Safety()
|
|||||||
{
|
{
|
||||||
// Safety can be turned off with the CBRK_IO_SAFETY parameter.
|
// Safety can be turned off with the CBRK_IO_SAFETY parameter.
|
||||||
_safety_disabled = circuit_breaker_enabled("CBRK_IO_SAFETY", CBRK_IO_SAFETY_KEY);
|
_safety_disabled = circuit_breaker_enabled("CBRK_IO_SAFETY", CBRK_IO_SAFETY_KEY);
|
||||||
|
|
||||||
|
if (_safety_disabled) {
|
||||||
|
_button_available = true;
|
||||||
|
_safety_off = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Safety::safetyButtonHandler()
|
bool Safety::safetyButtonHandler()
|
||||||
{
|
{
|
||||||
if (_safety_disabled) {
|
if (!_safety_disabled) {
|
||||||
_button_available = true;
|
|
||||||
_safety_off = true;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (!_button_available && _safety_button_sub.advertised()) {
|
if (!_button_available && _safety_button_sub.advertised()) {
|
||||||
_button_available = true;
|
_button_available = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user