Simple USB-MIDI foot controller

Dependencies:   PinDetect USBDevice_STM32F103 mbed-STM32F103C8T6

Revision:
12:d9ccbfd2cc8c
Parent:
11:ff22140b5119
Child:
13:f9eb1f79cd0a
--- a/main.cpp	Fri Aug 04 07:23:38 2017 +0200
+++ b/main.cpp	Fri Aug 04 07:33:32 2017 +0200
@@ -45,15 +45,15 @@
     if (msg.data[1] == 0xF0 && msg.data[2] == 0x7D && msg.data[11] == 0xF7) {
         sw = msg.data[3];
         if (sw < NUM_SWITCHES) {
-            switches[sw].type = msg.data[4];
-            switches[sw].channel = msg.data[5];
-            switches[sw].data1 = msg.data[6];
+            switches[sw].type = msg.data[4] & 0xF;
+            switches[sw].channel = msg.data[5] & 0xF;
+            switches[sw].data1 = msg.data[6] & 0x7F;
             if (msg.data[7] > 0)
-                switches[sw].on_value = msg.data[8];
+                switches[sw].on_value = msg.data[8] & 0x7F;
             else
                 switches[sw].on_value = -1;
             if (msg.data[9] > 0)
-                switches[sw].off_value = msg.data[10];
+                switches[sw].off_value = msg.data[10] & 0x7F;
             else
                 switches[sw].off_value = -1;
             handlers[sw]->setConfig(switches[sw]);