fix power button shutdown: use an orb topic instead of a work queue call

px4_shutdown_request() was called from the power button IRQ callback, which
invoked a work queue callback. But on NuttX, the work queue uses a
semaphore, and thus it cannot be called from IRQ context.
This patch switches to publishing an uORB msg instead, which is handled in
the commander main thread.

To increase failure resistance, we could subscribe to the same topic in
another module for redundancy, in case commander runs wild.
This commit is contained in:
Beat Küng
2017-07-29 23:10:47 +02:00
committed by Lorenz Meier
parent 61b0a81bf9
commit 2815c62acf
4 changed files with 53 additions and 6 deletions
+1 -2
View File
@@ -69,8 +69,7 @@ __EXPORT int px4_unregister_shutdown_hook(shutdown_hook_t hook);
/**
* Request the system to shut down. It's save to call this from an IRQ context,
* but the work queues need to be initialized already.
* Request the system to shut down or reboot.
* Note the following:
* - The system might not support to shutdown (or reboot). In that case -EINVAL will
* be returned.