Chat freely about anything...

User avatar
By mianos
#38725 It depends on what you mean by store data.
If you have arbitrary static data I have a framework that can store strings into flash at compile time and access them byte-wise at runtime (as the quad spi flash only reads at word boundaries). For example, website static pages. I store all my python modules like this.

To dynamically store data, I have a low level API that can access the flash ram in page sizes but I am kind of stuck on the best way to determine, dynamically where I can legally start and end. Once I get that I was planning to write a python wrapper around that API. The mainn reason I have not gone further with this is, I would rather store and get data from the web using wifi. That has lead me to writing a simple web server in C and wrapping that at a much higher level in python. Because my port is very thread like I am going to have any API something like this:
Code: Select allimport esp, ujson

def handle(body, rtype, headers):
   data = json.loads(body)
   set_relay(True if data['value'] == 'On' else False)

ws = esp.listen(port=80, callback=handle)


If anyone has a nice definitive way to determine the exact legal use writeable flash area I'll put it in right away.
Personally, I don't have much use for saving flash so far, as I have implemented a wrapper around the SDK easyconfig so the SDK code saves the access point and password at a lower level. As it is trivial to POST, I store my sensor data on the web (in a flask app if anyone wants that too).