diff --git a/.gitignore b/.gitignore index 3682b7b..73490d0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ sdkconfig.old .project .settings .vscode +managed_components \ No newline at end of file diff --git a/components/protocols/CMakeLists.txt b/components/protocols/CMakeLists.txt index 747d5fd..66031ca 100644 --- a/components/protocols/CMakeLists.txt +++ b/components/protocols/CMakeLists.txt @@ -16,5 +16,5 @@ idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "include" PRIV_INCLUDE_DIRS "src" EMBED_FILES "${embed_files}" - PRIV_REQUIRES nvs_flash esp_http_server esp_wifi esp_timer esp_https_ota driver app_update json vfs spiffs mbedtls + PRIV_REQUIRES nvs_flash esp_http_server esp_wifi esp_timer esp_https_ota driver app_update json vfs littlefs mbedtls REQUIRES config network modbus script serial logger) diff --git a/components/protocols/src/http_dav.c b/components/protocols/src/http_dav.c index 8abd32a..4476d5a 100644 --- a/components/protocols/src/http_dav.c +++ b/components/protocols/src/http_dav.c @@ -7,14 +7,14 @@ #include #include "esp_log.h" #include "esp_vfs.h" -#include "esp_spiffs.h" +#include "esp_littlefs.h" #include "http_web.h" #include "http.h" #define DAV_BASE_PATH "/dav" #define DAV_BASE_PATH_LEN 4 -#define FILE_PATH_MAX (ESP_VFS_PATH_MAX + CONFIG_SPIFFS_OBJ_NAME_LEN) +#define FILE_PATH_MAX (ESP_VFS_PATH_MAX + CONFIG_LITTLEFS_OBJ_NAME_LEN) #define SCRATCH_BUFSIZE 1024 static const char* TAG = "http_dav"; @@ -77,10 +77,10 @@ static void propfind_response_directory(httpd_req_t* req, const char* path) size_t total = 0, used = 0; char str[16]; if (strcmp(path, "/cfg/") == 0) { - esp_spiffs_info("cfg", &total, &used); + esp_littlefs_info("cfg", &total, &used); } if (strcmp(path, "/data/") == 0) { - esp_spiffs_info("data", &total, &used); + esp_littlefs_info("data", &total, &used); } httpd_resp_send_chunk(req, "\n", HTTPD_RESP_USE_STRLEN); diff --git a/components/protocols/src/http_rest.c b/components/protocols/src/http_rest.c index 569a5a5..91906b1 100644 --- a/components/protocols/src/http_rest.c +++ b/components/protocols/src/http_rest.c @@ -21,7 +21,6 @@ #define REST_BASE_PATH "/api/v1" #define SCRATCH_BUFSIZE 1024 -#define FILE_PATH_MAX (ESP_VFS_PATH_MAX + CONFIG_SPIFFS_OBJ_NAME_LEN) #define MAX_JSON_SIZE (50*1024) // 50 KB #define MAX_JSON_SIZE_STR "50KB" #define OTA_VERSION_URL "https://dzurikmiroslav.github.io/esp32-evse/firmware/version.txt" diff --git a/dependencies.lock b/dependencies.lock new file mode 100644 index 0000000..c0da7c5 --- /dev/null +++ b/dependencies.lock @@ -0,0 +1,15 @@ +dependencies: + idf: + component_hash: null + source: + type: idf + version: 5.2.0 + joltwallet/littlefs: + component_hash: 075fcf1e09264b6ca651bd7c7957145e219ec6e61b5f6ed8f721922224041685 + source: + service_url: https://api.components.espressif.com/ + type: service + version: 1.5.5 +manifest_hash: 1b1169ee1e8134f0de14d0bed748f460840348a432e954b6b7fdaf02d59d8fa1 +target: esp32 +version: 1.0.0 diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index ad81b89..554bfa8 100755 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -6,7 +6,7 @@ register_component() if(CONFIG_BOARD_CONFIG_DEPLOY) set(CFG_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../cfg/${CONFIG_BOARD_CONFIG}") if(EXISTS ${CFG_SRC_DIR}/board.cfg) - spiffs_create_partition_image(cfg ${CFG_SRC_DIR} FLASH_IN_PROJECT) + littlefs_create_partition_image(cfg ${CFG_SRC_DIR} FLASH_IN_PROJECT) else() message(FATAL_ERROR "${CFG_SRC_DIR}/board.cfg doesn't exit") endif() diff --git a/main/idf_component.yml b/main/idf_component.yml new file mode 100644 index 0000000..4bc284d --- /dev/null +++ b/main/idf_component.yml @@ -0,0 +1,6 @@ +## IDF Component Manager Manifest File +dependencies: + joltwallet/littlefs: "==1.5.5" + ## Required IDF version + idf: + version: ">=5.2.0" \ No newline at end of file diff --git a/main/main.c b/main/main.c index 29419d7..527e2bc 100755 --- a/main/main.c +++ b/main/main.c @@ -10,7 +10,7 @@ #include "esp_err.h" #include "nvs_flash.h" #include "esp_event.h" -#include "esp_spiffs.h" +#include "esp_littlefs.h" #include "driver/gpio.h" #include "evse.h" @@ -137,10 +137,10 @@ static void button_init(void) ESP_ERROR_CHECK(gpio_isr_handler_add(board_config.button_wifi_gpio, button_isr_handler, NULL)); } -static void fs_info(esp_vfs_spiffs_conf_t* conf) +static void fs_info(esp_vfs_littlefs_conf_t* conf) { size_t total = 0, used = 0; - esp_err_t ret = esp_spiffs_info(conf->partition_label, &total, &used); + esp_err_t ret = esp_littlefs_info(conf->partition_label, &total, &used); if (ret != ESP_OK) { ESP_LOGE(TAG, "Failed to get partition %s information %s", conf->partition_label, esp_err_to_name(ret)); } else { @@ -150,21 +150,19 @@ static void fs_info(esp_vfs_spiffs_conf_t* conf) static void fs_init(void) { - esp_vfs_spiffs_conf_t cfg_conf = { + esp_vfs_littlefs_conf_t cfg_conf = { .base_path = "/cfg", .partition_label = "cfg", - .max_files = 1, .format_if_mount_failed = false }; - ESP_ERROR_CHECK(esp_vfs_spiffs_register(&cfg_conf)); + ESP_ERROR_CHECK(esp_vfs_littlefs_register(&cfg_conf)); - esp_vfs_spiffs_conf_t data_conf = { + esp_vfs_littlefs_conf_t data_conf = { .base_path = "/data", .partition_label = "data", - .max_files = 5, .format_if_mount_failed = true }; - ESP_ERROR_CHECK(esp_vfs_spiffs_register(&data_conf)); + ESP_ERROR_CHECK(esp_vfs_littlefs_register(&data_conf)); fs_info(&cfg_conf); fs_info(&data_conf); diff --git a/partitions.csv b/partitions.csv index e990f00..c6d9536 100644 --- a/partitions.csv +++ b/partitions.csv @@ -1,7 +1,7 @@ -# Name, Type, SubType, Offset, Size, Flags -nvs, data, nvs, 0x9000, 0x4000, -otadata, data, ota, , 0x2000, -app0, app, ota_0, , 1856K, -app1, app, ota_1, , 1856K, -cfg, data, spiffs, , 16K, -data, data, spiffs, , 304K, \ No newline at end of file +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x4000, +otadata, data, ota, , 0x2000, +app0, app, ota_0, , 1856K, +app1, app, ota_1, , 1856K, +cfg, data, littlefs, , 16K, +data, data, littlefs, , 304K, \ No newline at end of file