Added another parameter to set the background color of the clock
This commit is contained in:
parent
11bf35f22e
commit
fba6a90085
@ -47,11 +47,13 @@ Please note that all settings are mandatory<br /><br />
|
||||
<tr><th>WIFI-Password</th><td><input id="password" name="password"></td><td>Password of the wireless network</td></tr>
|
||||
<tr><th>SNTP Server</th><td><input id="sntpserver" name="sntpserver" value="$SNTPSERVER"></td><td>Server to sync the time with. Only one ntp server is allowed.</tr>
|
||||
<tr><th>Offset to UTC time</th><td><input id="timezoneoffset" name="timezoneoffset" value="$TIMEOFFSET"></td><td>Define the offset to UTC time in hours. For example +1 hour for Germany</tr>
|
||||
<tr><th>Color</th><td><input type="color" name="fcolor" value="$HEXCOLORFG"></td><td>LED Color for all minutes, divisible by five</td></tr>
|
||||
<tr><th>Foreground Color</th><td><input type="color" name="fcolor" value="$HEXCOLORFG"></td><td>LED Color for all minutes, divisible by five</td></tr>
|
||||
<tr><th>Background Color</th><td><input type="color" name="bcolor" value="$HEXCOLORBG"></td><td>Background LED Color</td></tr>
|
||||
<tr><th>1. Minute Color</th><td><input type="color" name="colorMin1" value="$HEXCOLOR1"></td><td>First minute after</td></tr>
|
||||
<tr><th>2. Minute Color</th><td><input type="color" name="colorMin2" value="$HEXCOLOR2"></td><td>Second minute after</td></tr>
|
||||
<tr><th>3. Minute Color</th><td><input type="color" name="colorMin3" value="$HEXCOLOR3"></td><td>Third minute after</td></tr>
|
||||
<tr><th>4. Minute Color</th><td><input type="color" name="colorMin4" value="$HEXCOLOR4"></td><td>Fourth minute after</td></tr>
|
||||
|
||||
<tr><th>Three quater</th><td><input type="checkbox" name="threequater" $THREEQUATER></td><td>Dreiviertel Joa/nei</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>
|
||||
|
@ -97,13 +97,15 @@ function fillDynamicMap()
|
||||
if (color4 == nil) then
|
||||
color4=color
|
||||
end
|
||||
if (colorBg == nil) then
|
||||
colorBg=string.char(0,0,0) -- black is the default background color
|
||||
end
|
||||
local hexColor = "#" .. string.format("%02x",string.byte(color,1)) .. string.format("%02x",string.byte(color,2)) .. string.format("%02x",string.byte(color,3))
|
||||
local hexColor1 = "#" .. string.format("%02x",string.byte(color1,1)) .. string.format("%02x",string.byte(color1,2)) .. string.format("%02x",string.byte(color1,3))
|
||||
local hexColor2 = "#" .. string.format("%02x",string.byte(color2,1)) .. string.format("%02x",string.byte(color2,2)) .. string.format("%02x",string.byte(color2,3))
|
||||
local hexColor3 = "#" .. string.format("%02x",string.byte(color3,1)) .. string.format("%02x",string.byte(color3,2)) .. string.format("%02x",string.byte(color3,3))
|
||||
local hexColor4 = "#" .. string.format("%02x",string.byte(color4,1)) .. string.format("%02x",string.byte(color4,2)) .. string.format("%02x",string.byte(color4,3))
|
||||
|
||||
|
||||
local hexColorBg = "#" .. string.format("%02x",string.byte(colorBg,1)) .. string.format("%02x",string.byte(colorBg,2)) .. string.format("%02x",string.byte(colorBg,3))
|
||||
|
||||
replaceMap["$SSID"]=ssid
|
||||
replaceMap["$SNTPSERVER"]=sntpserverhostname
|
||||
@ -115,6 +117,8 @@ function fillDynamicMap()
|
||||
replaceMap["$HEXCOLOR2"]=hexColor2
|
||||
replaceMap["$HEXCOLOR3"]=hexColor3
|
||||
replaceMap["$HEXCOLOR4"]=hexColor4
|
||||
replaceMap["$HEXCOLORBG"]=hexColorBg
|
||||
colorBg
|
||||
return replaceMap
|
||||
end
|
||||
|
||||
@ -210,6 +214,15 @@ function startWebServer()
|
||||
-- fill the current values
|
||||
color4=string.char(red, green, blue)
|
||||
end
|
||||
if ( _POST.bcolor ~= nil) then
|
||||
local hexColor=string.sub(_POST.bcolor, 4)
|
||||
local red = tonumber(string.sub(hexColor, 1, 2), 16)
|
||||
local green = tonumber(string.sub(hexColor, 3, 4), 16)
|
||||
local blue = tonumber(string.sub(hexColor, 5, 6), 16)
|
||||
file.write("colorBg=string.char(" .. red .. "," .. green .. "," .. blue .. ")\n")
|
||||
-- fill the current values
|
||||
colorBg=string.char(red, green, blue)
|
||||
end
|
||||
if (getTime ~= nil) then
|
||||
time = getTime(sec, timezoneoffset)
|
||||
file.write("print(\"Config from " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second .. "\")\n")
|
||||
|
Loading…
Reference in New Issue
Block a user