so far i’m unable to reproduce the issue. if anybody else ran into this at some point - could you post as many details as you remember?
i’m also not seeing anything in the code itself. perhaps other developers could take a look and see anything i’m missing in the following analysis?
here is what we know:
- this happened with the official 3.0 release with the default scenes included
- at some point (after several power cycles) all scenes are blanked out.
this implies that at some point flash was written to. f is local to flash.c so the only way it could’ve been done would be through the functions exposed in flash.c. i’ve looked at all of the places where these functions are called.
1st possibility: flash_prepare gets called each time a module is powered, and if f.fresh is not 0x22 it will blank out all of the scenes. the only way for this to happen should be flashing tt with a non release firmware (the official release would already have it set to 0x22, otherwise the default scenes would also get overwritten on the 1st power up, which we know didn’t happen). flash_prepare is not called anywhere else.
2nd possibility: f.fresh somehow gets overwritten when something else gets updated (last mode being the primary candidate as it gets updated whenever a user navigates to a different page). i’ve double checked all of the places where flash is written to and all flashc_memcpy calls are done with proper sizeof. also if this was the case then we would see this happening a lot more. i’ve also tried saving from every mode to see if i can reproduce - no luck.
3rd possibility: something calls fresh_write (which writes an individual scene) with a blank scene looping over all available scene slots. the only place other than flash_prepare that does this is when it reads from USB - but it only does it if it finds a valid scene file. you would have to use a USB stick with files specifically named for reading for each scene for this to happen - not very likely.
flash_prepare seems to be the most likely candidate, which means it’s back to f.fresh getting corrupted somehow. but i don’t see how it could possibly get overwritten - it only gets updated in flash_prepare. so it would be either it getting corrupted by itself at some point or getting overwritten when something else is updated. could there be some tricky possible issues due to using flashc_memcpy with structures? padding not being accounted for somehow? but sizeof would take that into account…