commander: only warn if termination happens

The termination warnings were printed even if termination was not
actually enabled. This was confusing and is therefore fixed.
This commit is contained in:
Julian Oes
2016-06-21 10:21:34 +02:00
committed by Lorenz Meier
parent 872b08f677
commit 67a4a57491
2 changed files with 6 additions and 2 deletions
+5 -2
View File
@@ -2300,7 +2300,8 @@ int commander_thread_main(int argc, char *argv[])
/* Check for mission flight termination */
if (armed.armed && mission_result.flight_termination) {
if (armed.armed && mission_result.flight_termination &&
!status_flags.circuit_breaker_flight_termination_disabled) {
armed.force_failsafe = true;
status_changed = true;
static bool flight_termination_printed = false;
@@ -2631,7 +2632,8 @@ int commander_thread_main(int argc, char *argv[])
}
/* Check for failure combinations which lead to flight termination */
if (armed.armed) {
if (armed.armed &&
!status_flags.circuit_breaker_flight_termination_disabled) {
/* At this point the data link and the gps system have been checked
* If we are not in a manual (RC stick controlled mode)
* and both failed we want to terminate the flight */
@@ -2879,6 +2881,7 @@ get_circuit_breaker_params()
status_flags.circuit_breaker_engaged_airspd_check = circuit_breaker_enabled("CBRK_AIRSPD_CHK", CBRK_AIRSPD_CHK_KEY);
status_flags.circuit_breaker_engaged_enginefailure_check = circuit_breaker_enabled("CBRK_ENGINEFAIL", CBRK_ENGINEFAIL_KEY);
status_flags.circuit_breaker_engaged_gpsfailure_check = circuit_breaker_enabled("CBRK_GPSFAIL", CBRK_GPSFAIL_KEY);
status_flags.circuit_breaker_flight_termination_disabled = circuit_breaker_enabled("CBRK_FLIGHTTERM", CBRK_FLIGHTTERM_KEY);
}
void
@@ -76,6 +76,7 @@ struct status_flags_s {
bool circuit_breaker_engaged_airspd_check;
bool circuit_breaker_engaged_enginefailure_check;
bool circuit_breaker_engaged_gpsfailure_check;
bool circuit_breaker_flight_termination_disabled;
bool circuit_breaker_engaged_usb_check;
bool offboard_control_signal_found_once;
bool offboard_control_signal_lost;