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:
Beat Küng committed 2020-10-09 08:23:47 +02:00
1 parent 908444bd68
commit 274ccaf57c
11 files changed
+135 -17

No files matched your search

+6
View File
@@ -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");
}