Dreiviertel can be activated or deactivated

This commit is contained in:
ollo 2016-06-19 23:09:43 +02:00
parent d166fb68df
commit 10fa0b67a6
3 changed files with 14 additions and 3 deletions

View File

@ -33,7 +33,12 @@ function generateLEDs(words, color)
-- line3----------------------------------------------
--TODO ggf. auch ueber viertel vor abbildbar
if (words.threequater == 1) then
buf= buf .. color:rep(11) -- Dreiviertel
if (threequater ~= nil) then
buf= buf .. color:rep(11) -- Dreiviertel
else
buf= buf .. white:rep(4)
buf= buf .. color:rep(7) -- VIERTEL
end
elseif (words.quater == 1) then
buf= buf .. white:rep(4)
buf= buf .. color:rep(7) -- VIERTEL
@ -41,7 +46,7 @@ function generateLEDs(words, color)
buf= buf .. white:rep(11)
end
--line 4-------- even row (so inverted) -------------
if (words.before == 1) then
if ((words.before == 1) or (words.threequater == 1 and threequater == nil)) then
buf=buf .. white:rep(2)
buf= buf .. color:rep(3) -- VOR
else

View File

@ -28,10 +28,11 @@ function sendWebPage(conn,answertype)
buf = buf .."<tr><th>WIFI-SSID</b></th><td><input name=\"ssid\" value=\"" .. ssid .. "\"></td><td /></tr>"
buf = buf .."<tr><th>WIFI-Password</th><td><input name=\"password\"></td><td /></tr>"
buf = buf .."<tr><th>SNTP Server</th><td><input name=\"sntpserver\" value=\"" .. sntpserverhostname .. "\"></td><td>ntp server to sync the time</tr>"
buf = buf .."<tr><th>Offset to UTC time</th><td><input name=\"timezoneoffset\" value=\"" .. timezoneoffset .. "\"></td><td>Define the offset to UTC time in hours. E.g +1</tr>"
buf = buf .."<tr><th>Offset to UTC time</th><td><input type=\"number\" name=\"timezoneoffset\" value=\"" .. timezoneoffset .. "\"></td><td>Define the offset to UTC time in hours. E.g +1</tr>"
buf = buf .."<tr><th>Red</th><td><input type=\"number\" name=\"red\" value=\"" .. string.byte(color,1) .. "\"></td><td /></tr>"
buf = buf .."<tr><th>Green</th><td><input type=\"number\" name=\"green\" value=\"" .. string.byte(color,2) .. "\"></td><td /></tr>"
buf = buf .."<tr><th>Blue</th><td><input type=\"number\" name=\"blue\" value=\"" .. string.byte(color,3) .. "\"></td><td>All Colors: 0 - 255</td></tr>"
buf = buf .."<tr><th>Three quater</th><td><input type=\"checkbox\" name=\"threequater\" ".. (threequater and "checked" or "") .. "></td><td>Dreiviertel Joa/nei</td></tr>"
buf = buf .. "<tr><td colspan=\"3\"><div align=\"center\"><input type=\"submit\" value=\"Save Configuration\" onclick=\"this.value='Submitting ..';this.disabled='disabled'; this.form.submit();\"></div></td></tr>"
buf = buf .. "<tr><td colspan=\"3\"><div align=\"center\"><input type=\"submit\" name=\"action\" value=\"Reboot\"></div></td></tr>"
buf = buf .."</table></form>"

View File

@ -75,6 +75,11 @@ function startWebServer()
color=string.char(_POST.red, _POST.green, _POST.blue)
end
file.write("color=string.char(" .. string.byte(color,1) .. "," .. string.byte(color, 2) .. "," .. string.byte(color, 3) .. ")\n print(\"Config from " .. sec .. "\")\n")
if (_POST.threequater ~= nil) then
file.write("threequater=true\n")
else
file.write("threequater=nil\n") -- unset threequater
end
file.close()
sec=nil
file.remove(configFile)