jlab-sensing / soil-power-sensor-firmware

Firmware for STM32 and ESP32 microcontrollers on the Soil Power Sensor board
MIT License
0 stars 3 forks source link

Recover data on fram buffer after reset #69

Open jmadden173 opened 2 months ago

jmadden173 commented 2 months ago

Describe the Enhancement Currently the fram is "cleared" between reset of the stm32 since the read/write addresses are stored in memory. By storing the addresses on the nvm fram chip, we would be able to reload them on device startup. This would restore the current state of the buffer and the board could pick up where it left off.

Benefits Prevent less data loss during intermittent power

Possible Drawbacks Less data would be able to stored in the buffer More power usage from more I2C writes More wear on the fram chip

Additional Context The read and write addresses, and the buffer length are stored as uint16_t. That is a total of 6 bytes. I think that the benefits outweigh the downsides.