Commander: Do not switch land detection state when not armed

This is important to have the probation times set up correctly and to silence land detected messages for systems that are not actually flying and just on the bench.
This commit is contained in:
Lorenz Meier 2018-01-01 15:13:46 +01:00
parent e7fe8f7268
commit 3b71c70583
1 changed files with 22 additions and 21 deletions

View File

@ -1,6 +1,5 @@
/****************************************************************************
*
* Copyright (c) 2013-2017 PX4 Development Team. All rights reserved.
* Copyright (c) 2013-2018 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -2170,6 +2169,8 @@ Commander::run()
if (updated) {
orb_copy(ORB_ID(vehicle_land_detected), land_detector_sub, &land_detector);
// Only take actions if armed
if (armed.armed) {
if (was_landed != land_detector.landed) {
if (land_detector.landed) {
mavlink_and_console_log_info(&mavlink_log_pub, "Landing detected");
@ -2192,7 +2193,7 @@ Commander::run()
mavlink_and_console_log_info(&mavlink_log_pub, "Freefall detected");
}
}
}
was_landed = land_detector.landed;
was_falling = land_detector.freefall;