diff --git a/tools/initialFlash.sh b/tools/initialFlash.sh index b54d309..14e28ee 100755 --- a/tools/initialFlash.sh +++ b/tools/initialFlash.sh @@ -12,21 +12,35 @@ if [ ! -c $DEVICE ]; then fi -if [ $# -ne 1 ]; then +if [ $# -eq 0 ]; then echo "" - echo "e.g. usage $0 " + echo "e.g. usage $0 []" exit 1 fi -FILES="displayword.lua main.lua timecore.lua webpage.html webserver.lua wordclock.lua init.lua" +if [ $# -eq 1 ]; then + FILES="displayword.lua main.lua timecore.lua webpage.html webserver.lua wordclock.lua init.lua" +else + FILES=$2 +fi + # Format filesystem first -echo "Format the complete ESP" -$LUATOOL -p $DEVICE -w -b 115200 -if [ $? -ne 0 ]; then - echo "STOOOOP" - exit 1 -fi +#echo "Format the complete ESP" +#$LUATOOL -p $DEVICE -w -b 115200 +#if [ $? -ne 0 ]; then +# echo "STOOOOP" +# exit 1 +#fi + +echo "Reboot the ESP" +echo "node.restart()" >> $DEVICE +sleep 1 +for i in $(seq 0 5); do + echo "Stop TMR $i" + echo "tmr.stop($i)" >> $DEVICE + sleep 1 +done echo echo "Start Flasing ..."