rdancer / Color_LCD

0 stars 0 forks source link

Keep data on power loss #4

Open rdancer opened 3 years ago

rdancer commented 3 years ago

Data is only saved when we initiate a controlled shutdown.

Cutting off power, e.g. BMS undervoltage event, means irrecoverable data loss. This can be days or even weeks worth of data.

This is perhaps the most annoying bug this software has. Do not lose user data. How hard is it?

  1. Save config values immediately
  2. Save screen layout config immediately
  3. Save telemetry in NVRAM
  4. Save to flash periodically
  5. Back up data, in case of corruption restore from backup
  6. Detect battery unplug (sudden voltage drop), and save to flash / NVRAM with our dying breath
rdancer commented 3 years ago

Upstream issue https://github.com/OpenSourceEBike/Color_LCD/issues/66

rdancer commented 2 years ago

Problem is, flash can only take so many writes before failure, and it’s tiny so wear-levelling doesn’t do much.