PreFlightCheck: Check if SD card is present only once and store the result

statfs accesses the file-system and can be blocking for an extended period. Since the SD card check is part of the preflight checks in the main thread of commander, it could block its execution and cause various issues. The SD card is only mounted in rcS during boot so the state will not change after the first check.
This commit is contained in:
Michael Schaeuble
2021-03-30 08:20:49 +02:00
committed by Beat Küng
parent c2350c06c1
commit f9af1bbe2d
4 changed files with 8 additions and 7 deletions
@@ -119,5 +119,5 @@ private:
static bool manualControlCheck(orb_advert_t *mavlink_log_pub, const bool report_fail);
static bool airframeCheck(orb_advert_t *mavlink_log_pub, const vehicle_status_s &status);
static bool cpuResourceCheck(orb_advert_t *mavlink_log_pub, const bool report_fail);
static bool sdcardCheck(orb_advert_t *mavlink_log_pub, const bool report_fail);
static bool sdcardCheck(orb_advert_t *mavlink_log_pub, bool &sd_card_detected_once, const bool report_fail);
};