From 652292e5c0796eee0ba94b0738bc266be14b8597 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 1 May 2017 16:14:32 +1000 Subject: [PATCH] Sub: move init of DataFlash references into vehicle init It is possible to start a log before the existing codepath is crossed. --- ArduSub/Log.cpp | 2 -- ArduSub/system.cpp | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ArduSub/Log.cpp b/ArduSub/Log.cpp index 242e75d00f..8c9ceb6715 100644 --- a/ArduSub/Log.cpp +++ b/ArduSub/Log.cpp @@ -472,8 +472,6 @@ void Sub::start_logging() if (g.log_bitmask != 0 && !in_log_download) { if (!ap.logging_started) { ap.logging_started = true; - DataFlash.set_mission(&mission); - DataFlash.setVehicle_Startup_Log_Writer(FUNCTOR_BIND(&sub, &Sub::Log_Write_Vehicle_Startup_Messages, void)); DataFlash.StartNewLog(); } else if (!DataFlash.logging_started()) { hal.console->println("Starting new log"); diff --git a/ArduSub/system.cpp b/ArduSub/system.cpp index 6fabaa6dfc..a586373372 100644 --- a/ArduSub/system.cpp +++ b/ArduSub/system.cpp @@ -165,6 +165,10 @@ void Sub::init_ardupilot() // initialise mission library mission.init(); + // initialise DataFlash library + DataFlash.set_mission(&mission); + DataFlash.setVehicle_Startup_Log_Writer(FUNCTOR_BIND(&sub, &Sub::Log_Write_Vehicle_Startup_Messages, void)); + startup_INS_ground(); // we don't want writes to the serial port to cause us to pause