Update Firmware Building

This commit is contained in:
Elizabeth Cray 2024-09-16 21:07:32 -04:00
parent 80ec5a75b6
commit 46da506ac7

View File

@ -11,6 +11,7 @@ ARG_SKIP_APT=0
ARG_NAME=0 ARG_NAME=0
ARG_CONFIG=0 ARG_CONFIG=0
ARG_PORT=0 ARG_PORT=0
ARG_FIRM=0
while [[ "$#" -gt 0 ]]; do while [[ "$#" -gt 0 ]]; do
case $1 in case $1 in
-h|--help) ARG_HELP=1 ;; -h|--help) ARG_HELP=1 ;;
@ -18,6 +19,7 @@ while [[ "$#" -gt 0 ]]; do
-n|--name) ARG_NAME="$2" ; shift ;; -n|--name) ARG_NAME="$2" ; shift ;;
-c|--config) ARG_CONFIG="$2" ; shift ;; -c|--config) ARG_CONFIG="$2" ; shift ;;
-p|--port) ARG_PORT="$2" ; shift ;; -p|--port) ARG_PORT="$2" ; shift ;;
-f|--skip-firmware) ARG_FIRM=1 ;;
*) echo "Unknown Parameter"; exit 3 ;; *) echo "Unknown Parameter"; exit 3 ;;
esac esac
shift shift
@ -41,12 +43,13 @@ cd $ROOT_DIR
source ./ColorEchoForShell/dist/ColorEcho.bash source ./ColorEchoForShell/dist/ColorEcho.bash
if [[ "$ARG_HELP" == 1 ]]; then if [[ "$ARG_HELP" == 1 ]]; then
echo.Cyan "HacDC Printewr Setup Script Usage" echo.Cyan "HacDC Printer Setup Script Usage"
echo.Yellow "./setup.sh [options]" echo.Yellow "./setup.sh [options]"
echo "" echo ""
echo.BoldPurple "Option Description" echo.BoldPurple "Option Description"
echo.Rainbow "-h/--help Display this help msg" echo.Rainbow "-h/--help Display this help msg"
echo.Rainbow "-a/--skip-apt Skip installing apt packages" echo.Rainbow "-a/--skip-apt Skip installing apt packages"
echo.Rainbow "-f/--skip-firmware Skip firmware build/install"
echo.Rainbow "-n/--name Specify printer name (skips popup)" echo.Rainbow "-n/--name Specify printer name (skips popup)"
echo.Rainbow "-c/--config Specify printer config (skips popup)" echo.Rainbow "-c/--config Specify printer config (skips popup)"
echo.Rainbow "-p/--port Specify printer port (skips popup)" echo.Rainbow "-p/--port Specify printer port (skips popup)"
@ -102,7 +105,10 @@ cp -r $ROOT_DIR/dirs $ROOT_DIR/$PRINTER_NAME
# Select Klipper Config # Select Klipper Config
cd $ROOT_DIR/$PRINTER_NAME/klipper cd $ROOT_DIR/$PRINTER_NAME/klipper
if [[ "$ARG_FIRM" == 0]]; then
make menuconfig make menuconfig
fi
CONFIG_FILE="" CONFIG_FILE=""
if [[ "$ARG_CONFIG" == 0 ]]; then if [[ "$ARG_CONFIG" == 0 ]]; then
CONFIG_FILES=(`ls config`) CONFIG_FILES=(`ls config`)
@ -159,6 +165,7 @@ else
fi fi
# Build Klipper # Build Klipper
if [[ "$ARG_FIRM" == 0 ]]; then
echo.Cyan "Compile Klipper Firmware" echo.Cyan "Compile Klipper Firmware"
cp $CONFIG_FILE $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg cp $CONFIG_FILE $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg
sed -i -e "s/^serial: .\+$/LINEHERE/g" "$ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg" sed -i -e "s/^serial: .\+$/LINEHERE/g" "$ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg"
@ -166,10 +173,12 @@ cat $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg | replace "LINEHERE" "serial: $D
rm $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg rm $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg
mv $ROOT_DIR/$PRINTER_NAME/klipper/tmp.cfg $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg mv $ROOT_DIR/$PRINTER_NAME/klipper/tmp.cfg $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg
make -j$(nproc) make -j$(nproc)
# Flash Firmware # Flash Firmware
echo.Cyan "Flash Device" echo.Cyan "Flash Device"
make flash FLASH_DEVICE=$DEVICE make flash FLASH_DEVICE=$DEVICE
else
echo.ICyan "Skipping firmware build"
fi
# Copy over printer config file # Copy over printer config file
echo.Cyan "Setup printer.cfg" echo.Cyan "Setup printer.cfg"