about summary refs log tree commit diff
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2022-07-15 18:00:11 -0400
committerZach DeCook <zachdecook@librem.one>2022-07-15 18:00:11 -0400
commit47279088c4805b9da6edc6cc0652f314b259e313 (patch)
tree38d9adeb4ef81fd20f19a5a78e68257ca1eb2523
parent71e8333fcdeb5786baa84fa529d269ba4a86853f (diff)
downloadHexBoard-47279088c4805b9da6edc6cc0652f314b259e313.tar.gz
layout: implement layout toggle
-rw-r--r--HexBoard_V1.ino21
1 files 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)