From 51111fc6e3eeaf61e564223c8b4d2a2231b9110e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 31 Dec 2017 12:16:33 +0100 Subject: [PATCH] IO Firmware: Document override behavior for manual override. --- src/modules/px4iofirmware/controls.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/modules/px4iofirmware/controls.c b/src/modules/px4iofirmware/controls.c index 462ce92dee..f65ffefe1c 100644 --- a/src/modules/px4iofirmware/controls.c +++ b/src/modules/px4iofirmware/controls.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2012-2014 PX4 Development Team. All rights reserved. + * Copyright (c) 2012-2017 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,6 +35,8 @@ * @file controls.c * * R/C inputs and servo outputs. + * + * @author Lorenz Meier */ #include @@ -492,11 +494,16 @@ controls_tick() * * Firstly, manual override must be enabled, RC input available and a mixer loaded. */ - if ((r_setup_arming & PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK) && - (r_status_flags & PX4IO_P_STATUS_FLAGS_RC_OK) && - !(r_raw_rc_flags & PX4IO_P_RAW_RC_FLAGS_FAILSAFE) && - !(r_setup_arming & PX4IO_P_SETUP_ARMING_RC_HANDLING_DISABLED) && - (r_status_flags & PX4IO_P_STATUS_FLAGS_MIXER_OK)) { + if (/* condition 1: Override is always allowed */ + (r_setup_arming & PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK) && + /* condition 2: We have valid RC control inputs from the user */ + (r_status_flags & PX4IO_P_STATUS_FLAGS_RC_OK) && + /* condition 3: The system didn't go already into failsafe mode with fixed outputs */ + !(r_raw_rc_flags & PX4IO_P_RAW_RC_FLAGS_FAILSAFE) && + /* condition 4: RC handling wasn't generally disabled */ + !(r_setup_arming & PX4IO_P_SETUP_ARMING_RC_HANDLING_DISABLED) && + /* condition 5: We have a valid mixer to map RC inputs to actuator outputs */ + (r_status_flags & PX4IO_P_STATUS_FLAGS_MIXER_OK)) { bool override = false;