From b2977894f94a8cf73efb737d073834dbe4c5d363 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 23 Feb 2020 22:02:45 -0800 Subject: [PATCH] Move the build instructions into the arduino boards.txt file --- bin/kaleidoscope-builder | 11 ++++++++--- etc/kaleidoscope-builder.conf | 8 ++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/bin/kaleidoscope-builder b/bin/kaleidoscope-builder index 472684e7..24a4eb2b 100755 --- a/bin/kaleidoscope-builder +++ b/bin/kaleidoscope-builder @@ -147,11 +147,16 @@ prepare_to_flash () { compile size fi + + flashing_instructions=$(get_arduino_pref 'build.flashing_instructions') - echo "To update your keyboard's firmware, hold down the 'Prog' key on your keyboard," - echo "and then press 'Enter'." + 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." + fi + + printf '%b\n\n' "${flashing_instructions}" echo "" - echo "When the 'Prog' key glows red, you can release it." + echo "When you're ready proceed, press 'Enter'." echo "" # We do not want to permit line continuations here. We just want a newline. diff --git a/etc/kaleidoscope-builder.conf b/etc/kaleidoscope-builder.conf index 0e42c950..acb0516d 100644 --- a/etc/kaleidoscope-builder.conf +++ b/etc/kaleidoscope-builder.conf @@ -59,6 +59,14 @@ find_device_vid_pid() { } +get_arduino_pref() { + pref=$1 + # Strip the preference name. And then strip leading and trailing quotations + MESSAGE=$(dump_arduino_prefs | grep ${pref}= | sed -e s/^${pref}=// -e 's/^"//' -e 's/"$//') + echo $MESSAGE +} + + 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