[SOLVED]wifi.sta.getap() memory usage
Posted: Wed Apr 15, 2015 11:12 pm
UPDATE: Problem fixed, pull request was submitted and merged to the dev096 branch on 05/07/15.
Hello,
first and foremost I must say that i'm new to lua, and have taken to learning by coding, reading other lua scripts and-+ lua documentation and I believe i've got the gist of it but do to my n00bness there's a few things i don't quite know yet like how to figure out where all my memory is going.
I am currently using this firmware: nodemcu_float_0.9.6-dev_20150406.bin
my goal is to use wifi.sta.getap() to get info (SSID, RSSI, BSSID) about an AP hosted by another esp8266 module (also running same firmware) to use in my program and acquire this info while using the least amount of memory(heap).
For the most part I've achieved my goal but there's about 2k of heap I cant get back after I run wifi.sta.getap() and I don't know if it's my inexperience with LUA or if it is the wifi.sat.getap() function
init.lua
CheckAP.lua
After the ESP8266 starts node.heap() reports 20256 bytes free
then after I execute dofile("CheckAP.lua") node.heap() reports 17992 free.
I just can't figure this out, any help would be greatly appreciated.
Hello,
first and foremost I must say that i'm new to lua, and have taken to learning by coding, reading other lua scripts and-+ lua documentation and I believe i've got the gist of it but do to my n00bness there's a few things i don't quite know yet like how to figure out where all my memory is going.
I am currently using this firmware: nodemcu_float_0.9.6-dev_20150406.bin
my goal is to use wifi.sta.getap() to get info (SSID, RSSI, BSSID) about an AP hosted by another esp8266 module (also running same firmware) to use in my program and acquire this info while using the least amount of memory(heap).
For the most part I've achieved my goal but there's about 2k of heap I cant get back after I run wifi.sta.getap() and I don't know if it's my inexperience with LUA or if it is the wifi.sat.getap() function
init.lua
Code: Select all
uart.setup(0,115200,8,0,1,1)
print("Ready!")
CheckAP.lua
Code: Select all
function listap(t)
if type(t)~="table" then
print("not table")
return
end
for key,value in pairs(t) do
ssid = key
enc, rssi, bssid, chan = string.match(value,
"(%d),(-?%d+),(%x%x:%x%x:%x%x:%x%x:%x%x:%x%x),(%d+)")
print(ssid..":\t\t"..bssid..","..rssi.."\n")
ssid=nil enc=nil rssi=nil bssid=nil chan=nil
end
end
wifi.setmode(wifi.STATION)
wifi.sta.getap(listap)
listap=nil
After the ESP8266 starts node.heap() reports 20256 bytes free
then after I execute dofile("CheckAP.lua") node.heap() reports 17992 free.
I just can't figure this out, any help would be greatly appreciated.