Flash/persistent storage?

Do we currently have a way to store data in EEPROM or some other flash storage?

It’d be great to have a way to have the Core resume where it left off after a disconnect by reloading the last arguments passed via REST, rather than resetting to your program’s default variable values.

@twalsh, Please see this post by Zach :slight_smile:

2 Likes

Hmm… I tried using the sFLASH_WriteBuffer and sFLASH_ReadBuffer functions the way Zach mentioned, but this just results in my Core becoming unresponsive to reprogramming and REST commands. To recover, I actually have to do a full factory reset.

Need to do a little more debugging/digging into it, but I found that to be a little weird.

Thanks for pointing me to that, though!

In order to help show what I’m doing/what my issue is, I’ve attached a link to my program below. It’s not anything particularly useful, I mainly wrote it to give me a simple way to get familiar with setting up cloud-controlled functions and a few other little features of the Core.

All my example does is allow me to control the RGB LED via REST command. The network I’m currently on is a little unreliable, so when the connection is dropped, and the Core restarts, it puts the LED back to the default setting, when I’d like it to revert to what it was before the restart.

test_code text file

@twalsh You probably need to erase the flash sector before writing to it as described lower down in that thread:

Ah, I’d missed that. Yeah, after adding that in, (and adding a 10 ms delay between each flash operation, not sure if that’s needed but it’s the only way I got my code working), things seem ok, though the Core locks up on the first REST command received after being powered up.

A reset quickly gets it back online, though, and it works as expected from there on out.

1 Like