Merge simulation with main stream

This commit is contained in:
ollo 2018-12-27 17:06:45 +01:00
commit caea476b40
8 changed files with 1041 additions and 390 deletions

View File

@ -57,8 +57,24 @@ function displayTime()
print("Local time : " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second .. " in " .. charactersOfTime .. " chars " .. wordsOfTime .. " words") print("Local time : " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second .. " in " .. charactersOfTime .. " chars " .. wordsOfTime .. " words")
-- Write the buffer to the LEDs --if lines 4 to 6 are inverted due to hardware-fuckup, unfuck it here
ws2812.write(ledBuf) if ((inv46 ~= nil) and (inv46 == "on")) then
tempstring = ledBuf:sub(1,99) -- 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-2,(startled-i)*3)
end
end
tempstring = tempstring .. ledBuf:sub((67*3)-2,ledBuf:len())
ws2812.write(tempstring)
tempstring=nil
else
ws2812.write(ledBuf)
ledBuf=nil
end
-- Used for debugging -- Used for debugging
if (clockdebug ~= nil) then if (clockdebug ~= nil) then
@ -69,7 +85,7 @@ function displayTime()
end end
end end
-- cleanup -- cleanup
ledBuf=nil
words=nil words=nil
time=nil time=nil
collectgarbage() collectgarbage()
@ -116,7 +132,6 @@ function normalOperation()
mydofile("webserver") mydofile("webserver")
startWebServer() startWebServer()
end) end)
displayTime() displayTime()
-- Start the time Thread -- Start the time Thread
tmr.alarm(1, 20000, 1 ,function() tmr.alarm(1, 20000, 1 ,function()

File diff suppressed because it is too large Load Diff

View File

@ -32,5 +32,6 @@ if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
#./esptool.py --port /dev/$DEVICE $BAUD write_flash 0x00000 nodemcu-master-enduser_setup,file,gpio,net,node,rtcfifo,rtcmem,rtctime,sntp,spi,tmr,uart,wifi,ws2812-integer.bin ./esptool.py --port /dev/$DEVICE $BAUD write_flash -fm dio 0x00000 nodemcu2.bin
./esptool.py --port /dev/ttyUSB0 $BAUD write_flash 0x00000 0x00000.bin 0x10000 0x10000.bin # 0x3fc000 esp_init_data_default_v08.bin 0x07e000 blank.bin 0x3fe000 blank.bin
#./esptool.py --port /dev/$DEVICE $BAUD write_flash 0x00000 0x00000.bin 0x10000 0x10000.bin

BIN
os/nodemcu2.bin Normal file

Binary file not shown.

View File

@ -18,10 +18,11 @@ if [ $# -ne 1 ]; then
exit 1 exit 1
fi fi
FILES="displayword.lua main.lua timecore.lua webpage.lua webserver.lua wordclock.lua init.lua" FILES="displayword.lua main.lua timecore.lua webpage.html webserver.lua wordclock.lua init.lua"
# Format filesystem first # Format filesystem first
echo "Format the complete ESP" echo "Format the complete ESP"
$LUATOOL -p $DEVICE -w $LUATOOL -p $DEVICE -w -b 115200
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "STOOOOP" echo "STOOOOP"
exit 1 exit 1
@ -36,7 +37,7 @@ for f in $FILES; do
exit 1 exit 1
fi fi
echo "------------- $f ------------" echo "------------- $f ------------"
$LUATOOL -p $DEVICE -f $f -t $f $LUATOOL -p $DEVICE -f $f -b 115200 -t $f
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "STOOOOP" echo "STOOOOP"
exit 1 exit 1
@ -44,6 +45,6 @@ for f in $FILES; do
done done
echo "Reboot the ESP" echo "Reboot the ESP"
$LUATOOL -p $DEVICE -r $LUATOOL -p $DEVICE -r -b 115200
exit 0 exit 0

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>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>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" 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>
</table> </table>

View File

@ -165,7 +165,9 @@ function startWebServer()
file.remove(configFile .. ".new") file.remove(configFile .. ".new")
sec, _ = rtctime.get() sec, _ = rtctime.get()
file.open(configFile.. ".new", "w+") file.open(configFile.. ".new", "w+")
file.write("-- Config\n" .. "wifi.sta.config(\"" .. _POST.ssid .. "\",[[" .. _POST.password .. "]])\n" .. "sntpserverhostname=\"" .. _POST.sntpserver .. "\"\n" .. "timezoneoffset=\"" .. _POST.timezoneoffset .. "\"\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")
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)
print ("Got fcolor: " .. _POST.fcolor) print ("Got fcolor: " .. _POST.fcolor)