From 66b782da1617335c30f7a57dd46c44a916871181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20St=C3=A4ck?= Date: Sat, 20 Jul 2019 09:45:40 +0200 Subject: [PATCH] Menu option to set midibeam power level --- NuEVI/NuEVI.ino | 2 ++ NuEVI/globals.h | 2 ++ NuEVI/menu.cpp | 11 +++++++++++ NuEVI/midi.cpp | 24 ++++++++++++++++++++++++ NuEVI/midi.h | 5 +++++ 5 files changed, 44 insertions(+) diff --git a/NuEVI/NuEVI.ino b/NuEVI/NuEVI.ino index 8784f18..23b5ba2 100644 --- a/NuEVI/NuEVI.ino +++ b/NuEVI/NuEVI.ino @@ -90,6 +90,8 @@ uint16_t gateOpenEnable = 0; uint16_t specialKeyEnable = 0; +uint16_t wlPower = 0; + int touch_Thr = 1300; byte ccList[11] = {0,1,2,7,11,1,2,7,11,74,20}; // OFF, Modulation, Breath, Volume, Expression (then same sent in hires), CC74 (cutoff/brightness), CC20 (UNO Cutoff) diff --git a/NuEVI/globals.h b/NuEVI/globals.h index 2659559..56d0c41 100644 --- a/NuEVI/globals.h +++ b/NuEVI/globals.h @@ -73,6 +73,8 @@ extern byte currentRotation; extern uint16_t rotations[4]; extern uint16_t parallel; // semitones +extern uint16_t wlPower; + extern int touch_Thr; extern unsigned long cursorBlinkTime; // the last time the cursor was toggled diff --git a/NuEVI/menu.cpp b/NuEVI/menu.cpp index 79cf41c..a7c911b 100644 --- a/NuEVI/menu.cpp +++ b/NuEVI/menu.cpp @@ -501,11 +501,22 @@ const MenuEntrySub specialKeyMenu = { , nullptr }; + +const MenuEntrySub wlPowerMenu = { + MenuType::ESub, "WL POWER", "WL POWER", &wlPower, 0, 3, MenuEntryFlags::ENone, + [](SubMenuRef __unused, char* out, const char** __unused unit) { + numToString(-6*wlPower, out, true); + }, + [](SubMenuRef __unused) { sendWLPower(wlPower); } + , nullptr +}; + const MenuEntry* extrasMenuEntries[] = { (MenuEntry*)&legacyPBMenu, (MenuEntry*)&legacyBRMenu, (MenuEntry*)&gateOpenMenu, (MenuEntry*)&specialKeyMenu, + (MenuEntry*)&wlPowerMenu, }; const MenuPage extrasMenuPage = { diff --git a/NuEVI/midi.cpp b/NuEVI/midi.cpp index a3dbd92..8a49feb 100644 --- a/NuEVI/midi.cpp +++ b/NuEVI/midi.cpp @@ -140,3 +140,27 @@ void dinMIDIsendAfterTouch(uint8_t value, uint8_t ch) { void dinMIDIsendProgramChange(uint8_t value, uint8_t ch) { midiSend2B((0xC0 | ch), value); } + +void dinMIDIsendSysex(const uint8_t data[], const uint8_t length) { + MIDI_SERIAL.write(0xF0); //Sysex command + for(int i=0; i3) return; //Don't send invalid values + + buf[5] = level; + dinMIDIsendSysex(buf, 6); + +} \ No newline at end of file diff --git a/NuEVI/midi.h b/NuEVI/midi.h index 4d915cf..2b2e85f 100644 --- a/NuEVI/midi.h +++ b/NuEVI/midi.h @@ -28,5 +28,10 @@ void dinMIDIsendNoteOff(uint8_t note, uint8_t vel, uint8_t ch); void dinMIDIsendAfterTouch(uint8_t value, uint8_t ch); void dinMIDIsendProgramChange(uint8_t value, uint8_t ch); void dinMIDIsendPitchBend(uint16_t pb, uint8_t ch); +void dinMIDIsendSysex(const uint8_t data[], const uint8_t length); + + + +void sendWLPower(const uint8_t level); #endif