fixed total flight time counting bug

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.
This commit is contained in:
Maximilian Laiacker
2019-09-11 11:24:57 +02:00
committed by Beat Küng
parent c13835c0f0
commit 72e93a9c36

View File

@@ -104,7 +104,7 @@ void LandDetector::Run()
(_land_detected.in_ground_effect != in_ground_effect) || (_land_detected.in_ground_effect != in_ground_effect) ||
(fabsf(_land_detected.alt_max - alt_max) > FLT_EPSILON)) { (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 // We did take off
_takeoff_time = now; _takeoff_time = now;
} }