# CTR2-Flex Programmer for Linux and Mac.  Should also work on MSWindows
# MUST have python3 and pip installed
# Lou Scalpati KI5FTY
# >>>> REMEMBER TO MAKE THIS FILE EXECUTABLE <<<<

PYTHON=python3
CHIP=esp32s3

#-----------------------------------------------
# Replace the PORT and DIR variables below to fit your system
#-----------------------------------------------
# Begin Edit

PORT=/dev/<YOUR-USB-DEVICE>
DIR=<DIRECTORY-CONTAINING-CTR2-FLEX.BIN-FILE>


# End Edit
#------------------------------------------------

pip -q install esptool

read -rsn1 -p "Make sure the unit is in Program mode" 

$PYTHON -m esptool --chip $CHIP --port $PORT  write_flash -z 0x0 $DIR/CTR2-Flex.bin
