Handle checkboxes on webserver
This commit is contained in:
parent
689ef10922
commit
017aef74f6
13
main.lua
13
main.lua
@ -126,8 +126,7 @@ function normalOperation()
|
|||||||
mydofile("telnet")
|
mydofile("telnet")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- start the webserver module
|
print("webserver prepared")
|
||||||
mydofile("webserver")
|
|
||||||
end
|
end
|
||||||
setupCounter=setupCounter-1
|
setupCounter=setupCounter-1
|
||||||
elseif (setupCounter > 2) then
|
elseif (setupCounter > 2) then
|
||||||
@ -235,12 +234,20 @@ btntimer:register(500, tmr.ALARM_AUTO, function (t)
|
|||||||
mlt:unregister()
|
mlt:unregister()
|
||||||
print("Button pressed " .. tostring(btnCounter))
|
print("Button pressed " .. tostring(btnCounter))
|
||||||
btnCounter = btnCounter + 5
|
btnCounter = btnCounter + 5
|
||||||
for i=1,btnCounter do rgbBuffer:set(i, 0, 128, 0) end
|
|
||||||
|
if ((web ~= nil) and (btnCounter < 50)) then
|
||||||
|
for i=1,btnCounter do rgbBuffer:set(i, 128, 0, 0) end
|
||||||
|
else
|
||||||
|
for i=1,btnCounter do rgbBuffer:set(i, 0, 128, 0) end
|
||||||
|
end
|
||||||
ws2812.write(rgbBuffer)
|
ws2812.write(rgbBuffer)
|
||||||
if (btnCounter >= 110) then
|
if (btnCounter >= 110) then
|
||||||
file.remove("config.lua")
|
file.remove("config.lua")
|
||||||
file.remove("config.lc")
|
file.remove("config.lc")
|
||||||
node.restart()
|
node.restart()
|
||||||
|
elseif (btnCounter == 10) then
|
||||||
|
-- start the webserver module
|
||||||
|
mydofile("webserver")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
@ -52,7 +52,8 @@ Please note that all settings are mandatory<br /><br />
|
|||||||
<tr><th>Foreground Color Minute2</th><td><input type="color" name="mcolor2" value="$HEXCOLORFG"></td><td>LED Color for first single minute</td></tr>
|
<tr><th>Foreground Color Minute2</th><td><input type="color" name="mcolor2" value="$HEXCOLORFG"></td><td>LED Color for first single minute</td></tr>
|
||||||
<tr><th>Foreground Color Minute3</th><td><input type="color" name="mcolor3" value="$HEXCOLORFG"></td><td>LED Color for first single minute</td></tr>
|
<tr><th>Foreground Color Minute3</th><td><input type="color" name="mcolor3" value="$HEXCOLORFG"></td><td>LED Color for first single minute</td></tr>
|
||||||
<tr><th>Foreground Color Minute4</th><td><input type="color" name="mcolor4" value="$HEXCOLORFG"></td><td>LED Color for first single minute</td></tr>
|
<tr><th>Foreground Color Minute4</th><td><input type="color" name="mcolor4" value="$HEXCOLORFG"></td><td>LED Color for first single minute</td></tr>
|
||||||
<tr><th>Threequarter</th><td><input type="checkbox" name="threequarter"></td><td>3/4 instead of 1/4 before</td></tr>
|
<tr><th>Threequarter</th><td><input type="checkbox" name="threequarter" $THREEQUATER></td><td>3/4 instead of 1/4 before</td></tr>
|
||||||
|
<tr><th>Adjust brightness</th><td><input type="checkbox" name="dim" $AUTODIM></td><td>Dim brightness automatically</td></tr>
|
||||||
<tr><th>Webserver</th><td><input type="checkbox" name="web"></td><td>Activate Webserver</td></tr>
|
<tr><th>Webserver</th><td><input type="checkbox" name="web"></td><td>Activate Webserver</td></tr>
|
||||||
<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>
|
<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>
|
||||||
<tr><td colspan="3"><div align="center"><input type="submit" name="action" value="Reboot"></div></td></tr>
|
<tr><td colspan="3"><div align="center"><input type="submit" name="action" value="Reboot"></div></td></tr>
|
||||||
|
@ -165,7 +165,7 @@ function startWebServer()
|
|||||||
sec, _ = rtctime.get()
|
sec, _ = rtctime.get()
|
||||||
file.open(configFile.. ".new", "w+")
|
file.open(configFile.. ".new", "w+")
|
||||||
file.write("-- Config\n" .. "station_cfg={}\nstation_cfg.ssid=\"" .. _POST.ssid .. "\"\nstation_cfg.pwd=\"" .. _POST.password .. "\"\nstation_cfg.save=false\nwifi.sta.config(station_cfg)\n")
|
file.write("-- Config\n" .. "station_cfg={}\nstation_cfg.ssid=\"" .. _POST.ssid .. "\"\nstation_cfg.pwd=\"" .. _POST.password .. "\"\nstation_cfg.save=false\nwifi.sta.config(station_cfg)\n")
|
||||||
file.write("sntpserverhostname=\"" .. _POST.sntpserver .. "\"\n" .. "timezoneoffset=\"" .. _POST.timezoneoffset .. "\"\n".. "inv46=\"" .. tostring(_POST.inv46) .. "\"\n" .. "dim=\"" .. tostring(_POST.dim) .. "\"\n")
|
file.write("sntpserverhostname=\"" .. _POST.sntpserver .. "\"\n" .. "timezoneoffset=\"" .. _POST.timezoneoffset .. "\"\n".. "inv46=" .. tostring(_POST.inv46) .. "\n" .. "dim=" .. tostring(_POST.dim) .. "\n")
|
||||||
|
|
||||||
if ( _POST.fcolor ~= nil) then
|
if ( _POST.fcolor ~= nil) then
|
||||||
-- color=string.char(_POST.green, _POST.red, _POST.blue)
|
-- color=string.char(_POST.green, _POST.red, _POST.blue)
|
||||||
|
Loading…
Reference in New Issue
Block a user