Commander: Decouple land detection states

This commit is contained in:
Lorenz Meier
2016-04-23 15:47:59 +02:00
parent ba817c7e45
commit 8955fdc0e1
+8 -4
View File
@@ -1924,16 +1924,20 @@ int commander_thread_main(int argc, char *argv[])
} }
if ((updated && status_flags.condition_local_altitude_valid) || check_for_disarming) { if ((updated && status_flags.condition_local_altitude_valid) || check_for_disarming) {
if ((was_landed != land_detector.landed) || (was_falling != land_detector.freefall)) { if (was_landed != land_detector.landed) {
if (land_detector.freefall) { if (land_detector.landed) {
mavlink_and_console_log_info(&mavlink_log_pub, "FREEFALL DETECTED");
} else if (land_detector.landed) {
mavlink_and_console_log_info(&mavlink_log_pub, "LANDING DETECTED"); mavlink_and_console_log_info(&mavlink_log_pub, "LANDING DETECTED");
} else { } else {
mavlink_and_console_log_info(&mavlink_log_pub, "TAKEOFF DETECTED"); mavlink_and_console_log_info(&mavlink_log_pub, "TAKEOFF DETECTED");
} }
} }
if (was_falling != land_detector.freefall) {
if (land_detector.freefall) {
mavlink_and_console_log_info(&mavlink_log_pub, "FREEFALL DETECTED");
}
}
if (disarm_when_landed > 0) { if (disarm_when_landed > 0) {
if (land_detector.landed) { if (land_detector.landed) {
if (!check_for_disarming && _inair_last_time > 0) { if (!check_for_disarming && _inair_last_time > 0) {