


###############################################
# begin esp-idf stuffss I made ################
###############################################


echo "\n=======CUSTOM=======\n"

echo "TTY devices found in dmesg:"
COUNTER=0
devarr=()
for line in $(dmesg | tail -50 | grep -o -E "tty[A-Z]{3}[0-9]{0,2}" | sort -u); do
                echo "$COUNTER  /dev/$line"
                devarr+=("/dev/$line")
                COUNTER=$((COUNTER+1))
done

echo "\nEnter TTY Number You'd Like:"
read tty
ttyselect=$devarr[(($tty+1))]

echo "Set esp target (esp32, esp32s3, esp32c6, esp8266, etc)"
read esp

ESPPORT="$ttyselect"

echo "Setting environment variables"
echo "Adding Custom bins to PATH:"
export PATH=~/esp/.custom_bin:$PATH
echo "ESPPORT = $ESPPORT"
export ESPPORT
export ESPBAUD=921600
echo "ESPBAUD = $ESPBAUD"
export ESPTARGET=$esp
echo "ESPTARGET = $ESPTARGET"

echo "Changing dir to ~/esp"
cd ~/esp

echo "All done :3\n\tEnjoy your esp-idf environment"

###############################################
# end esp-idf stuffss I made ##################
###############################################


