@ -195,6 +195,19 @@ compile () {
ARDUINO_PACKAGES="-hardware \"${ARDUINO_PACKAGE_PATH}\""
ARDUINO_PACKAGES="-hardware \"${ARDUINO_PACKAGE_PATH}\""
fi
fi
SKETCH_DIR="$(find_sketch)"
SAVED_BOARD="${BOARD}"
SAVED_FQBN="${FQBN}"
if [ -e "${SKETCH_DIR}/.kaleidoscope-builder.conf" ]; then
# shellcheck disable=SC1090
BOARD="$(. "${SKETCH_DIR}"/.kaleidoscope-builder.conf && echo "${BOARD}")"
# shellcheck disable=SC1090
FQBN="$(. "${SKETCH_DIR}"/.kaleidoscope-builder.conf && echo "${FQBN}")"
if [ "${SAVED_FQBN}" = "${FQBN}" ] || [ -z "${FQBN}" ]; then
FQBN="keyboardio:avr:${BOARD}"
fi
fi
# SC2091: We do not care if quotes or backslashes are not respected.
# SC2091: We do not care if quotes or backslashes are not respected.
# SC2086: We want word splitting.
# SC2086: We want word splitting.
# shellcheck disable=SC2086,SC2090
# shellcheck disable=SC2086,SC2090
@ -217,7 +230,7 @@ compile () {
-warnings all \
-warnings all \
${ARDUINO_VERBOSE} \
${ARDUINO_VERBOSE} \
${ARDUINO_AVR_GCC_PREFIX_PARAM} \
${ARDUINO_AVR_GCC_PREFIX_PARAM} \
"$(find_sketch) /${SKETCH}.ino"
"${SKETCH_DIR} /${SKETCH}.ino"
cp "${BUILD_PATH}/${SKETCH}.ino.hex" "${HEX_FILE_PATH}"
cp "${BUILD_PATH}/${SKETCH}.ino.hex" "${HEX_FILE_PATH}"
cp "${BUILD_PATH}/${SKETCH}.ino.elf" "${ELF_FILE_PATH}"
cp "${BUILD_PATH}/${SKETCH}.ino.elf" "${ELF_FILE_PATH}"
@ -229,6 +242,9 @@ compile () {
else
else
rm -rf "${BUILD_PATH}"
rm -rf "${BUILD_PATH}"
fi
fi
BOARD="${SAVED_BOARD}"
FQBN="${SAVED_FQBN}"
}
}
_find_all () {
_find_all () {