From ee5ff413a9a64ea0bb4ad351fa6ff5679ae2c429 Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Thu, 19 Aug 2021 12:19:12 +0100 Subject: [PATCH] Blimp: remove stick gesture compass cal start and stop --- Blimp/Blimp.cpp | 2 +- Blimp/Blimp.h | 1 - Blimp/sensors.cpp | 31 ------------------------------- 3 files changed, 1 insertion(+), 33 deletions(-) diff --git a/Blimp/Blimp.cpp b/Blimp/Blimp.cpp index 34d0f6df35..f8b89787ba 100644 --- a/Blimp/Blimp.cpp +++ b/Blimp/Blimp.cpp @@ -56,7 +56,7 @@ const AP_Scheduler::Task Blimp::scheduler_tasks[] = { #endif SCHED_TASK_CLASS(AP_InertialSensor, &blimp.ins, periodic, 400, 50), SCHED_TASK_CLASS(AP_Scheduler, &blimp.scheduler, update_logging, 0.1, 75), - SCHED_TASK(compass_cal_update, 100, 100), + SCHED_TASK_CLASS(Compass, &blimp.compass, cal_update, 100, 100), SCHED_TASK(accel_cal_update, 10, 100), #if STATS_ENABLED == ENABLED SCHED_TASK_CLASS(AP_Stats, &blimp.g2.stats, update, 1, 100), diff --git a/Blimp/Blimp.h b/Blimp/Blimp.h index 9440627b58..64afa541dd 100644 --- a/Blimp/Blimp.h +++ b/Blimp/Blimp.h @@ -429,7 +429,6 @@ private: bool rangefinder_up_ok(); void rpm_update(); void update_optical_flow(void); - void compass_cal_update(void); void accel_cal_update(void); void init_proximity(); void update_proximity(); diff --git a/Blimp/sensors.cpp b/Blimp/sensors.cpp index 4370519764..b52366d039 100644 --- a/Blimp/sensors.cpp +++ b/Blimp/sensors.cpp @@ -8,37 +8,6 @@ void Blimp::read_barometer(void) baro_alt = barometer.get_altitude() * 100.0f; } - -void Blimp::compass_cal_update() -{ - compass.cal_update(); - - if (hal.util->get_soft_armed()) { - return; - } - - static uint32_t compass_cal_stick_gesture_begin = 0; - - if (compass.is_calibrating()) { - if (channel_yaw->get_control_in() < -4000 && channel_down->get_control_in() > 900) { - compass.cancel_calibration_all(); - } - } else { - bool stick_gesture_detected = compass_cal_stick_gesture_begin != 0 && !motors->armed() && channel_yaw->get_control_in() > 4000 && channel_down->get_control_in() > 900; - uint32_t tnow = millis(); - - if (!stick_gesture_detected) { - compass_cal_stick_gesture_begin = tnow; - } else if (tnow-compass_cal_stick_gesture_begin > 1000*COMPASS_CAL_STICK_GESTURE_TIME) { -#ifdef CAL_ALWAYS_REBOOT - compass.start_calibration_all(true,true,COMPASS_CAL_STICK_DELAY,true); -#else - compass.start_calibration_all(true,true,COMPASS_CAL_STICK_DELAY,false); -#endif - } - } -} - void Blimp::accel_cal_update() { if (hal.util->get_soft_armed()) {