From 1c0b5883b97ef35d737f69c4617fd215ad45ef3c Mon Sep 17 00:00:00 2001 From: ollo Date: Sun, 19 Jun 2016 00:50:18 +0200 Subject: [PATCH] Work more with even less memory! what a terrible world :-/ --- displayword.lua | 1 + webserver.lua | 3 ++- wordclock.lua | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/displayword.lua b/displayword.lua index 6871486..1ab0e1a 100644 --- a/displayword.lua +++ b/displayword.lua @@ -151,5 +151,6 @@ function generateLEDs(words, color) else buf= buf .. white:rep(1) end + collectgarbage() return buf end diff --git a/webserver.lua b/webserver.lua index 6962431..e379a2a 100644 --- a/webserver.lua +++ b/webserver.lua @@ -15,7 +15,7 @@ function sendWebPage(conn,answertype) timezoneoffset=1 end buf="HTTP/1.1 200 OK\nServer: NodeMCU\nContent-Type: text/html\n\n" - if (node.heap() < 10000) then + if (node.heap() < 8000) then buf = buf .. "

Busy, please come later again

" else buf = buf .. "" @@ -73,6 +73,7 @@ function startWebServer() file.close() file.remove(configFile) if (file.rename(configFile .. ".new", configFile)) then + dofile(configFile) -- load the new values sendWebPage(conn,2) -- success else sendWebPage(conn,3) -- error diff --git a/wordclock.lua b/wordclock.lua index 20f400a..72f5d22 100755 --- a/wordclock.lua +++ b/wordclock.lua @@ -123,6 +123,6 @@ function display_timestat(hours, minutes, longmode) elseif (hours == 12) then ret.twelve=1 end - + collectgarbage() return ret end