Browse Source

Move Bootloader not found message to global variable (#6688)

* Move Bootloader not found message to global variable

* Apply suggestions from code review

Co-Authored-By: fauxpark <fauxpark@gmail.com>
Drashna Jaelre 5 years ago
parent
commit
44fd317a87
3 changed files with 4 additions and 3 deletions
  1. 1 0
      message.mk
  2. 2 2
      tmk_core/avr.mk
  3. 1 1
      tmk_core/chibios.mk

+ 1 - 0
message.mk

@@ -87,3 +87,4 @@ MSG_PYTHON_MISSING = $(WARN_COLOR)WARNING:$(NO_COLOR)\n \
 	Please run $(BOLD)util/qmk_install.sh$(NO_COLOR) to install all the dependencies QMK requires.\n\n
 	Please run $(BOLD)util/qmk_install.sh$(NO_COLOR) to install all the dependencies QMK requires.\n\n
 MSG_FLASH_BOOTLOADER = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's bootloader is not specified or is not supported by the \":flash\" target at this time.\n\n
 MSG_FLASH_BOOTLOADER = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's bootloader is not specified or is not supported by the \":flash\" target at this time.\n\n
 MSG_FLASH_ARCH = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's architecture is not supported by the \":flash\" target at this time.\n\n
 MSG_FLASH_ARCH = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's architecture is not supported by the \":flash\" target at this time.\n\n
+MSG_BOOTLOADER_NOT_FOUND = $(ERROR_COLOR)ERROR:$(NO_COLOR) Bootloader not found. Trying again in 5s.\n

+ 2 - 2
tmk_core/avr.mk

@@ -147,7 +147,7 @@ define EXEC_DFU
 		echo "Flashing '$(1)' for EE_HANDS split keyboard support." ;\
 		echo "Flashing '$(1)' for EE_HANDS split keyboard support." ;\
 	fi; \
 	fi; \
 	until $(DFU_PROGRAMMER) $(MCU) get bootloader-version; do\
 	until $(DFU_PROGRAMMER) $(MCU) get bootloader-version; do\
-		echo "Error: Bootloader not found. Trying again in 5s." ;\
+		printf "$(MSG_FLASH_BOOTLOADER)" ;\
 		sleep 5 ;\
 		sleep 5 ;\
 	done; \
 	done; \
 	if $(DFU_PROGRAMMER) --version 2>&1 | $(GREP) -q 0.7 ; then\
 	if $(DFU_PROGRAMMER) --version 2>&1 | $(GREP) -q 0.7 ; then\
@@ -252,7 +252,7 @@ define EXEC_BOOTLOADHID
 	# bootloadHid executable has no cross platform detect methods
 	# bootloadHid executable has no cross platform detect methods
 	# so keep running bootloadHid if the output contains "The specified device was not found"
 	# so keep running bootloadHid if the output contains "The specified device was not found"
 	until $(BOOTLOADHID_PROGRAMMER) -r $(BUILD_DIR)/$(TARGET).hex 2>&1 | tee /dev/stderr | grep -v "device was not found"; do\
 	until $(BOOTLOADHID_PROGRAMMER) -r $(BUILD_DIR)/$(TARGET).hex 2>&1 | tee /dev/stderr | grep -v "device was not found"; do\
-		echo "Error: Bootloader not found. Trying again in 5s." ;\
+		printf "$(MSG_FLASH_BOOTLOADER)" ;\
 		sleep 5 ;\
 		sleep 5 ;\
 	done
 	done
 endef
 endef

+ 1 - 1
tmk_core/chibios.mk

@@ -236,7 +236,7 @@ qmk: $(BUILD_DIR)/$(TARGET).bin
 
 
 define EXEC_DFU_UTIL
 define EXEC_DFU_UTIL
 	until $(DFU_UTIL) -l | grep -q "Found DFU"; do\
 	until $(DFU_UTIL) -l | grep -q "Found DFU"; do\
-		echo "Error: Bootloader not found. Trying again in 5s." ;\
+		printf "$(MSG_FLASH_BOOTLOADER)" ;\
 		sleep 5 ;\
 		sleep 5 ;\
 	done
 	done
 	$(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin
 	$(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin