Inverted mode for special hardware

This commit is contained in:
Florian Zahn 2018-12-23 23:51:56 +01:00
parent 8b3e61be61
commit e9c28e8547
3 changed files with 20 additions and 4 deletions

View File

@ -51,13 +51,27 @@ function displayTime()
words = display_timestat(time.hour, time.minute)
local charactersOfTime = display_countwords_de(words)
ledBuf = generateLEDs(words, color, color1, color2, color3, color4,
local ledBuf = generateLEDs(words, color, color1, color2, color3, color4,
charactersOfTime)
print("Local time : " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second .. " in " .. charactersOfTime .. " chars")
-- Write the buffer to the LEDs
ws2812.write(ledBuf)
--if lines 4 to 6 are inverted due to hardware-fuckup, unfuck it here
if ((inv46 ~= nil) and (inv46 == "on")) then
tempstring = ledBuf:sub(1,101) -- first 33 leds
rowend = {44,55,66}
for _, startled in ipairs(rowend) do
for i = 0,10 do
tempstring = tempstring .. ledBuf:sub((startled-i)*3,(startled-i)*3+2)
end
end
tempstring = tempstring .. ledBuf:sub((67*3),ledBuf:len())
ws2812.write(tempstring)
else
ws2812.write(ledBuf)
end
-- Used for debugging
if (clockdebug ~= nil) then

View File

@ -55,6 +55,8 @@ Please note that all settings are mandatory<br /><br />
<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><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>
</table>

View File

@ -166,7 +166,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")
file.write("sntpserverhostname=\"" .. _POST.sntpserver .. "\"\n" .. "timezoneoffset=\"" .. _POST.timezoneoffset .. "\"\n".. "inv46=\"" .. tostring(_POST.inv46) .. "\"\n")
if ( _POST.fcolor ~= nil) then
-- color=string.char(_POST.green, _POST.red, _POST.blue)