Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP8266 - Wifi.scan() causing "Out of Memory" error. #1131

Closed
chrisgwgreen opened this issue Apr 7, 2017 · 3 comments
Closed

ESP8266 - Wifi.scan() causing "Out of Memory" error. #1131

chrisgwgreen opened this issue Apr 7, 2017 · 3 comments
Labels
ESP8266 This is only a problem on ESP8266 devices

Comments

@chrisgwgreen
Copy link

Hi all,

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.

Chris

@wilberforce
Copy link
Member

Do you know if you are running out of heap or out of jsvars?

The scan code allocates 32 slots on the heap and fills those. So if it isn't heap that is running out, this would need to be changed

@gfwilliams gfwilliams added the ESP8266 This is only a problem on ESP8266 devices label May 5, 2017
@MaBecker
Copy link
Contributor

Hi @chrisgwgreen,

there is no way to tell the api call to limit the result for a search.

Check this ESP8266 SDK API Guide abstract:

Function:  
    Scan all available APs
Note:  
    Do not call this API in user_init. This API need to be called after system initializes and the ESP8266 station mode is enabled.
Prototype: 
    bool wifi_station_scan (struct scan_config *config, scan_done_cb_t cb);
Structure:  
    struct scan_config { 
    uint8 *ssid;
    uint8 *bssid;
    uint8 channel;
    uint8 show_hidden; //scan APs of which ssid is hidden. 
};

So this can be closed - what do you think?

@MaBecker
Copy link
Contributor

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ESP8266 This is only a problem on ESP8266 devices
Projects
None yet
Development

No branches or pull requests

4 participants