Open lpatiny opened 2 years ago
Be inspired : https://github.com/Hackuarium/bioreactor-platformio/blob/master/BioMain/include/hack/SSTLogger.cpp
https://esp32.com/viewtopic.php?t=18164
We don't want to create a file !!!
We can use NVS instead of SPIFFS:
First step, implement this code in ChibiOS.
No it is much more low level that this. We should I think use: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/spi_flash.html#flash-partition-apis
We should use directly the instructions read, write, erase
Interestingly erase range is super similar to the flash we use in the bioreactor: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/spi_flash.html#_CPPv418esp_partition_readPK15esp_partition_t6size_tPv6size_t
So I think copying the code of the logger and replace the corresponding instructions by those read, write and erase should work.
Please take care to setup a partition that is exactly 1024 * 1024 bytes for the logging system.
Preferences.h is the native solution in Platformio, from Spressif page:
"The Preferences library is unique to arduino-esp32. It should be considered as the replacement for the Arduino EEPROM library."
https://docs.espressif.com/projects/arduino-esp32/en/latest/api/preferences.html#
I will use this library for migration if you are agree.
We should really create our own partition scheme and directly access the memory like we do with the SST memory.
We should create a custom partition:
We would like to directly write to the partition because it is faster and more compact. Will will also looks very similar to : https://github.com/Hackuarium/bioreactor-platformio/blob/master/BioMain/include/hack/SSTLogger.cpp
We have a branch for Logger in the project: Logger
We can try to use this version of Logger in Logger branch to check if everything runs well:
I will use the esp32-c3 that you bring me in November!
Create a big binary file (1024 * 1024) on the spiffs partition
Try to have random access and create a logger
https://www.mischianti.org/2020/06/04/esp32-integrated-spiffs-filesystem-part-2/