From 744c36b8b5c778a2e0b2493846ca24dbaa7b8137 Mon Sep 17 00:00:00 2001 From: Ollo Date: Thu, 11 Feb 2021 21:33:06 +0100 Subject: [PATCH] Dump memory usage on several places --- main.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.lua b/main.lua index 36aeec0..09c3644 100644 --- a/main.lua +++ b/main.lua @@ -46,7 +46,7 @@ function displayTime() end wc = nil collectgarbage() - print("Heap: " .. tostring(node.heap())) + print("wc: " .. tostring(node.heap())) mydofile("displayword") if (dw ~= nil) then --if lines 4 to 6 are inverted due to hardware-fuckup, unfuck it here @@ -58,6 +58,8 @@ function displayTime() ledBuf = dw.generateLEDs(words, colorBg, color, color1, color2, color3, color4, invertRows, c) end dw = nil + collectgarbage() + print("dw: " .. tostring(node.heap())) if (ledBuf ~= nil) then ws2812.write(ledBuf) else @@ -80,12 +82,12 @@ function normalOperation() -- Color is defined as GREEN, RED, BLUE color=string.char(0,0,250) end - print("Fg Color: " .. tostring(string.byte(color,1)) .. "x" .. tostring(string.byte(color,2)) .. "x" .. tostring(string.byte(color,3)) ) + print("start: " , node.heap()) local connect_counter=0 -- Wait to be connect to the WiFi access point. local wifitimer = tmr.create() - wifitimer:register(5000, tmr.ALARM_SINGLE, function (t) + wifitimer:register(2000, tmr.ALARM_SINGLE, function (t) connect_counter=connect_counter+1 if wifi.sta.status() ~= 5 then print(connect_counter .. "/60 Connecting to AP...") @@ -122,7 +124,7 @@ function normalOperation() end else t:unregister() - print('IP: ',wifi.sta.getip()) + print('IP: ',wifi.sta.getip(), " heap: ", node.heap()) -- Here the WLAN is found, and something is done mydofile("mqtt")