tobozo / M5Stack-SD-Updater

💾 Customizable menu system for M5Stack, M5Unified and ESP32-Chimera-Core - loads apps from the Micro SD card. Easily add you own apps
MIT License
309 stars 41 forks source link

M5Stack.h and SdFat.h combination causes compile error #180

Closed GOB52 closed 1 year ago

GOB52 commented 1 year ago

The combination of M5Unified and SdFat is not a problem though, M5Stack and SdFat combination causes compile error.

#include <M5Stack.h>
#include <LovyanGFX.h>
LGFX lcd;
# define SDU_NO_AUTODETECT
# define USE_SDFATFS
# define HAS_M5_API
# define SDU_USE_DISPLAY
# define HAS_LGFX
# define SDU_Sprite LGFX_Sprite
# define SDU_DISPLAY_TYPE LGFX*
# define SDU_DISPLAY_OBJ_PTR &lcd
# include <M5StackUpdater.h>
.pio/libdeps/release_SDU/M5Stack-SD-Updater/src/M5StackUpdater.hpp:541:13: error: 'SDU_SdFatFsPtr' was not declared in this scope
         if( SDU_SdFatFsPtr ) {
// and more errors.

The reason seems to be that __SDH_\ is enabled because M5Stack.h depends on SD.h. ("#if !SDU_HAS_FS" in M5StackUpdater.hpp does not enable and SdFat-related includes are not performed)

// In this combination, 
// SDU_HAS_FS is not zero, so not going through SdFat related parts.
#if ! SDU_HAS_FS  
  #define SDU_HAS_SD 
  #if defined USE_SDFATFS
    #pragma message "SDUpdater will use SdFat" 
    #undef __has_include
    #include <misc/sdfat32fs_wrapper.h>

Sorry if this is an unsupported combination.

tobozo commented 1 year ago

hi, thanks for your feedback,

thanks to your input I made a few tests and it looks like SdFat.h and SD.h aren't mutually exclusive anymore.

M5Core2.h

image

M5Stack.h

image

I'll run some CI tests with the new macro system to see if this didnt break anything :wink:

tobozo commented 1 year ago

CI tests didn't yield any error, however I spotted a nasty bug with SDUCfg.setBinFileName() and will produce a new release and close the associated issues.