diff --git a/displayword.lua b/displayword.lua
index ed67ac4..da094f2 100644
--- a/displayword.lua
+++ b/displayword.lua
@@ -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) .. "%")
diff --git a/main.lua b/main.lua
index 241c4a7..3e75444 100644
--- a/main.lua
+++ b/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)
diff --git a/webpage.html b/webpage.html
index 2ba586a..25d1c80 100644
--- a/webpage.html
+++ b/webpage.html
@@ -45,7 +45,7 @@ Please note that all settings are mandatory
WIFI-SSID | SSID of the wireless network | |
---|---|---|
WIFI-Password | Password of the wireless network | |
SNTP Server | Server to sync the time with. Only one ntp server is allowed. | |
SNTP Server | Server to sync the time with. Only one ntp server is allowed. | |
Offset to UTC time | Define the offset to UTC time in hours. For example +1 hour for Germany | |
Foreground Color | LED Color for all minutes, divisible by five | |
Background Color | Background LED Color | |
2. Minute Color | Second minute after | |
3. Minute Color | Third minute after | |
4. Minute Color | Fourth minute after | |
Three quater | Dreiviertel Joa/nei | |
Invert lines 4-6 | invert | |
Adjust brightnes | Adjust brightness of LEDs | |