diff --git a/libraries/AP_Filesystem/AP_Filesystem.h b/libraries/AP_Filesystem/AP_Filesystem.h index 5f886097e4..972b8e93dd 100644 --- a/libraries/AP_Filesystem/AP_Filesystem.h +++ b/libraries/AP_Filesystem/AP_Filesystem.h @@ -24,21 +24,24 @@ #include "AP_Filesystem_Available.h" +#ifndef MAX_NAME_LEN +#define MAX_NAME_LEN 255 +#endif + #if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS #if HAVE_FILESYSTEM_SUPPORT #include "AP_Filesystem_FATFS.h" #endif #define DT_REG 0 #define DT_DIR 1 -#if defined(FF_MAX_LFN) && FF_USE_LFN != 0 -#define MAX_NAME_LEN FF_MAX_LFN -#else -#define MAX_NAME_LEN 13 -#endif + struct dirent { char d_name[MAX_NAME_LEN]; /* filename */ uint8_t d_type; }; + +#endif // HAL_BOARD_CHIBIOS + #include #include #include @@ -46,10 +49,12 @@ struct dirent { #ifndef AP_FILESYSTEM_FORMAT_ENABLED // only enable for SDMMC filesystems for now as other types can't query // block size -#define AP_FILESYSTEM_FORMAT_ENABLED (STM32_SDC_USE_SDMMC1==TRUE || STM32_SDC_USE_SDMMC2==TRUE) +#ifndef HAL_USE_SDMMC +#define HAL_USE_SDMMC 0 +#endif +#define AP_FILESYSTEM_FORMAT_ENABLED HAL_USE_SDMMC #endif -#endif // HAL_BOARD_CHIBIOS #if CONFIG_HAL_BOARD == HAL_BOARD_LINUX || CONFIG_HAL_BOARD == HAL_BOARD_SITL #include "AP_Filesystem_posix.h" #endif diff --git a/libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp b/libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp index b330a09b57..887aabfd98 100644 --- a/libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp +++ b/libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp @@ -9,6 +9,7 @@ #if HAVE_FILESYSTEM_SUPPORT && CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS +#include #include #include diff --git a/libraries/AP_Filesystem/AP_Filesystem_FATFS.h b/libraries/AP_Filesystem/AP_Filesystem_FATFS.h index cabb3ba6e0..5193555947 100644 --- a/libraries/AP_Filesystem/AP_Filesystem_FATFS.h +++ b/libraries/AP_Filesystem/AP_Filesystem_FATFS.h @@ -9,7 +9,6 @@ #include #include #include -#include #include "AP_Filesystem_backend.h" // Seek offset macros @@ -17,12 +16,6 @@ #define SEEK_CUR 1 #define SEEK_END 2 -#if FF_USE_LFN != 0 -#define MAX_NAME_LEN FF_MAX_LFN -#else -#define MAX_NAME_LEN 13 -#endif - class AP_Filesystem_FATFS : public AP_Filesystem_Backend { public: