Allow device-*.sh file to flash to be specified without '-f'

This commit is contained in:
Tim Gunter
2021-04-09 20:02:25 -07:00
parent bae1d7a894
commit ce5d57d250
2 changed files with 12 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ PYTHON=${PYTHON:-$(which python3 python|head -n 1)}
# Usage info
show_help() {
cat << EOF
Usage: ${0##*/} [-h] [-p ESPTOOL_PORT] [-P PYTHON] -f FILENAME
Usage: $(basename $0) [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME|FILENAME]
Flash image file to device, leave existing system intact."
-h Display this help and exit
@@ -37,6 +37,11 @@ while getopts ":hp:P:f:" opt; do
done
shift "$((OPTIND-1))"
[ -z "$FILENAME" -a -n "$1" ] && {
FILENAME=$1
shift
}
if [ -f "${FILENAME}" ]; then
echo "Trying to flash update ${FILENAME}."
$PYTHON -m esptool --baud 921600 write_flash 0x10000 ${FILENAME}