From 6f5626d04f184a281f7e544f8bb5d0d59cc54499 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 14 Apr 2021 19:22:27 +1000 Subject: [PATCH] AP_Vehicle: fixed SD card slowdown with early mounts --- libraries/AP_Vehicle/AP_Vehicle.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libraries/AP_Vehicle/AP_Vehicle.cpp b/libraries/AP_Vehicle/AP_Vehicle.cpp index dace5829cb..b5b6f0aa7e 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.cpp +++ b/libraries/AP_Vehicle/AP_Vehicle.cpp @@ -6,6 +6,9 @@ #include #include #include +#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS +#include +#endif #define SCHED_TASK(func, rate_hz, max_time_micros) SCHED_TASK_CLASS(AP_Vehicle, &vehicle, func, rate_hz, max_time_micros) @@ -86,6 +89,14 @@ void AP_Vehicle::setup() load_parameters(); +#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS + if (AP_BoardConfig::get_sdcard_slowdown() != 0) { + // user wants the SDcard slower, we need to remount + sdcard_stop(); + sdcard_retry(); + } +#endif + // initialise the main loop scheduler const AP_Scheduler::Task *tasks; uint8_t task_count;