From 342d95ad2ff45750eb636b594ac7673cca328038 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 30 Jun 2017 21:35:49 +1000 Subject: [PATCH] Sub: move starting of new logs into DataFlash --- ArduSub/Log.cpp | 17 ----------------- ArduSub/Sub.h | 1 - ArduSub/motors.cpp | 1 - ArduSub/system.cpp | 11 ++--------- 4 files changed, 2 insertions(+), 28 deletions(-) diff --git a/ArduSub/Log.cpp b/ArduSub/Log.cpp index 2e158da2cd..7c6b953a24 100644 --- a/ArduSub/Log.cpp +++ b/ArduSub/Log.cpp @@ -466,22 +466,6 @@ void Sub::Log_Write_Vehicle_Startup_Messages() } -void Sub::start_logging() -{ - if (g.log_bitmask == 0) { - return; - } - if (DataFlash.in_log_download()) { - return; - } - - ap.logging_started = true; - - // dataflash may have stopped logging - when we get_log_data, - // for example. Always try to restart: - DataFlash.StartUnstartedLogging(); -} - void Sub::log_init(void) { DataFlash.Init(log_structure, ARRAY_SIZE(log_structure)); @@ -515,7 +499,6 @@ void Sub::Log_Write_GuidedTarget(uint8_t target_type, const Vector3f& pos_target void Sub::Log_Write_Optflow() {} #endif -void Sub::start_logging() {} void Sub::log_init(void) {} #endif // LOGGING_ENABLED diff --git a/ArduSub/Sub.h b/ArduSub/Sub.h index 553132b48c..429df40489 100644 --- a/ArduSub/Sub.h +++ b/ArduSub/Sub.h @@ -515,7 +515,6 @@ private: void Log_Sensor_Health(); void Log_Write_GuidedTarget(uint8_t target_type, const Vector3f& pos_target, const Vector3f& vel_target); void Log_Write_Vehicle_Startup_Messages(); - void start_logging() ; void load_parameters(void); void userhook_init(); void userhook_FastLoop(); diff --git a/ArduSub/motors.cpp b/ArduSub/motors.cpp index 34fba256e1..b73bf72f1d 100644 --- a/ArduSub/motors.cpp +++ b/ArduSub/motors.cpp @@ -12,7 +12,6 @@ void Sub::enable_motor_output() // returns false if arming failed because of pre-arm checks, arming checks or a gyro calibration failure bool Sub::init_arm_motors(bool arming_from_gcs) { - start_logging(); static bool in_arm_motors = false; // exit immediately if already in this function diff --git a/ArduSub/system.cpp b/ArduSub/system.cpp index 7f69421ad1..78d95f0316 100644 --- a/ArduSub/system.cpp +++ b/ArduSub/system.cpp @@ -189,10 +189,6 @@ void Sub::init_ardupilot() // init vehicle capabilties init_capabilities(); - if (DataFlash.log_while_disarmed()) { - start_logging(); // create a new log if necessary - } - // disable safety if requested BoardConfig.init_safety(); @@ -295,11 +291,8 @@ bool Sub::optflow_position_ok() bool Sub::should_log(uint32_t mask) { #if LOGGING_ENABLED == ENABLED - if (!DataFlash.should_log(mask)) { - return false; - } - start_logging(); - return true; + ap.logging_started = DataFlash.logging_started(); + return DataFlash.should_log(mask); #else return false; #endif