From 91be844b66b7104a6bab0b585e0086b5a594440e Mon Sep 17 00:00:00 2001 From: Leonard Hall Date: Mon, 29 Jul 2019 17:05:12 +0930 Subject: [PATCH] Copter: Let modes stop Attitude Logging --- ArduCopter/Copter.cpp | 7 +++++-- ArduCopter/mode.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ArduCopter/Copter.cpp b/ArduCopter/Copter.cpp index 0497927698..5a9fedd7a4 100644 --- a/ArduCopter/Copter.cpp +++ b/ArduCopter/Copter.cpp @@ -330,7 +330,7 @@ void Copter::update_batt_compass(void) // should be run at 400hz void Copter::fourhundred_hz_logging() { - if (should_log(MASK_LOG_ATTITUDE_FAST)) { + if (should_log(MASK_LOG_ATTITUDE_FAST) && !copter.flightmode->stop_attitude_logging()) { Log_Write_Attitude(); } } @@ -340,8 +340,11 @@ void Copter::fourhundred_hz_logging() void Copter::ten_hz_logging_loop() { // log attitude data if we're not already logging at the higher rate - if (should_log(MASK_LOG_ATTITUDE_MED) && !should_log(MASK_LOG_ATTITUDE_FAST)) { + if (should_log(MASK_LOG_ATTITUDE_MED) && !should_log(MASK_LOG_ATTITUDE_FAST) && !copter.flightmode->stop_attitude_logging()) { Log_Write_Attitude(); + } + // log EKF attitude data + if (should_log(MASK_LOG_ATTITUDE_MED) || should_log(MASK_LOG_ATTITUDE_FAST)) { Log_Write_EKF_POS(); } if (should_log(MASK_LOG_MOTBATT)) { diff --git a/ArduCopter/mode.h b/ArduCopter/mode.h index eb71ac9ef0..3929759342 100644 --- a/ArduCopter/mode.h +++ b/ArduCopter/mode.h @@ -55,6 +55,7 @@ public: virtual bool is_autopilot() const { return false; } virtual bool has_user_takeoff(bool must_navigate) const { return false; } virtual bool in_guided_mode() const { return false; } + virtual bool stop_attitude_logging() const { return false; } // return a string for this flightmode virtual const char *name() const = 0;