From d642254f186c6f7697ee76c43c1b68380ee589b0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 9 Dec 2013 14:15:16 +1100 Subject: [PATCH] Plane: breakup one second loop into 3 pieces this prevents it not running when gimbal is active --- ArduPlane/ArduPlane.pde | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/ArduPlane/ArduPlane.pde b/ArduPlane/ArduPlane.pde index 8c9f868ce0..52e1afc65c 100644 --- a/ArduPlane/ArduPlane.pde +++ b/ArduPlane/ArduPlane.pde @@ -734,7 +734,9 @@ static const AP_Scheduler::Task scheduler_tasks[] PROGMEM = { { barometer_accumulate, 1, 900 }, { update_notify, 1, 300 }, { read_sonars, 1, 500 }, - { one_second_loop, 50, 3900 }, + { one_second_loop, 50, 1000 }, + { log_perf_info, 500, 1000 }, + { compass_save, 3000, 2500 }, { check_long_failsafe, 15, 1000 }, { airspeed_ratio_update, 50, 1000 }, { update_logging, 5, 1200 }, @@ -968,25 +970,23 @@ static void one_second_loop() mavlink_system.sysid = g.sysid_this_mav; update_aux(); +} - static uint8_t counter; - counter++; - - if (counter % 10 == 0) { - if (scheduler.debug() != 0) { - hal.console->printf_P(PSTR("G_Dt_max=%lu\n"), (unsigned long)G_Dt_max); - } - if (g.log_bitmask & MASK_LOG_PM) - Log_Write_Performance(); - G_Dt_max = 0; - resetPerfData(); +static void log_perf_info() +{ + if (scheduler.debug() != 0) { + hal.console->printf_P(PSTR("G_Dt_max=%lu\n"), (unsigned long)G_Dt_max); } + if (g.log_bitmask & MASK_LOG_PM) + Log_Write_Performance(); + G_Dt_max = 0; + resetPerfData(); +} - if (counter >= 60) { - if(g.compass_enabled) { - compass.save_offsets(); - } - counter = 0; +static void compass_save() +{ + if (g.compass_enabled) { + compass.save_offsets(); } }