Embedded Resources

Is it possible to store a string in the embedded resources of a device at runtime, so that when the device reboots it will remember the string and be able to use it on next boot.

I ask because I would prefer not to have to use an SD card for each device.
I feel the answer is no because then no-one would use SD cards unless they had a large amount of data to store.

Thank you

You could use a WeakReference like here:
https://www.ghielectronics.com/community/forum/topic?id=9536&page=2#msg94868
The name is a bit misleading, and I never used it my self.
But it stores a limited amount of data in the SoM Flash memory (which is persistent).

You also could use FlashModule for larger amount of data.
https://www.ghielectronics.com/catalog/product/389
I have one of these, but haven’t tested it so far.

1 Like

Thanks I’ll take a look at that.

Okay so I’ve had a play with the code now.
I put it on a Fez Spider and a Netduino Plus, it didn’t do what I expected it to do.

With the Spider the object would be saved but it only seemed to work correctly while the device had power. So stopping and starting the program in debug would increase the saved start-up number. However removing the power and powering it back up again would reset the memory.
The Netduino couldn’t seem to handle saving the start-up number at all.

I was looking for a method to save data upon power loss which I originally forgot to mention.

I don’t think either of my devices were designed for such a thing. I will see about getting a flash module instead maybe.

@ JPenny1993 - When you write to EWR, the data does not get stored immediately. Take a look at https://www.ghielectronics.com/community/forum/topic?id=6270&page=1#msg59985 for a hint on how to flush the data.

Check the GHI Premium documentation for the correct namespace and DLL for the current SDK.

1 Like

@ JPenny1993 - For Arduino you could use this:
https://www.ghielectronics.com/community/forum/topic?id=14309&page=1#msg145451

Used it for MedusaMini and works great.

@ Mike - Thanks Mike, flushing the data was exactly what I needed to do.

If anyone else is looking to do EWR, you need a reference to GHI.Premium.System;
and the method is GHI.Premium.System.Util.FlushExtendedWeakReferences();