From 47279088c4805b9da6edc6cc0652f314b259e313 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Fri, 15 Jul 2022 18:00:11 -0400 Subject: layout: implement layout toggle --- HexBoard_V1.ino | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/HexBoard_V1.ino b/HexBoard_V1.ino index 1e3b3c0..99737e8 100644 --- a/HexBoard_V1.ino +++ b/HexBoard_V1.ino @@ -242,17 +242,17 @@ void playNotes() { if (activeButtons[i] == 1) // If the button is active (newpress) { - if (wickiHaydenLayout[i] < 128) { - noteOn(midiChannel, (wickiHaydenLayout[i] + octave) % 128 , velocity); + if (currentLayout[i] < 128) { + noteOn(midiChannel, (currentLayout[i] + octave) % 128 , velocity); } else { - commandPress(wickiHaydenLayout[i]); + commandPress(currentLayout[i]); } } else { // If the button is inactive (released) - if (wickiHaydenLayout[i] < 128) { - noteOff(midiChannel, (wickiHaydenLayout[i] + octave) % 128, 0); + if (currentLayout[i] < 128) { + noteOff(midiChannel, (currentLayout[i] + octave) % 128, 0); } else { - commandRelease(wickiHaydenLayout[i]); + commandRelease(currentLayout[i]); } } } @@ -288,6 +288,15 @@ void commandPress(byte command) octave += 12; setOctLED(); leds[octUpSW] = CRGB::White; } + } else if (command == LAY_MD) { + if (currentLayout == wickiHaydenLayout) { + currentLayout = harmonicTableLayout; + } else if (currentLayout == harmonicTableLayout) { + currentLayout = gerhardLayout; + } else { + currentLayout = wickiHaydenLayout; + } + setLayoutLED(); } } void commandRelease(byte command) -- cgit 1.4.1