Only format ESP if no file is specified

This commit is contained in:
Ollo 2021-01-31 20:41:03 +01:00
parent f72295e709
commit f93d0df461
2 changed files with 12 additions and 8 deletions

View File

@ -5,11 +5,13 @@ ws2812.init() -- WS2812 LEDs initialized on GPIO2
MAXLEDS=110 MAXLEDS=110
counter1=0 counter1=0
ws2812.write(string.char(0,0,0):rep(114)) ws2812.write(string.char(0,0,0):rep(114))
tmr.alarm(2, 85, 1, function() local bootledtimer = tmr.create()
bootledtimer:register(5000, tmr.ALARM_AUTO, function (t)
counter1=counter1+1 counter1=counter1+1
spaceLeds = math.max(MAXLEDS - (counter1*2), 0) spaceLeds = math.max(MAXLEDS - (counter1*2), 0)
ws2812.write(string.char(128,0,0):rep(counter1) .. string.char(0,0,0):rep(spaceLeds) .. string.char(0,0,64):rep(counter1)) ws2812.write(string.char(128,0,0):rep(counter1) .. string.char(0,0,0):rep(spaceLeds) .. string.char(0,0,64):rep(counter1))
end) end)
bootledtimer:start()
local blacklistfile="init.lua config.lua config.lua.new webpage.html" local blacklistfile="init.lua config.lua config.lua.new webpage.html"
function recompileAll() function recompileAll()
@ -44,6 +46,7 @@ end
local initTimer = tmr.create() local initTimer = tmr.create()
initTimer:register(5000, tmr.ALARM_SINGLE, function (t) initTimer:register(5000, tmr.ALARM_SINGLE, function (t)
bootledtimer:unregister()
if ( if (
(file.open("main.lua")) or (file.open("main.lua")) or
(file.open("timecore.lua")) or (file.open("timecore.lua")) or
@ -69,4 +72,3 @@ initTimer:register(5000, tmr.ALARM_SINGLE, function (t)
t:unregister() t:unregister()
end) end)
initTimer:start() initTimer:start()
print("Init file end reached")

View File

@ -32,12 +32,14 @@ else
fi fi
# Format filesystem first if [ $# -eq 1 ]; then
echo "Format the complete ESP" # Format filesystem first
python3 $LUATOOL -p $DEVICE -w -b $BAUD echo "Format the complete ESP"
if [ $? -ne 0 ]; then python3 $LUATOOL -p $DEVICE -w -b $BAUD
if [ $? -ne 0 ]; then
echo "STOOOOP" echo "STOOOOP"
exit 1 exit 1
fi
fi fi
#stty -F $DEVICE $BAUD #stty -F $DEVICE $BAUD