From 67eca06cac4527d0a6cc6b0521213dfb4a0af91b Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 17 Apr 2024 13:07:07 +1000 Subject: [PATCH] Rover: fold startup_ground back into caller remove stale comments around same. rename method to avoid confusion --- Rover/Rover.h | 2 +- Rover/system.cpp | 49 ++++++++++++++++-------------------------------- 2 files changed, 17 insertions(+), 34 deletions(-) diff --git a/Rover/Rover.h b/Rover/Rover.h index 8873b844e2..6b2493d4fc 100644 --- a/Rover/Rover.h +++ b/Rover/Rover.h @@ -393,7 +393,7 @@ private: return control_mode == &mode_auto; } - void startup_INS_ground(void); + void startup_INS(void); void notify_mode(const Mode *new_mode); uint8_t check_digital_pin(uint8_t pin); bool should_log(uint32_t mask); diff --git a/Rover/system.cpp b/Rover/system.cpp index e0c4c9ce5b..b00c2cae1e 100644 --- a/Rover/system.cpp +++ b/Rover/system.cpp @@ -1,10 +1,3 @@ -/***************************************************************************** -The init_ardupilot function processes everything we need for an in - air restart - We will determine later if we are actually on the ground and process a - ground start in that case. - -*****************************************************************************/ - #include "Rover.h" static void failsafe_check_static() @@ -121,7 +114,21 @@ void Rover::init_ardupilot() g2.oa.init(); #endif - startup_ground(); + set_mode(mode_initializing, ModeReason::INITIALISED); + + startup_INS(); + +#if AP_MISSION_ENABLED + // initialise mission library + mode_auto.mission.init(); +#endif + + // initialise AP_Logger library +#if HAL_LOGGING_ENABLED + logger.setVehicle_Startup_Writer( + FUNCTOR_BIND(&rover, &Rover::Log_Write_Vehicle_Startup_Messages, void) + ); +#endif Mode *initial_mode = mode_from_mode_num((enum Mode::Number)g.initial_mode.get()); if (initial_mode == nullptr) { @@ -145,30 +152,6 @@ void Rover::init_ardupilot() initialised = true; } -//********************************************************************************* -// This function does all the calibrations, etc. that we need during a ground start -//********************************************************************************* -void Rover::startup_ground(void) -{ - set_mode(mode_initializing, ModeReason::INITIALISED); - - // IMU ground start - //------------------------ - // - - startup_INS_ground(); - - // initialise mission library - mode_auto.mission.init(); - - // initialise AP_Logger library -#if HAL_LOGGING_ENABLED - logger.setVehicle_Startup_Writer( - FUNCTOR_BIND(&rover, &Rover::Log_Write_Vehicle_Startup_Messages, void) - ); -#endif -} - // update the ahrs flyforward setting which can allow // the vehicle's movements to be used to estimate heading void Rover::update_ahrs_flyforward() @@ -285,7 +268,7 @@ bool Rover::set_mode(Mode::Number new_mode, ModeReason reason) return rover.set_mode(*mode, reason); } -void Rover::startup_INS_ground(void) +void Rover::startup_INS(void) { gcs().send_text(MAV_SEVERITY_INFO, "Beginning INS calibration. Do not move vehicle"); hal.scheduler->delay(100);