summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni <jeder@mail1a.de>2016-08-15 21:18:25 +0200
committerToni <jeder@mail1a.de>2016-08-15 21:18:25 +0200
commitb8cbf7c9c0766b1f51373368bc3644b2c48c598f (patch)
tree8f39851783266425f25e5b031c8f0f2d5b8ca9c3
parent396b59f256d8cbf77d359a2b9677f9f7b1d0a021 (diff)
script now waits for the user to press the button
-rwxr-xr-xkeyboards/satan/keymaps/iso_split_rshift/build.sh28
1 files changed, 26 insertions, 2 deletions
diff --git a/keyboards/satan/keymaps/iso_split_rshift/build.sh b/keyboards/satan/keymaps/iso_split_rshift/build.sh
index 9523f6716f..6b4b4568f5 100755
--- a/keyboards/satan/keymaps/iso_split_rshift/build.sh
+++ b/keyboards/satan/keymaps/iso_split_rshift/build.sh
@@ -1,16 +1,40 @@
#!/bin/bash
# adjust for cpu
# -j 16 gave best result on a hyperthreaded quad core core i7
+
+LIMIT=10
THREADS="-j 16"
KMAP=iso_split_rshift
+
echo "We need sudo later"
sudo ls 2>&1 /dev/null
+
+function wait_bootloader {
+ echo "Waiting for Bootloader..."
+ local STARTTIME=$(date +"%s")
+ local REMIND=0
+ local EXEC=dfu-programmer
+ local TARGET=atmega32u4
+ while true
+ do
+ sudo $EXEC $TARGET get > /dev/null 2>&1
+ [ $? -eq 0 ] && break
+ ENDTIME=$(date +"%s")
+ DURATION=$(($ENDTIME-$STARTTIME))
+ if [ $REMIND -eq 0 -a $DURATION -gt $LIMIT ]
+ then
+ echo "Did you forget to press the reset button?"
+ REMIND=1
+ fi
+ sleep 1
+ done
+}
make clean
make KEYMAP=${KMAP} ${THREADS}
if [[ $? -eq 0 ]]
then
- echo "please trigger flashing! you have 5 seconds"
- sleep 5
+ echo "please trigger flashing!"
+ wait_bootloader
sudo make KEYMAP=${KMAP} dfu ${THREADS}
else
echo "make failed"