From 5daa38ffba0f7db265a7ef51993cf49892201a0e Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 13 Jun 2023 21:54:15 +1000 Subject: [PATCH] AP_Vehicle: initialise generator before init_ardupilot each of the vehicles does a load-defaults-from-files. Use that fact to ensure any generator backend parameter's defaults are loaded. --- libraries/AP_Vehicle/AP_Vehicle.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/AP_Vehicle/AP_Vehicle.cpp b/libraries/AP_Vehicle/AP_Vehicle.cpp index b88427fcf9..2e888b3e30 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.cpp +++ b/libraries/AP_Vehicle/AP_Vehicle.cpp @@ -220,6 +220,10 @@ void AP_Vehicle::setup() externalAHRS.init(); #endif +#if HAL_GENERATOR_ENABLED + generator.init(); +#endif + // init_ardupilot is where the vehicle does most of its initialisation. init_ardupilot(); @@ -272,10 +276,6 @@ void AP_Vehicle::setup() send_watchdog_reset_statustext(); -#if HAL_GENERATOR_ENABLED - generator.init(); -#endif - #if AP_OPENDRONEID_ENABLED opendroneid.init(); #endif