Page 1 of 1

SPIFFS clarification please

Posted: Tue Mar 16, 2021 5:08 am
by orbitcoms
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");

Re: SPIFFS clarification please

Posted: Wed Mar 17, 2021 10:51 pm
by PeterR
I suspect that a little seeding on your part would be quicker than any one else unraveling your question.
You can fstat a partition and so work out how your config relates to the FS etc.
Or just a whole set of fopens working through the possible paths strings and printing the return code.....

Re: SPIFFS clarification please

Posted: Wed Mar 17, 2021 10:54 pm
by orbitcoms
Sorry, I have no idea what you are talking about