SPIFFS clarification please
Posted: Tue Mar 16, 2021 5:08 am
I am a bit confused about the spiffs base_paths and pointing to the different partitions using file functions.
Is the base path the actual path in your editor list where the files are kept and you set up and use like below?
Created 2 spiffs partitions
"log_recs" and "html_files"
I created 2 folders in my main editor for files like this
>main
>html_dir
>log_dir
Is the code below correct to configure and used both partitions? (Note I add spiffs_create_partition_image(html_dir ../ FLASH_IN_PROJECT)
#define log_file "log_recs/log.txt"
esp_vfs_spiffs_conf_t log_log_config = {
.base_path = "/log_dir",
.partition_label = "log_recs",
.max_files = 5,
.format_if_mount_failed = true,
};
esp_vfs_spiffs_register(&html_config);
//FILE * f = open(log_file,"w");
#define html_index "hmtl_files/index.html"
esp_vfs_spiffs_conf_t html_config = {
.base_path = "/spiffs/html_dir",
.partition_label = "html_files",
.max_files = 5,
.format_if_mount_failed = true};
esp_vfs_spiffs_register(&html_config);
FILE * f = open(html_index,"w");
esp_vfs_spiffs_unregister("html_files");
Is the base path the actual path in your editor list where the files are kept and you set up and use like below?
Created 2 spiffs partitions
"log_recs" and "html_files"
I created 2 folders in my main editor for files like this
>main
>html_dir
>log_dir
Is the code below correct to configure and used both partitions? (Note I add spiffs_create_partition_image(html_dir ../ FLASH_IN_PROJECT)
#define log_file "log_recs/log.txt"
esp_vfs_spiffs_conf_t log_log_config = {
.base_path = "/log_dir",
.partition_label = "log_recs",
.max_files = 5,
.format_if_mount_failed = true,
};
esp_vfs_spiffs_register(&html_config);
//FILE * f = open(log_file,"w");
#define html_index "hmtl_files/index.html"
esp_vfs_spiffs_conf_t html_config = {
.base_path = "/spiffs/html_dir",
.partition_label = "html_files",
.max_files = 5,
.format_if_mount_failed = true};
esp_vfs_spiffs_register(&html_config);
FILE * f = open(html_index,"w");
esp_vfs_spiffs_unregister("html_files");