diff --git a/src/cmnds/cmd_main.c b/src/cmnds/cmd_main.c index f9f956b82..cab34f2cb 100644 --- a/src/cmnds/cmd_main.c +++ b/src/cmnds/cmd_main.c @@ -13,7 +13,7 @@ int cmd_uartInitIndex = 0; -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS #include "../littlefs/our_lfs.h" #endif #ifdef PLATFORM_BL602 diff --git a/src/cmnds/cmd_newLEDDriver.c b/src/cmnds/cmd_newLEDDriver.c index e08d72286..e37276b19 100644 --- a/src/cmnds/cmd_newLEDDriver.c +++ b/src/cmnds/cmd_newLEDDriver.c @@ -14,7 +14,7 @@ #include "../cJSON/cJSON.h" #include #include -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS #include "../littlefs/our_lfs.h" #endif diff --git a/src/cmnds/cmd_newLEDDriver_colors.c b/src/cmnds/cmd_newLEDDriver_colors.c index 1d5c77a71..ec166bc38 100644 --- a/src/cmnds/cmd_newLEDDriver_colors.c +++ b/src/cmnds/cmd_newLEDDriver_colors.c @@ -11,7 +11,7 @@ #include "cmd_local.h" #include "../mqtt/new_mqtt.h" #include "../cJSON/cJSON.h" -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS #include "../littlefs/our_lfs.h" #endif diff --git a/src/cmnds/cmd_tasmota.c b/src/cmnds/cmd_tasmota.c index c7b53d74e..e2e0d99ce 100644 --- a/src/cmnds/cmd_tasmota.c +++ b/src/cmnds/cmd_tasmota.c @@ -6,7 +6,7 @@ #include "cmd_local.h" #include "../new_pins.h" #include "../new_cfg.h" -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS #include "../littlefs/our_lfs.h" #endif @@ -140,7 +140,7 @@ static commandResult_t cmnd_backlog(const void * context, const char *cmd, const // Returns a buffer created with malloc. // You must free it later. byte *LFS_ReadFile(const char *fname) { -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS if (lfs_present()){ lfs_file_t file; int lfsres; @@ -219,7 +219,7 @@ byte *LFS_ReadFile(const char *fname) { } static commandResult_t cmnd_lfsexec(const void * context, const char *cmd, const char *args, int cmdFlags){ -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS ADDLOG_DEBUG(LOG_FEATURE_CMD, "exec %s", args); if (lfs_present()){ lfs_file_t *file = os_malloc(sizeof(lfs_file_t)); diff --git a/src/cmnds/cmd_test.c b/src/cmnds/cmd_test.c index 9f3664848..677d81bd6 100644 --- a/src/cmnds/cmd_test.c +++ b/src/cmnds/cmd_test.c @@ -7,7 +7,7 @@ #include "../cJSON/cJSON.h" #include #include "cmd_local.h" -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS #include "../littlefs/our_lfs.h" #endif @@ -191,7 +191,7 @@ static commandResult_t testJSON(const void * context, const char *cmd, const cha // Usage for continous test: addRepeatingEvent 1 -1 lfs_test1 ir.bat static commandResult_t cmnd_lfs_test1(const void * context, const char *cmd, const char *args, int cmdFlags) { -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS if (lfs_present()) { lfs_file_t file; int lfsres; @@ -227,7 +227,7 @@ static commandResult_t cmnd_lfs_test1(const void * context, const char *cmd, con } // Usage for continous test: addRepeatingEvent 1 -1 lfs_test2 ir.bat static commandResult_t cmnd_lfs_test2(const void * context, const char *cmd, const char *args, int cmdFlags) { -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS if (lfs_present()) { lfs_file_t *file; int lfsres; diff --git a/src/httpserver/rest_interface.c b/src/httpserver/rest_interface.c index 9347f3197..419e30699 100644 --- a/src/httpserver/rest_interface.c +++ b/src/httpserver/rest_interface.c @@ -8,9 +8,7 @@ #include "../ota/ota.h" #include "../hal/hal_wifi.h" #include "../hal/hal_flashVars.h" -#ifdef ENABLE_LITTLEFS #include "../littlefs/our_lfs.h" -#endif #include "lwip/sockets.h" #if PLATFORM_XR809 @@ -81,7 +79,7 @@ static int http_rest_get_seriallog(http_request_t* request); static int http_rest_post_logconfig(http_request_t* request); static int http_rest_get_logconfig(http_request_t* request); -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS static int http_rest_get_lfs_delete(http_request_t* request); static int http_rest_get_lfs_file(http_request_t* request); static int http_rest_post_lfs_file(http_request_t* request); @@ -152,7 +150,7 @@ static int http_rest_get(http_request_t* request) { return http_rest_get_seriallog(request); } -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS if (!strcmp(request->url, "api/fsblock")) { uint32_t newsize = CFG_GetLFS_Size(); uint32_t newstart = (LFS_BLOCKS_END - newsize); @@ -173,7 +171,7 @@ static int http_rest_get(http_request_t* request) { } #endif -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS if (!strncmp(request->url, "api/lfs/", 8)) { return http_rest_get_lfs_file(request); } @@ -254,7 +252,7 @@ static int http_rest_post(http_request_t* request) { } -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS if (!strcmp(request->url, "api/fsblock")) { if (lfs_present()) { release_lfs(); @@ -328,7 +326,7 @@ static int http_rest_app(http_request_t* request) { return 0; } -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS int EndsWith(const char* str, const char* suffix) { diff --git a/src/littlefs/our_lfs.c b/src/littlefs/our_lfs.c index 01e3ed70b..7fad1dbbe 100644 --- a/src/littlefs/our_lfs.c +++ b/src/littlefs/our_lfs.c @@ -21,7 +21,7 @@ //https://github.com/littlefs-project/littlefs -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS // define the feature ADDLOGF_XXX will use #define LOG_FEATURE LOG_FEATURE_LFS diff --git a/src/littlefs/our_lfs.h b/src/littlefs/our_lfs.h index 47754d082..f3ce7e570 100644 --- a/src/littlefs/our_lfs.h +++ b/src/littlefs/our_lfs.h @@ -9,7 +9,6 @@ *****************************************************************************/ #include "../obk_config.h" -#include "lfs.h" // we need that even if LFS is disabled @@ -36,6 +35,8 @@ #if ENABLE_LITTLEFS +#include "lfs.h" + // 512k MAX - i.e. no more that 0x80000 // 0x8000 = 32k #define LFS_BLOCKS_MIN_LEN 0x4000 diff --git a/src/new_cfg.c b/src/new_cfg.c index fc5bf3595..26a371d8c 100644 --- a/src/new_cfg.c +++ b/src/new_cfg.c @@ -8,7 +8,7 @@ #include "hal/hal_wifi.h" #include "hal/hal_flashConfig.h" #include "cmnds/cmd_public.h" -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS #include "littlefs/our_lfs.h" #endif @@ -668,7 +668,7 @@ void CFG_SetButtonRepeatPressTime(int value) { } } -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS void CFG_SetLFS_Size(uint32_t value) { if(g_cfg.LFS_Size != value) { g_cfg.LFS_Size = value; diff --git a/src/new_cfg.h b/src/new_cfg.h index c5e243693..80c103012 100644 --- a/src/new_cfg.h +++ b/src/new_cfg.h @@ -89,11 +89,10 @@ void CFG_SetButtonLongPressTime(int value); void CFG_SetButtonShortPressTime(int value); void CFG_SetButtonRepeatPressTime(int value); -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS void CFG_SetLFS_Size(uint32_t value); uint32_t CFG_GetLFS_Size(); -#endif - #endif +#endif diff --git a/src/obk_config.h b/src/obk_config.h index 43cfe1e72..c9dae81d7 100644 --- a/src/obk_config.h +++ b/src/obk_config.h @@ -65,6 +65,7 @@ #elif PLATFORM_BEKEN +// set to 0 to disable #define ENABLE_LITTLEFS 1 #define ENABLE_NTP 1 #define ENABLE_DRIVER_LED 1 diff --git a/src/user_main.c b/src/user_main.c index b0db811db..1a2015be1 100644 --- a/src/user_main.c +++ b/src/user_main.c @@ -30,7 +30,7 @@ #include "mqtt/new_mqtt.h" #include "ota/ota.h" -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS #include "littlefs/our_lfs.h" #endif @@ -887,7 +887,7 @@ void Main_Init_BeforeDelay_Unsafe(bool bAutoRunScripts) { PIN_AddCommands(); ADDLOGF_DEBUG("Initialised pins\r\n"); -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS // initialise the filesystem, only if present. // don't create if it does not mount // do this for ST mode only, as it may be something in FS which is killing us, @@ -1063,7 +1063,7 @@ void Main_Init_Before_Delay() } CFG_InitAndLoad(); -#ifdef ENABLE_LITTLEFS +#if ENABLE_LITTLEFS LFSAddCmds(); #endif