I'm working on a project with Espruino on ESP8266 (I'm going to have like 7 of them - these are pingpong light controllers; I finally got back into that one. This is for importing/exporting patterns), where data is stored on an EEPROM.
I need some way to receive data via url parameter, then convert that into a Uint8 array or something else I can write to the EEPROM. The size of the data is 128 bytes.
My original plan was to use JSON.stringify and base64 encode that, then send that to the Esp8266-running-Espruino as a parameter. Then it would base64 decode it, eval it, and write it, eg eeprom.write(offset,eval(atob(data))) where data is the base64-encoded data. But this is where the wheels fall off - I don't have enough memory to eval it, because of how much space the array takes up. Even if i were to preface the data with 'new Uint8Array', it would still choke on making the intermediary array.
Am I forgetting about some more memory efficient way to get data into Espruino from an http request?
Is there a more efficient format I could use to store/send it?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I'm working on a project with Espruino on ESP8266 (I'm going to have like 7 of them - these are pingpong light controllers; I finally got back into that one. This is for importing/exporting patterns), where data is stored on an EEPROM.
I need some way to receive data via url parameter, then convert that into a Uint8 array or something else I can write to the EEPROM. The size of the data is 128 bytes.
My original plan was to use JSON.stringify and base64 encode that, then send that to the Esp8266-running-Espruino as a parameter. Then it would base64 decode it, eval it, and write it, eg eeprom.write(offset,eval(atob(data))) where data is the base64-encoded data. But this is where the wheels fall off - I don't have enough memory to eval it, because of how much space the array takes up. Even if i were to preface the data with 'new Uint8Array', it would still choke on making the intermediary array.
Am I forgetting about some more memory efficient way to get data into Espruino from an http request?
Is there a more efficient format I could use to store/send it?