diff --git a/index.html b/index.html
new file mode 100644
index 0000000..b2bb521
--- /dev/null
+++ b/index.html
@@ -0,0 +1,20 @@
+
+
WordClock Setup Page
+
+Welcome to the WordClock
+"
\ No newline at end of file
diff --git a/main.lua b/main.lua
index 81745e1..49d6c98 100644
--- a/main.lua
+++ b/main.lua
@@ -58,7 +58,8 @@ function displayTime()
color=color4
end
- ledBuf = generateLEDs(words, color)
+ ledBuf = generateLEDs(words, color, colorMode)
+
-- Write the buffer to the LEDs
ws2812.write(ledBuf)
diff --git a/webpage.lua b/webpage.lua
index e22b378..cf0fcba 100644
--- a/webpage.lua
+++ b/webpage.lua
@@ -34,14 +34,23 @@ function sendWebPage(conn,answertype)
local hexColor4 = "#" .. string.format("%02x",string.byte(color4,1)) .. string.format("%02x",string.byte(color4,2)) .. string.format("%02x",string.byte(color4,3))
+
+
+ local buf="HTTP/1.1 200 OK\nServer: NodeMCU\nContent-Type: text/html\n\n"
+ if (node.heap() < 8000) then
+ buf = buf .. "Busy, please come later again
"
+ endOfPage=true
+ else
+
-- hack for the second part of the page
buf=nil
if (answertype==10) then
- buf = "Color 1. Minute | | |
"
- buf = buf .."Color 2. Minute | | |
"
- buf = buf .."Color 3. Minute | | |
"
- buf = buf .."Color 4. Minute | | |
"
+ buf = "1. Minute Color | | |
"
+ buf = buf .."2. Minute Color | | |
"
+ buf = buf .."3. Minute Color | | |
"
+ buf = buf .."4. Minute Color | | |
"
buf = buf .."Three quater | | Dreiviertel Joa/nei |
"
+ --buf = buf .."ColorMode | | If checked, words are dark, rest is colored |
"
buf = buf .. " |
"
buf = buf .. " |
"
buf = buf ..""
@@ -52,12 +61,7 @@ function sendWebPage(conn,answertype)
endOfPage=true
return
end
-
- local buf="HTTP/1.1 200 OK\nServer: NodeMCU\nContent-Type: text/html\n\n"
- if (node.heap() < 8000) then
- buf = buf .. "Busy, please come later again
"
- else
buf = buf .. ""
buf = buf .. "WordClock Setup Page"
buf = buf .. "\n"
diff --git a/webserver.lua b/webserver.lua
index c899649..6211157 100644
--- a/webserver.lua
+++ b/webserver.lua
@@ -113,6 +113,11 @@ function startWebServer()
local blue = tonumber(string.sub(hexColor, 5, 6), 16)
file.write("color4=string.char(" .. green .. "," .. red .. "," .. blue .. ")\n")
end
+ if ( _POST.colorMode ~= nil) then
+ file.write("colorMode=true\n")
+ else
+ file.write("colorMode=nil\n") -- unset colorMode
+ end
time = getTime(sec, timezoneoffset)
file.write("color=string.char(" .. string.byte(color,1) .. "," .. string.byte(color, 2) .. "," .. string.byte(color, 3) .. ")\n")
file.write("print(\"Config from " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second .. "\")\n")