diff --git a/Makefile b/Makefile index 57735f2..7629957 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,8 @@ RM = rm BIN = bin SRC = ${PROJECT_NAME} +TARGET=$(shell ${ARDUINO-CLI} board list | grep arduino:avr:leonardo | awk '{print $$1}') + # credit: kenorb # https://stackoverflow.com/questions/18136918/how-to-get-current-relative-directory-of-your-makefile CWD := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))) @@ -45,4 +47,9 @@ compile: upload: compile cd ${CWD} - ${ARDUINO-CLI} upload --fqbn arduino:avr:leonardo --input-dir ${BIN} -p ${TARGET} ${PROJECT_NAME} + @if [ "$(strip ${TARGET})" = "" ]; then\ + echo Arduboy could not be found. Is it plugged in and turned on\?;\ + exit 1;\ + else\ + ${ARDUINO-CLI} upload --fqbn arduino:avr:leonardo --input-dir ${BIN} -p ${TARGET} ${PROJECT_NAME};\ + fi diff --git a/Template.sublime-project b/Template.sublime-project index 24db303..5aeeebd 100644 --- a/Template.sublime-project +++ b/Template.sublime-project @@ -4,5 +4,12 @@ { "path": "." } + ], + "build_systems": + [ + { + "name": "Make - Upload", + "cmd": [ "make", "upload" ] + } ] }