mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 19:07:45 +08:00
Commander: Decouple land detection states
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user