Attempt to simplify output of the build and flash process, along with

more verbose verbose output
pull/815/head
Jesse Vincent 5 years ago
parent 559d210eed
commit 16b2404ab9
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -147,14 +147,13 @@ find_sketch () {
prompt_before_flashing () { prompt_before_flashing () {
flashing_instructions=$(get_arduino_pref 'build.flashing_instructions') flashing_instructions=$(get_arduino_pref 'build.flashing_instructions')
if [ "x${flashing_instructions}x" == "xx" ]; then if [ "x${flashing_instructions}x" = "xx" ]; then
flashing_instructions="If your keyboard needs you to do something to put it in flashing mode, do that now." flashing_instructions="If your keyboard needs you to do something to put it in flashing mode, do that now."
fi fi
printf '%b\n\n' "${flashing_instructions}" printf '%b\n\n' "${flashing_instructions}"
echo "" echo ""
echo "When you're ready to proceed, press 'Enter'." echo "When you're ready to proceed, press 'Enter'."
echo ""
# We do not want to permit line continuations here. We just want a newline. # We do not want to permit line continuations here. We just want a newline.
# shellcheck disable=SC2162 # shellcheck disable=SC2162
@ -192,11 +191,28 @@ check_bootloader_port_and_flash () {
echo "Unable to detect a keyboard in bootloader mode. You may need to hold the 'Prog' key or hit a reset button" echo "Unable to detect a keyboard in bootloader mode. You may need to hold the 'Prog' key or hit a reset button"
return 1 return 1
fi fi
flash_over_usb || flash_over_usb
echo "Flashing your keyboard:"
flash_over_usb
if [ $? != 0 ]; then
sleep 2
flash_over_usb
fi
if [ $? = 0 ]; then
echo "Keyboard flashed successfully!"
elif [ "${ARDUINO_VERBOSE}" != "-verbose" ]; then
echo "Something went wrong. You might want to try flashing again with the VERBOSE environment variable set"
exit -1
fi
} }
flash_over_usb () { flash_over_usb () {
sleep 2 if [ "${ARDUINO_VERBOSE}" != "-verbose" ]; then
${AVRDUDE} \ ${AVRDUDE} \
-C "${AVRDUDE_CONF}" \ -C "${AVRDUDE_CONF}" \
-p"${MCU}" \ -p"${MCU}" \
@ -205,7 +221,19 @@ flash_over_usb () {
-P "${DEVICE_PORT_BOOTLOADER}" \ -P "${DEVICE_PORT_BOOTLOADER}" \
-b57600 \ -b57600 \
"-Uflash:w:${HEX_FILE_PATH}:i" \ "-Uflash:w:${HEX_FILE_PATH}:i" \
2>&1 2>&1 |grep -v ^avrdude | grep -v '^$' |grep -v '^ ' | grep -vi programmer
return ${PIPESTATUS[0]}
else
${AVRDUDE} \
-C "${AVRDUDE_CONF}" \
-p"${MCU}" \
-cavr109 \
-D \
-P "${DEVICE_PORT_BOOTLOADER}" \
-b57600 \
"-Uflash:w:${HEX_FILE_PATH}:i"
return $?
fi
} }
flash_from_bootloader() { flash_from_bootloader() {
@ -275,7 +303,7 @@ compile () {
SKETCH_DIR="$(find_sketch)" SKETCH_DIR="$(find_sketch)"
echo "Building ${SKETCH_DIR}/${SKETCH} ${LIB_VERSION} into ${OUTPUT_PATH}..." echo "Building ${SKETCH_DIR}/${SKETCH} ${LIB_VERSION} into ${OUTPUT_PATH}"
# This is defined in the (optional) user config. # This is defined in the (optional) user config.
# shellcheck disable=SC2154 # shellcheck disable=SC2154

Loading…
Cancel
Save