diff --git a/ArduPlane/ArduPlane.cpp b/ArduPlane/ArduPlane.cpp index db4c86d21c..3773acdc6d 100644 --- a/ArduPlane/ArduPlane.cpp +++ b/ArduPlane/ArduPlane.cpp @@ -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()