free size handling
This commit is contained in:
parent
fb0ad6b1dc
commit
e43538ec8a
@ -125,9 +125,11 @@ fn main() -> Result<()> {
|
|||||||
// if no wifi, set general fault persistent
|
// if no wifi, set general fault persistent
|
||||||
//if no mqtt, set general fault persistent
|
//if no mqtt, set general fault persistent
|
||||||
|
|
||||||
|
let mut total_size = 0;
|
||||||
|
let mut used_size = 0;
|
||||||
unsafe {
|
unsafe {
|
||||||
let base_path = CString::new("/spiffs").unwrap();
|
let base_path = CString::new("/spiffs")?;
|
||||||
let storage = CString::new("storage").unwrap();
|
let storage = CString::new("storage")?;
|
||||||
|
|
||||||
let conf = esp_idf_sys::esp_vfs_spiffs_conf_t {
|
let conf = esp_idf_sys::esp_vfs_spiffs_conf_t {
|
||||||
base_path: base_path.as_ptr(),
|
base_path: base_path.as_ptr(),
|
||||||
@ -135,10 +137,11 @@ fn main() -> Result<()> {
|
|||||||
max_files: 5,
|
max_files: 5,
|
||||||
format_if_mount_failed: true,
|
format_if_mount_failed: true,
|
||||||
};
|
};
|
||||||
|
esp_idf_sys::esp!(esp_idf_sys::esp_vfs_spiffs_register(&conf))?;
|
||||||
|
|
||||||
let mount = esp_idf_sys::esp_vfs_spiffs_register(&conf);
|
esp_idf_sys::esp!(esp_idf_sys::esp_spiffs_info(storage.as_ptr(),&mut total_size,&mut used_size))?;
|
||||||
println!("Mount returned {}", mount);
|
|
||||||
}
|
}
|
||||||
|
println!("Total spiffs size is {}, used size is {}", total_size, used_size);
|
||||||
println!("writing");
|
println!("writing");
|
||||||
let mut config_file = File::create("/spiffs/config.cfg")?;
|
let mut config_file = File::create("/spiffs/config.cfg")?;
|
||||||
config_file.write_all("test stuff".as_bytes())?;
|
config_file.write_all("test stuff".as_bytes())?;
|
||||||
|
Loading…
Reference in New Issue
Block a user