Added a couple custom configs and fixed TUI

This commit is contained in:
Elizabeth Cray
2024-04-29 20:37:05 -04:00
parent 797b933779
commit 51f933f048
3 changed files with 282 additions and 4 deletions
+23 -4
View File
@@ -12,37 +12,56 @@ git submodule update --init --recursive
cd dirs/klipper
make menuconfig
CONFIG_FILES=(`ls config`)
CONFIG_FILES+=("Enter_Manually")
let i=0
C=()
for f in ${CONFIG_FILES[@]}; do
C+=($i $f)
let i+=1
done
CONFIG_INDEX=$(dialog --backtitle "drwho@hackers.town" --title "Printer Selection" --menu "Select Printer Config" --output-fd 1 40 0 1 ${C[@]} 3>&1 1>&2 2>&3)
CONFIG_INDEX=$(dialog --backtitle "drwho@hackers.town" --title "Printer Selection" --menu "Select Printer Config" --output-fd 1 40 0 1 ${C[@]})
CONFIG_FILE=${CONFIG_FILES[$CONFIG_INDEX]}
if [[ $CONFIG_FILE == "Enter_Manually" ]]; then
MANUAL_FILE=""
while [ ! -f "${MANUAL_FILE}" ]; do
MANUAL_FILE=$(dialog --backtitle "drwho@hackers.town" --title "Manual Config Selection" --inputbox "Enter Full Config File Path" 8 40 "${MANUAL_FILE}" 3>&1 1>&2 2>&3)
done
CONFIG_FILE=$MANUAL_FILE
else
CONFIG_FILE="./config/$CONFIG_FILE"
fi
# Select Serial Device
DEVICES=(`ls /dev/serial/by-id/`)
DEVICES+=("Enter_Manually")
let i=0
C=()
for f in ${DEVICES[@]}; do
C+=($i $f)
let i+=1
done
DEVICE_INDEX=$(dialog --backtitle "drwho@hackers.town" --title "USB Device Selection" --menu "Select USB Device" --output-fd 1 40 0 1 ${C[@]} 3>&1 1>&2 2>&3)
DEVICE_INDEX=$(dialog --backtitle "drwho@hackers.town" --title "USB Device Selection" --menu "Select USB Device" --output-fd 1 40 0 1 ${C[@]})
DEVICE=${DEVICES[$DEVICE_INDEX]}
if [[ $DEVICE == "Enter_Manually" ]]; then
MANUAL_FILE=""
while [ ! -f "${MANUAL_FILE}" ]; do
MANUAL_FILE=$(dialog --backtitle "drwho@hackers.town" --title "Manual Device Selection" --inputbox "Enter Full Device File Path" 8 40 "${MANUAL_FILE}" 3>&1 1>&2 2>&3)
done
DEVICE=$MANUAL_FILE
fi
# Name Printer
NAME_NOT_VALID=true
while $NAME_NOT_VALID ; do
PRINTER_NAME="$(dialog --backtitle 'drwho@hackers.town' --inputbox 'Name This Printer' 8 40 'Print' 3>&1 1>&2 2>&3)"
PRINTER_NAME="$(dialog --backtitle 'drwho@hackers.town' --inputbox 'Name This Printer' 8 40 \"${PRINTER_NAME}\" 3>&1 1>&2 2>&3)"
if [[ $PRINTER_NAME =~ ^[a-zA-Z0-9_-]+$ ]]; then
NAME_NOT_VALID=false
fi
done
# Build Klipper
cat ./config/$CONFIG_FILE | sed -e "s/^serial: .\+$/serial: \/dev\/serial\/by-id\/${DEVICE}/" > ./printer.cfg
cat $CONFIG_FILE | sed -e "s/^serial: .\+$/serial: \/dev\/serial\/by-id\/${DEVICE}/" > ./printer.cfg
make -j$(nproc)
# Flash Firmware