Replies: 4 comments 13 replies
-
|
Interesting question. I considered persisting values to flash early on, which you can still see in the note about preferences here. In the Moddable SDK, preferences are small pieces of data that persist across runs. In Node-RED MCU Edition, the file system node is supported, so that does provide an option for storing state. However, as you note, in Node-RED that isn't the usual way to manage the state of flows, but that is usually done with a file based Context Stores. Node-RED MCU Edition does support in-memory Context Stores. I did a quick review of the Node-RED Editor's Context Stores support. At first glance, it looks possible. Creating a new Context Store type seems unnecessary. We could just re-interpret the The current implementation of [Context](class Context) on MCUs is a light subclass of
I have a couple of concerns, mostly because of my limited Node-RED experience:
|
Beta Was this translation helpful? Give feedback.
-
|
I had a chance to try your file system flow. It is interesting. You have one node writing and another reading the same file. The Node-RED File node is defined to keep the write file open (for performance reasons). That was getting in the way of the read having access to the data written. I made a small patch to the Moddable SDK's LittleFS support and your flow works. Can you give that a try too? The change is after these lines to add a call to sync: I don't think this fix is optimal (flushing on every write is unnecessary expensive), so I don't want to commit it as-is. |
Beta Was this translation helpful? Give feedback.
-
|
Ah, bummer. I just opened a new discussion. Anyway thanks for looking into it. Will test it. |
Beta Was this translation helpful? Give feedback.
-
|
Support for File Context Stores is now in place. The backing store is the Preferences module. See the readme for details. The implementation is fresh so there are likely still some rough edges, though it is working nicely across microcontroller families and the simulator. Because Node-RED doesn't include the default context store in the exported flow, the implementation assumes that the default Context Store is in-memory. |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to write values to the flash from within Node-Red? Something like the Context Stores in Node-Red?
"Just" extending the context stores by a flash option would be really cool, e.g.
Beta Was this translation helpful? Give feedback.
All reactions