Add remote flashing procedure

This commit is contained in:
ollo 2019-04-18 16:32:35 +02:00
parent 0adb96174e
commit b38269166b
2 changed files with 58 additions and 0 deletions

View File

@ -1,6 +1,7 @@
# ESP Wordclock
## Setup
### Initial Setup
Install the firmware on the ESP:
The ESP must be set into the bootloader mode, like [this](https://www.ccc-mannheim.de/wiki/ESP8266#Boot_Modi)
@ -22,5 +23,12 @@ Then disconnect the serial terminal and copy the required files to the microcont
./tools/initialFlash.sh /dev/ttyUSB0
</pre>
### Upgrade
Determine the IP address of your clock and execute the following script:
<pre>
./tools/remoteFlash.sh IP-Address
</pre>
## Internal Setup
* GPIO2 LEDs

50
tools/remoteFlash.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
IP=$1
FLASHTOOL=./tools/tcpFlash.py
if [ ! -f $FLASHTOOL ]; then
echo "Execute the script in root folder of the project"
exit 2
fi
if [ "$IP" == "" ]; then
echo "IP address of ESP required"
echo "usage:"
echo "$0 <IP>"
echo "$0 192.168.0.2"
exit 1
fi
# check the connection
echo "Searching $IP ..."
ping $IP -c 2 >> /dev/null
if [ $? -ne 0 ]; then
echo "Entered IP address: $IP is NOT online"
exit 2
fi
echo "Upgrading $IP"
exit 3
FILES="displayword.lua main.lua timecore.lua webpage.html webserver.lua wordclock.lua init.lua"
echo "Start Flasing ..."
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 ------------"
$FLASHTOOL -t $IP -f $f
if [ $? -ne 0 ]; then
echo "STOOOOP"
exit 1
fi
done
echo "Reboot the ESP"
echo "node.restart()" | nc $IP 80
exit 0