mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 00:13:34 +08:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user