2016-06-23 18:42:58 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
LUATOOL=./tools/luatool.py
|
|
|
|
|
|
|
|
DEVICE=$1
|
|
|
|
|
|
|
|
# check the serial connection
|
|
|
|
|
|
|
|
if [ ! -c $DEVICE ]; then
|
|
|
|
echo "$DEVICE does not exist"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ $# -ne 1 ]; then
|
|
|
|
echo ""
|
|
|
|
echo "e.g. usage $0 <device>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-12-23 21:53:25 +01:00
|
|
|
FILES="displayword.lua main.lua timecore.lua webpage.html webserver.lua wordclock.lua init.lua"
|
|
|
|
|
2016-07-03 18:41:09 +02:00
|
|
|
# Format filesystem first
|
|
|
|
echo "Format the complete ESP"
|
2018-12-23 21:53:25 +01:00
|
|
|
$LUATOOL -p $DEVICE -w -b 115200
|
2016-07-03 18:41:09 +02:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "STOOOOP"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Start Flasing ..."
|
2016-06-23 18:42:58 +02:00
|
|
|
for f in $FILES; do
|
|
|
|
if [ ! -f $f ]; then
|
|
|
|
echo "Cannot find $f"
|
|
|
|
echo "place the terminal into the folder where the lua files are present"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "------------- $f ------------"
|
2018-12-23 21:53:25 +01:00
|
|
|
$LUATOOL -p $DEVICE -f $f -b 115200 -t $f
|
2016-06-23 18:42:58 +02:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "STOOOOP"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2016-07-03 18:41:09 +02:00
|
|
|
echo "Reboot the ESP"
|
2018-12-23 21:53:25 +01:00
|
|
|
$LUATOOL -p $DEVICE -r -b 115200
|
2016-07-03 18:41:09 +02:00
|
|
|
|
2016-06-23 18:42:58 +02:00
|
|
|
exit 0
|