From ab629a8a931e6c10da2fab3e7dcb62a1f2df252c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Tue, 27 Aug 2019 18:18:26 +0200 Subject: [PATCH] safety_button: reduce output verbosity if disabled --- src/drivers/safety_button/SafetyButton.cpp | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/drivers/safety_button/SafetyButton.cpp b/src/drivers/safety_button/SafetyButton.cpp index 2d1a2a202ed3..4b96baae1ae9 100644 --- a/src/drivers/safety_button/SafetyButton.cpp +++ b/src/drivers/safety_button/SafetyButton.cpp @@ -154,34 +154,34 @@ int SafetyButton::task_spawn(int argc, char *argv[]) { if (PX4_MFT_HW_SUPPORTED(PX4_MFT_PX4IO)) { - PX4_ERR("not starting (use px4io for safety button)"); + PX4_INFO("not starting (use px4io for safety button)"); - return PX4_ERROR; - - } else if (circuit_breaker_enabled("CBRK_IO_SAFETY", CBRK_IO_SAFETY_KEY)) { - PX4_WARN("disabled by CBRK_IO_SAFETY, exiting"); - return PX4_ERROR; + return PX4_OK; + } - } else { - SafetyButton *instance = new SafetyButton(); + if (circuit_breaker_enabled("CBRK_IO_SAFETY", CBRK_IO_SAFETY_KEY)) { + PX4_INFO("disabled by CBRK_IO_SAFETY, not starting"); + return PX4_OK; + } - if (instance) { - _object.store(instance); - _task_id = task_id_is_work_queue; + SafetyButton *instance = new SafetyButton(); - if (instance->Start() == PX4_OK) { - return PX4_OK; - } + if (instance) { + _object.store(instance); + _task_id = task_id_is_work_queue; - } else { - PX4_ERR("alloc failed"); + if (instance->Start() == PX4_OK) { + return PX4_OK; } - delete instance; - _object.store(nullptr); - _task_id = -1; + } else { + PX4_ERR("alloc failed"); } + delete instance; + _object.store(nullptr); + _task_id = -1; + return PX4_ERROR; }