OpenSourceEBike / TSDZ2_wireless

TSDZ2_wireless
35 stars 11 forks source link

fds flash bug fix #98

Closed rananna closed 3 years ago

rananna commented 3 years ago

@casinho,

On the weekend I started to have very strange flash write issues, where it would take two attempts to write to flash before the value would change. No errors were reported by the FDS module. After many frustrating hours trying to figure out why this is happening, I had the idea that flash was full, but not reporting properly the full state. So I looked at how we are cleaning up flash after writing, and it turns out we are not doing this at all. So I added fds_gc() after the write update in eeprom.c, and all the problems went away! It is working well as it did before the problem happened. See: https://devzone.nordicsemi.com/f/nordic-q-a/25923/fds-gc-seems-not-to-work "Running Garbage collection after fds_record_update() will delete the 'old' copy of the record, if it succeeds."

I must have collected over the last many months enough garbage in the flash to be an issue. NOTE: I DID NOT CORRECT THIS IN THE WIRELESS CONTROLLER MODULE. PLEASE REVIEW AND ADD THIS TO THE CODE IF YOU AGREE.

casainho commented 3 years ago

Please make a PR with that improvement to the other firmware.