Skip to content

Commit

Permalink
fixed total flight time counting bug
Browse files Browse the repository at this point in the history
After landing it can happen that a second take off is detected and then the _takeoff_time is rest, resulting in a wrong total flight time counter. With this fix the flight time is reliably counted from the first take off until the vehicle is disarmed. Normally the vehicle will not spend much time armed after landing, if it does the flight time will be off but this is the same as before this fix. This fix was tested in several flight experiments.
  • Loading branch information
mlaiacker authored and bkueng committed Sep 17, 2019
1 parent c13835c commit 72e93a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/land_detector/LandDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void LandDetector::Run()
(_land_detected.in_ground_effect != in_ground_effect) ||
(fabsf(_land_detected.alt_max - alt_max) > FLT_EPSILON)) {

if (!landDetected && _land_detected.landed) {
if (!landDetected && _land_detected.landed && _takeoff_time == 0) { /* only set take off time once, until disarming */
// We did take off
_takeoff_time = now;
}
Expand Down

0 comments on commit 72e93a9

Please sign in to comment.