From 50b1fe9eb3831999eb7d0b36ba0737e91dd23739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20St=C3=A4ck?= Date: Mon, 24 Jun 2019 15:00:00 +0200 Subject: [PATCH 1/6] Check for correct target platform and USB type --- NuEVI/NuEVI.ino | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NuEVI/NuEVI.ino b/NuEVI/NuEVI.ino index e4de329..3420666 100644 --- a/NuEVI/NuEVI.ino +++ b/NuEVI/NuEVI.ino @@ -38,6 +38,14 @@ PROGRAMME FUNCTION: EVI Wind Controller using the Freescale MP3V5004GP breath // A note is sounding #define NOTE_ON 3 +//Make sure compiler is set to the appropriate platform +#ifndef __MK20DX256__ + #error "Wrong target platform. Please set to Teensy 3.1/3.2 (MK20DX256)." +#endif + +#ifndef USB_MIDI + #error "USB_MIDI not enabled. Please set USB type to include MIDI." +#endif //_______________________________________________________________________________________________ DECLARATIONS From d04c0f92f8e98fe5cff077935dab53fa1213caaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20St=C3=A4ck?= Date: Mon, 24 Jun 2019 15:00:42 +0200 Subject: [PATCH 2/6] Use TEENSYDUINO to determine version rather than making our own --- NuEVI/hardware.h | 4 ---- NuEVI/midi.cpp | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/NuEVI/hardware.h b/NuEVI/hardware.h index 59027ce..cbe9a75 100644 --- a/NuEVI/hardware.h +++ b/NuEVI/hardware.h @@ -3,10 +3,6 @@ #define REVB -//Comment out the following line if you have Teensyduino 1.4.0 or earlier, to make pitch bend over USB-MIDI work. -#define NEWTEENSYDUINO - - // Pin definitions // Teensy pins diff --git a/NuEVI/midi.cpp b/NuEVI/midi.cpp index 75a36ca..fc05554 100644 --- a/NuEVI/midi.cpp +++ b/NuEVI/midi.cpp @@ -44,7 +44,7 @@ void midiSendAfterTouch(uint8_t value) { void midiSendPitchBend(uint16_t value) { - #if defined(NEWTEENSYDUINO) + #if (TEENSYDUINO > 140) usbMIDI.sendPitchBend(value-8192, midiChannel); // newer teensyduino "pitchBend-8192" older just "pitchBend"... strange thing to change #else usbMIDI.sendPitchBend(value, midiChannel); From 0bbfdda24121bd569268c673b343ba1d741d9f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20St=C3=A4ck?= Date: Mon, 24 Jun 2019 15:03:02 +0200 Subject: [PATCH 3/6] No need for user to set NEWTEENSYDUINO --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index b01f72f..c8f04fb 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,6 @@ and then add that in the Arduino IDE (under Sketch -> Include Library -> Add .ZI Open NuEVI.ino in the Arduino IDE. Under "Tools -> Board", select "Teensy 3.2 / 3.1". Then set "Tools -> USB Type" to "MIDI". -If you have Teensyduino 1.4.0 or earlier, you also need to change an option in the code. In the -Arduino Editor (where you have NuEVI.ino open), comment out the line with `#define NEWTEENSYDUINO`. If -this does not match the Teensyduino version, pitch bend over USB-MIDI will not work properly. - ### Building and uploading Connect the NuEVI via USB to your computer, open the Teensy application and make sure the "Auto" From b6ed8126b7c530bc8357b76d1fe573e985042fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20St=C3=A4ck?= Date: Mon, 24 Jun 2019 15:38:29 +0200 Subject: [PATCH 4/6] Allow midi+serial usb type too (useful for "console debugging") --- NuEVI/NuEVI.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NuEVI/NuEVI.ino b/NuEVI/NuEVI.ino index 3420666..270cca0 100644 --- a/NuEVI/NuEVI.ino +++ b/NuEVI/NuEVI.ino @@ -43,8 +43,8 @@ PROGRAMME FUNCTION: EVI Wind Controller using the Freescale MP3V5004GP breath #error "Wrong target platform. Please set to Teensy 3.1/3.2 (MK20DX256)." #endif -#ifndef USB_MIDI - #error "USB_MIDI not enabled. Please set USB type to include MIDI." +#if !defined(USB_MIDI) && !defined(USB_MIDI_SERIAL) + #error "USB MIDI not enabled. Please set USB type to 'MIDI' or 'Serial + MIDI'." #endif From 6c1c5e0344e0442457b5fe377c5242083daf7e23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20St=C3=A4ck?= Date: Mon, 24 Jun 2019 15:39:13 +0200 Subject: [PATCH 5/6] More explicit version checking --- NuEVI/midi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuEVI/midi.cpp b/NuEVI/midi.cpp index fc05554..a3dbd92 100644 --- a/NuEVI/midi.cpp +++ b/NuEVI/midi.cpp @@ -44,7 +44,7 @@ void midiSendAfterTouch(uint8_t value) { void midiSendPitchBend(uint16_t value) { - #if (TEENSYDUINO > 140) + #if (TEENSYDUINO >= 141) usbMIDI.sendPitchBend(value-8192, midiChannel); // newer teensyduino "pitchBend-8192" older just "pitchBend"... strange thing to change #else usbMIDI.sendPitchBend(value, midiChannel); From b0ad50476188f1b1793f6b10fb2e7408dc0fdc05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20St=C3=A4ck?= Date: Mon, 24 Jun 2019 15:39:36 +0200 Subject: [PATCH 6/6] Fake some useful compiler flags --- simulation/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulation/Makefile b/simulation/Makefile index d960a6c..88eae87 100644 --- a/simulation/Makefile +++ b/simulation/Makefile @@ -2,7 +2,7 @@ CC=clang CXX=clang++ CFLAGS=-Wall -Wextra -Wpedantic -Wno-gnu -mmacosx-version-min=10.9 -F/Library/Frameworks -CFLAGS += -DARDUINO=10808 -D__MK20DX256__ +CFLAGS += -DARDUINO=10808 -DTEENSYDUINO=146 -D__MK20DX256__ -DUSB_MIDI RELEASE ?= 0 ifeq ($(RELEASE), 1)