I've been knocking together an IoT device using Espruino and came across an issue whilst testing in the centre of London. Where I am sat, wifi.scan() is returning around 30 access points which is eating up approximately 26% of the 1700 js variables I have available on the ESP8266.
Obviously the memory used will vary based on location and therefore is a pretty serious point of failure in my project.
Can I suggest an additional feature to limit the number of returned access points (i.e. Wifi.scan(callback, limit)) such that the first 0-limit elements are added to RAM?
Thanks for your help in advance.
Note: I've raised this as an issue here .
Hi I can't replicate this. I have 34 APs available in my location. Following a reset() and wifi.scan() , process.memory().free reports 1649 jsvars.
Maybe the issue is what you are doing with the data post-scan? Can you provide more info on what your code is doing?
Thanks for taking a look at this Ollie.
I've had the same results doing as you've done. I believe the garbage collector is admirably quick. My code is separated in such a way its not easy to copy and paste here.
Effectively I'm trying to scan for available networks then iterate over them to see if I have an associtated ssid-password pair stored in eeprom. Then with those available, attempt to connect.
I'm trying an approach which limits the scope (therefore lifetime) of the larger lists as well as exploring compiling the Espruino binaries as per https://github.com/espruino/Espruino/blob/master/README_Building.md#for-esp8266
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem