From f43b9fe5d6bfe37c9577e4b1c04ddb17dabb10f4 Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Wed, 7 Oct 2020 13:35:23 +0300 Subject: [PATCH] platforms/common/shutdown.cpp: Enable boardctl functions for shutdown and poweroff Shutdown and poweroff must go through boardctl in NuttX protected build Signed-off-by: Jukka Laitinen --- platforms/common/shutdown.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platforms/common/shutdown.cpp b/platforms/common/shutdown.cpp index 6830abadcb..644d24d11f 100644 --- a/platforms/common/shutdown.cpp +++ b/platforms/common/shutdown.cpp @@ -56,6 +56,7 @@ #ifdef __PX4_NUTTX #include +#include #endif using namespace time_literals; @@ -99,7 +100,7 @@ int px4_shutdown_unlock() return ret; } -#if defined(CONFIG_SCHED_WORKQUEUE) +#if defined(CONFIG_SCHED_WORKQUEUE) || (!defined(CONFIG_BUILD_FLAT) && defined(CONFIG_LIB_USRWORK)) static struct work_s shutdown_work = {}; static uint16_t shutdown_counter = 0; ///< count how many times the shutdown worker was executed @@ -174,7 +175,7 @@ static void shutdown_worker(void *arg) if (shutdown_args & SHUTDOWN_ARG_REBOOT) { #if defined(CONFIG_BOARDCTL_RESET) PX4_INFO_RAW("Reboot NOW."); - board_reset((shutdown_args & SHUTDOWN_ARG_TO_BOOTLOADER) ? 1 : 0); + boardctl(BOARDIOC_RESET, (shutdown_args & SHUTDOWN_ARG_TO_BOOTLOADER) ? 1 : 0); #else PX4_PANIC("board reset not available"); #endif