Browse Source

Plane: check G_Dt to catch startup errors

this catches cases where constructors lead to G_Dt being incorrect
apm_2208
Andrew Tridgell 3 years ago
parent
commit
25e317d6b1
  1. 7
      ArduPlane/ArduPlane.cpp

7
ArduPlane/ArduPlane.cpp

@ -334,6 +334,13 @@ void Plane::one_second_loop() @@ -334,6 +334,13 @@ void Plane::one_second_loop()
// reset the landing altitude correction
landing.alt_offset = 0;
}
// this ensures G_Dt is correct, catching startup issues with constructors
// calling the scheduler methods
if (!is_equal(1.0f/scheduler.get_loop_rate_hz(), scheduler.get_loop_period_s()) ||
!is_equal(G_Dt, scheduler.get_loop_period_s())) {
INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
}
}
void Plane::three_hz_loop()

Loading…
Cancel
Save