mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
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.
9 lines
459 B
Plaintext
9 lines
459 B
Plaintext
# power button state notification message
|
|
|
|
uint8 PWR_BUTTON_STATE_IDEL = 0 # Button went up without meeting shutdown button down time (delete event)
|
|
uint8 PWR_BUTTON_STATE_DOWN = 1 # Button went Down
|
|
uint8 PWR_BUTTON_STATE_UP = 2 # Button went Up
|
|
uint8 PWR_BUTTON_STATE_REQUEST_SHUTDOWN = 3 # Button went Up after meeting shutdown button down time
|
|
|
|
uint8 event # one of PWR_BUTTON_STATE_*
|