Add --1200bps-reset param to device-install/update scripts (#6752)

* add change-mode support

* add change-mode support

* tab to space

* fix if check

* change param name to 1200bps-reset

* update help section

* missed one in help seciton

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
Kalle Lilja
2025-06-03 03:35:26 +02:00
committed by GitHub
parent 9ce44556ce
commit 4d81280ac2
4 changed files with 62 additions and 8 deletions

View File

@@ -2,6 +2,7 @@
PYTHON=${PYTHON:-$(which python3 python | head -n 1)}
WEB_APP=false
BPS_RESET=false
TFT_BUILD=false
MCU=""
@@ -72,7 +73,7 @@ set -e
# Usage info
show_help() {
cat <<EOF
Usage: $(basename $0) [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME] [--web]
Usage: $(basename $0) [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME] [--web] [--1200bps-reset]
Flash image file to device, but first erasing and writing system information.
-h Display this help and exit.
@@ -80,6 +81,7 @@ Flash image file to device, but first erasing and writing system information.
-P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: "$PYTHON")
-f FILENAME The firmware .bin file to flash. Custom to your device type and region.
--web Enable WebUI. (Default: false)
--1200bps-reset Attempt to place the device in correct mode. Some hardware requires this twice. (1200bps Reset)
EOF
}
@@ -105,6 +107,9 @@ while [ $# -gt 0 ]; do
--web)
WEB_APP=true
;;
--1200bps-reset)
BPS_RESET=true
;;
--) # Stop parsing options
shift
break
@@ -117,6 +122,11 @@ while [ $# -gt 0 ]; do
shift # Move to the next argument
done
if [[ $BPS_RESET == true ]]; then
$ESPTOOL_CMD --baud 1200 --after no_reset read_flash_status
exit 0
fi
[ -z "$FILENAME" -a -n "$1" ] && {
FILENAME=$1
shift