From 753b710477d7c8f27e5a046b5adcfd05cc40e296 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 11 Apr 2018 22:55:31 +1000 Subject: [PATCH] Tracker: Baro does its own dataflash logging --- AntennaTracker/AntennaTracker.cpp | 2 +- AntennaTracker/Log.cpp | 6 ------ AntennaTracker/Tracker.h | 2 -- AntennaTracker/sensors.cpp | 10 ---------- AntennaTracker/system.cpp | 1 + 5 files changed, 2 insertions(+), 19 deletions(-) diff --git a/AntennaTracker/AntennaTracker.cpp b/AntennaTracker/AntennaTracker.cpp index 86c0b2507a..9275e1fb74 100644 --- a/AntennaTracker/AntennaTracker.cpp +++ b/AntennaTracker/AntennaTracker.cpp @@ -38,7 +38,7 @@ const AP_Scheduler::Task Tracker::scheduler_tasks[] = { SCHED_TASK(update_GPS, 10, 4000), SCHED_TASK(update_compass, 10, 1500), SCHED_TASK_CLASS(AP_BattMonitor, &tracker.battery, read, 10, 1500), - SCHED_TASK(update_barometer, 10, 1500), + SCHED_TASK_CLASS(AP_Baro, &tracker.barometer, update, 10, 1500), SCHED_TASK(gcs_update, 50, 1700), SCHED_TASK(gcs_data_stream_send, 50, 3000), SCHED_TASK(compass_accumulate, 50, 1500), diff --git a/AntennaTracker/Log.cpp b/AntennaTracker/Log.cpp index d003d8abb7..c382d12e28 100644 --- a/AntennaTracker/Log.cpp +++ b/AntennaTracker/Log.cpp @@ -19,11 +19,6 @@ void Tracker::Log_Write_Attitude() DataFlash.Log_Write_POS(ahrs); } -void Tracker::Log_Write_Baro(void) -{ - DataFlash.Log_Write_Baro(); -} - struct PACKED log_Vehicle_Baro { LOG_PACKET_HEADER; uint64_t time_us; @@ -95,7 +90,6 @@ void Tracker::log_init(void) #else // LOGGING_ENABLED void Tracker::Log_Write_Attitude(void) {} -void Tracker::Log_Write_Baro(void) {} void Tracker::log_init(void) {} void Tracker::Log_Write_Vehicle_Pos(int32_t lat, int32_t lng, int32_t alt, const Vector3f& vel) {} diff --git a/AntennaTracker/Tracker.h b/AntennaTracker/Tracker.h index 9568852469..c7b9f9a914 100644 --- a/AntennaTracker/Tracker.h +++ b/AntennaTracker/Tracker.h @@ -220,7 +220,6 @@ private: void update_scan(void); bool servo_test_set_servo(uint8_t servo_num, uint16_t pwm); void read_radio(); - void update_barometer(void); void update_ahrs(); void update_compass(void); void compass_accumulate(void); @@ -256,7 +255,6 @@ private: void init_capabilities(void); void compass_cal_update(); void Log_Write_Attitude(); - void Log_Write_Baro(void); void Log_Write_Vehicle_Pos(int32_t lat,int32_t lng,int32_t alt, const Vector3f& vel); void Log_Write_Vehicle_Baro(float pressure, float altitude); void Log_Write_Vehicle_Startup_Messages(); diff --git a/AntennaTracker/sensors.cpp b/AntennaTracker/sensors.cpp index ea03ef8224..12894d2ecb 100644 --- a/AntennaTracker/sensors.cpp +++ b/AntennaTracker/sensors.cpp @@ -1,15 +1,5 @@ #include "Tracker.h" -// read the barometer and return the updated altitude in meters -void Tracker::update_barometer(void) -{ - barometer.update(); - if (should_log(MASK_LOG_IMU)) { - Log_Write_Baro(); - } -} - - /* update INS and attitude */ diff --git a/AntennaTracker/system.cpp b/AntennaTracker/system.cpp index 79720a96f5..c128edd368 100644 --- a/AntennaTracker/system.cpp +++ b/AntennaTracker/system.cpp @@ -46,6 +46,7 @@ void Tracker::init_tracker() AP_Notify::flags.failsafe_battery = false; // init baro before we start the GCS, so that the CLI baro test works + barometer.set_log_baro_bit(MASK_LOG_IMU); barometer.init(); // we start by assuming USB connected, as we initialed the serial