Brightness control can be activated and deactivated
This commit is contained in:
parent
13343fa645
commit
69a2158ca6
@ -49,11 +49,6 @@ local generateLEDs = function(words, colorForground, colorMin1, colorMin2, color
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Initial value of percentage
|
||||
if (words.briPercent == nil) then
|
||||
words.briPercent=50
|
||||
end
|
||||
|
||||
local minutes=1
|
||||
if (words.min1 == 1) then
|
||||
minutes = minutes + 1
|
||||
@ -64,7 +59,7 @@ local generateLEDs = function(words, colorForground, colorMin1, colorMin2, color
|
||||
elseif (words.min4 == 1) then
|
||||
minutes = minutes + 4
|
||||
end
|
||||
if (adc ~= nil) then
|
||||
if ( (adc ~= nil) and (words.briPercent ~= nil) ) then
|
||||
local per = math.floor(100*adc.read(0)/1000)
|
||||
words.briPercent = tonumber( ((words.briPercent * 4) + per) / 5)
|
||||
print("Minutes : " .. tostring(minutes) .. " bright: " .. tostring(words.briPercent) .. "% current: " .. tostring(per) .. "%")
|
||||
|
6
main.lua
6
main.lua
@ -49,7 +49,11 @@ function displayTime()
|
||||
end
|
||||
local time = getTime(sec, timezoneoffset)
|
||||
local words = display_timestat(time.hour, time.minute)
|
||||
words.briPercent=briPercent
|
||||
if ((dim ~= nil) and (dim == "on")) then
|
||||
words.briPercent=briPercent
|
||||
else
|
||||
words.briPercent=nil
|
||||
end
|
||||
dp = dofile("displayword.lc")
|
||||
if (dp ~= nil) then
|
||||
ledBuf = dp.generateLEDs(words, color, color1, color2, color3, color4)
|
||||
|
@ -45,7 +45,7 @@ Please note that all settings are mandatory<br /><br />
|
||||
<table id="table-6">
|
||||
<tr><th><b>WIFI-SSID</b></th><td><input id="ssid" name="ssid" value="$SSID"></td><td>SSID of the wireless network</td></tr>
|
||||
<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.</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.</td></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</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>
|
||||
@ -53,9 +53,9 @@ Please note that all settings are mandatory<br /><br />
|
||||
<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><th>Invert lines 4-6</th><td><input type="checkbox" name="inv46" $THREEQUATER></td><td>invert</td></tr>
|
||||
<tr><th>Adjust brightnes</th><td><input type="checkbox" name="dim" $AUTODIM></td><td>Adjust brightness of LEDs</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>
|
||||
|
@ -120,6 +120,8 @@ function fillDynamicMap()
|
||||
replaceMap["$HEXCOLOR3"]=hexColor3
|
||||
replaceMap["$HEXCOLOR4"]=hexColor4
|
||||
replaceMap["$HEXCOLORBG"]=hexColorBg
|
||||
replaceMap["$INV46"]=((inv46 ~= nil and inv46 == "on") and "checked" or "")
|
||||
replaceMap["$AUTODIM"]=((dim ~= nil and dim == "on") and "checked" or "")
|
||||
return replaceMap
|
||||
end
|
||||
|
||||
@ -200,7 +202,7 @@ function startWebServer()
|
||||
sec, _ = rtctime.get()
|
||||
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("sntpserverhostname=\"" .. _POST.sntpserver .. "\"\n" .. "timezoneoffset=\"" .. _POST.timezoneoffset .. "\"\n".. "inv46=\"" .. tostring(_POST.inv46) .. "\"\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
|
||||
-- color=string.char(_POST.green, _POST.red, _POST.blue)
|
||||
|
Loading…
Reference in New Issue
Block a user