From 6349cb8395dc4d79f882537eada18b2ee249e6d4 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 23 Feb 2020 16:18:46 -0800 Subject: [PATCH] More builder refactoring to use our new functionality --- etc/kaleidoscope-builder.conf | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/etc/kaleidoscope-builder.conf b/etc/kaleidoscope-builder.conf index d0fcdf7f..0e42c950 100644 --- a/etc/kaleidoscope-builder.conf +++ b/etc/kaleidoscope-builder.conf @@ -45,22 +45,12 @@ uname_O=$(uname -o 2>/dev/null || echo not) find_max_prog_size() { -# SKETCH and -build-path in this command are here because of a bug introduced in Arduino 1.8.10 # https://github.com/arduino/arduino-builder/issues/341 - VPIDS=$("${ARDUINO_BUILDER}" \ - -hardware "${ARDUINO_PATH}/hardware" \ - -hardware "${BOARD_HARDWARE_PATH}" \ - ${ARDUINO_TOOLS_FLAG:+"${ARDUINO_TOOLS_FLAG}"} ${ARDUINO_TOOLS_PARAM:+"${ARDUINO_TOOLS_PARAM}"} \ - -tools "${ARDUINO_PATH}/tools-builder" \ - -fqbn "${FQBN}" \ - -build-path "${ARDUINO_PATH}" \ - -dump-prefs "${SKETCH_DIR}/${SKETCH}.ino" | grep "upload\.maximum_size=") - MAX_PROG_SIZE=${MAX_PROG_SIZE:-$(echo "${VPIDS}" | grep upload.maximum_size | head -n 1 | cut -d= -f2)} + PREFS=$(dump_arduino_prefs | grep "upload\.maximum_size=") + MAX_PROG_SIZE=${MAX_PROG_SIZE:-$(echo "${PREFS}" | head -n 1 | cut -d= -f2)} } find_device_vid_pid() { -# SKETCH and -build-path in this command are here because of a bug introduced in Arduino 1.8.10 -# https://github.com/arduino/arduino-builder/issues/341 VPIDS=$(dump_arduino_prefs | grep "\.[vp]id=") VID=${VID:-$(echo "${VPIDS}" | grep build.vid= | cut -dx -f2)} SKETCH_PID=${SKETCH_PID:-$(echo "${VPIDS}" | grep build.pid= | cut -dx -f2)} @@ -70,6 +60,8 @@ find_device_vid_pid() { dump_arduino_prefs() { +# SKETCH and -build-path in this command are here because of a bug introduced in Arduino 1.8.10 +# https://github.com/arduino/arduino-builder/issues/341 prefs=$("${ARDUINO_BUILDER}" \ -hardware "${ARDUINO_PATH}/hardware" \ -hardware "${BOARD_HARDWARE_PATH}" \ @@ -112,14 +104,7 @@ find_bootloader_ports() { } find_bootloader_path() { - BOOTLOADER_FILE=$("${ARDUINO_BUILDER}" \ - -hardware "${ARDUINO_PATH}/hardware" \ - -hardware "${BOARD_HARDWARE_PATH}" \ - ${ARDUINO_TOOLS_FLAG:+"${ARDUINO_TOOLS_FLAG}"} ${ARDUINO_TOOLS_PARAM:+"${ARDUINO_TOOLS_PARAM}"} \ - -tools "${ARDUINO_PATH}/tools-builder" \ - -fqbn "${FQBN}" \ - -build-path "${ARDUINO_PATH}" \ - -dump-prefs "${SKETCH_DIR}/${SKETCH}.ino" | grep "bootloader\.file=" | cut -d= -f2) + BOOTLOADER_FILE=$( dump_arduino_prefs | grep "bootloader\.file=" | cut -d= -f2) BOOTLOADER_FILE="${BOOTLOADER_FILE:-caterina/Caterina.hex}" BOOTLOADER_PATH="${BOOTLOADER_PATH:-${BOARD_HARDWARE_PATH}/keyboardio/avr/bootloaders/${BOOTLOADER_FILE}}"