Retained Variables may get reset on firmware update

This one caught me out, but its clear why if you think about it for a moment. If the new firmware has the same variables in the same order as the previous firmware, it looks like retained variables survive the firmware update. Altering the variables results in re-initialisation of retained variables, as everything has moved about in memory.

It would be nice if we could specify RAM addresses for retained variables, so they (might) survive a firmware update. EEPROM is an alternative, but not for something that gets rewritten constantly. And since System.updatesPending() isn’t working properly at this time, there’s no way to store vars in EEPROM just before an update.

Worth noting in the documentation.

I recall someone reporting issues with this recently; not sure if it’s you.

I used it in a recent project to shut down the lights and motor if there is a firmware update and it worked fine.

Can you elaborate more on the issue you are facing?

1 Like

Check this thread:

1 Like