mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-23 06:36:45 +08:00
system: include shutdown lock to BOARD_INDICATE_ARMED_STATE
BOARD_INDICATE_ARMED_STATE was only set during arming, so an external component might have reset the board during param save, leading to param loss. This extends the API to trigger the arming state also while the shutdown lock is taken.
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
#define MODULE_NAME "shutdown"
|
||||
#endif
|
||||
|
||||
#include <px4_platform_common/external_reset_lockout.h>
|
||||
#include <px4_platform_common/log.h>
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -69,6 +70,7 @@ int px4_shutdown_lock()
|
||||
|
||||
if (ret == 0) {
|
||||
++shutdown_lock_counter;
|
||||
px4_indicate_external_reset_lockout(LockoutComponent::SystemShutdownLock, true);
|
||||
return pthread_mutex_unlock(&shutdown_mutex);
|
||||
}
|
||||
|
||||
@@ -83,6 +85,10 @@ int px4_shutdown_unlock()
|
||||
if (shutdown_lock_counter > 0) {
|
||||
--shutdown_lock_counter;
|
||||
|
||||
if (shutdown_lock_counter == 0) {
|
||||
px4_indicate_external_reset_lockout(LockoutComponent::SystemShutdownLock, false);
|
||||
}
|
||||
|
||||
} else {
|
||||
PX4_ERR("unmatched number of px4_shutdown_unlock() calls");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user