25 lines
703 B
C
25 lines
703 B
C
#include "esp_log.h"
|
|
#include "esp_spiffs.h"
|
|
|
|
static const char *TAG = "FS_INIT";
|
|
|
|
void fs_init(void)
|
|
{
|
|
esp_vfs_spiffs_conf_t conf = {
|
|
.base_path = "/spiffs", // mount point
|
|
.partition_label = "spiffs", // must match name in partitions.csv
|
|
.max_files = 4,
|
|
.format_if_mount_failed = true,
|
|
};
|
|
|
|
esp_err_t ret = esp_vfs_spiffs_register(&conf);
|
|
|
|
if (ret != ESP_OK) {
|
|
ESP_LOGE(TAG, "Failed to mount SPIFFS (%s)", esp_err_to_name(ret));
|
|
} else {
|
|
size_t total = 0, used = 0;
|
|
esp_spiffs_info(conf.partition_label, &total, &used);
|
|
ESP_LOGI(TAG, "SPIFFS mounted. Total=%u, Used=%u", (unsigned)total, (unsigned)used);
|
|
}
|
|
}
|