29 LOGI(
"Initializing SPIFFS");
32 .partition_label = NULL,
39 esp_err_t ret = esp_vfs_spiffs_register(&
conf);
42 if (ret == ESP_FAIL) {
43 LOGE(
"Failed to mount or format filesystem");
44 }
else if (ret == ESP_ERR_NOT_FOUND) {
45 LOGE(
"Failed to find SPIFFS partition");
47 LOGE(
"Failed to initialize SPIFFS (%s)", esp_err_to_name(ret));
52 LOGI(
"Performing SPIFFS_check().");
53 ret = esp_spiffs_check(
conf.partition_label);
55 LOGE(
"SPIFFS_check() failed (%s)", esp_err_to_name(ret));
58 LOGI(
"SPIFFS_check() successful");
61 size_t total = 0, used = 0;
62 ret = esp_spiffs_info(
conf.partition_label, &total, &used);
64 LOGE(
"Failed to get SPIFFS partition information (%s). Formatting...",
65 esp_err_to_name(ret));
69 LOGI(
"Partition size: total: %d, used: %d", total, used);
75 "Number of used bytes cannot be larger than total. Performing "
77 ret = esp_spiffs_check(
conf.partition_label);
82 LOGE(
"SPIFFS_check() failed (%s)", esp_err_to_name(ret));
85 LOGI(
"SPIFFS_check() successful");
93 esp_vfs_spiffs_unregister(
conf.partition_label);
94 LOGI(
"SPIFFS unmounted");
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define LOGE(...)
Definition AudioLoggerIDF.h:30