From 513d5c17b9d1244a605a4576ee7be019ed4793c9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 26 Dec 2015 14:12:39 +1100 Subject: [PATCH] Plane: allow for settable main loop rate --- ArduPlane/Plane.h | 3 --- ArduPlane/system.cpp | 2 +- ArduPlane/test.cpp | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ArduPlane/Plane.h b/ArduPlane/Plane.h index bb03d924e0..665dd3fd2a 100644 --- a/ArduPlane/Plane.h +++ b/ArduPlane/Plane.h @@ -146,9 +146,6 @@ private: AP_Vehicle::FixedWing aparm; AP_HAL::BetterStream* cliSerial; - // the rate we run the main loop - const AP_InertialSensor::Sample_rate ins_sample_rate = AP_InertialSensor::RATE_50HZ; - // Global parameters are all contained within the 'g' class. Parameters g; diff --git a/ArduPlane/system.cpp b/ArduPlane/system.cpp index fcb2cce82f..18b4c509bb 100644 --- a/ArduPlane/system.cpp +++ b/ArduPlane/system.cpp @@ -569,7 +569,7 @@ void Plane::startup_INS_ground(void) ahrs.set_vehicle_class(AHRS_VEHICLE_FIXED_WING); ahrs.set_wind_estimation(true); - ins.init(ins_sample_rate); + ins.init(scheduler.get_loop_rate_hz()); ahrs.reset(); // read Baro pressure at ground diff --git a/ArduPlane/test.cpp b/ArduPlane/test.cpp index fb9dc3af0a..05ea80c1a8 100644 --- a/ArduPlane/test.cpp +++ b/ArduPlane/test.cpp @@ -350,7 +350,7 @@ int8_t Plane::test_ins(uint8_t argc, const Menu::arg *argv) ahrs.set_fly_forward(true); ahrs.set_wind_estimation(true); - ins.init(ins_sample_rate); + ins.init(scheduler.get_loop_rate_hz()); ahrs.reset(); print_hit_enter(); @@ -411,7 +411,7 @@ int8_t Plane::test_mag(uint8_t argc, const Menu::arg *argv) ahrs.set_compass(&compass); // we need the AHRS initialised for this test - ins.init(ins_sample_rate); + ins.init(scheduler.get_loop_rate_hz()); ahrs.reset(); uint16_t counter = 0;