Skip to content

Commit

Permalink
safety_button: reduce output verbosity if disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
bkueng committed Aug 27, 2019
1 parent 728955e commit ab629a8
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/drivers/safety_button/SafetyButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit ab629a8

Please sign in to comment.