Commits

Gordon McGregor  committed 2b3a22d

SysEx reprogramming working for switch configuration

  • Participants
  • Parent commits f63734d

Comments (0)

Files changed (3)

File bank_config.pde

  0 reconfigure 
  1 reset to default
  2 store config 0xCMD 0xCONFIG_BANK
- 3 store config 0xCMD 0xCONFIG_BANK
+ 3 restore config 0xCMD 0xCONFIG_BANK
  
  Reconfigure switch command : 
  Bank # [0 or 1]       1 byte
  see SysEx in action and will soon realize that there is no mystery to SysEx after all. 
  */
 
-
-
-
-
 void setup_default_bank() {
 
   for (int b = 0 ; b < MAX_BANKS; b++) {
 
 
 void reconfig_command(byte * data, byte size) {
-  indicate_error();
+  if (size != 13 ) {
+    indicate_error();
+  }
+
+  int bank, channel;
+
+  bank = data[3];
+  channel = data[4];
+
+  // 0xF0 0x78 0xCMD 0xBANK 0xSWITCH 0xTOGGLE 0xS00 0xS01 0xS02 0xS10 0xS11 0xS12 0xF7
+  banks.bank[ bank ].switches[ channel ].toggle_not_immediate = data[5];
+  banks.bank[ bank ].switches[ channel ].messages[0][0] = data[6];   
+  banks.bank[ bank ].switches[ channel ].messages[0][1] = data[7];
+  banks.bank[ bank ].switches[ channel ].messages[0][2] = data[8];
+  banks.bank[ bank ].switches[ channel ].messages[1][0] = data[9];   
+  banks.bank[ bank ].switches[ channel ].messages[1][1] = data[10];
+  banks.bank[ bank ].switches[ channel ].messages[1][2] = data[11];
 }
 
 void store_bank(byte * data, int size){
-  indicate_error();
+  if (size != 5 ) {
+    indicate_error();
+  }
+  // 2 store config 0xCMD 0xCONFIG_BANK
+}
 
-}
 void retrive_bank(byte * data, int size) {
-  indicate_error();
+  if (size != 5) {
+    indicate_error();
+  }
+  // 3 restore config 0xCMD 0xCONFIG_BANK
 }
 
 void handle_system_exclusive_midi(byte * data, byte size) {
-
   if (data[1] != MIDI_DEVICE_ID) {
     indicate_error();
     return;
   if (size < 4) {
     indicate_error();
     return;
+  }
 
-    switch (data[2]) {
-    case CMD_RECONFIG :  
-      reconfig_command(data, size);
-      break;
-    case CMD_RESET: 
-      setup_default_bank();
-      break;
-    case CMD_STORE: 
-      store_bank(data, size);
-      break;
-    case CMD_RETRIVE: 
-      retrive_bank(data, size);
-      break;
-    default: 
-      indicate_error();
-      break;
-    }
+  switch (data[2]) {
+  case CMD_RECONFIG :  
+    reconfig_command(data, size);
+    break;
+  case CMD_RESET: 
+    setup_default_bank();
+    break;
+  case CMD_STORE: 
+    store_bank(data, size);
+    break;
+  case CMD_RETRIVE: 
+    retrive_bank(data, size);
+    break;
+  default: 
+    indicate_error();
+    break;
   }
 }
 
+
+
+

File faux_vox.pde

+/* 
+
+TODOs: SysEx reconfig now working
+Need MIDI commands to support variable length send
+Need nicer programming tool for host end (yaml -> SysEx programmer
+Need to implement EEPROM storage
+Need to implement switch based bank selection
+*/
+
 #include <MIDI.h>
 #include <EEPROM.h>
 #include <stdio.h>

File midi_tester.py

   # drop to console for test with python -i 
   a = Arduino('/dev/tty.usbmodem24371', 31250)
 
-#  while (1):
-#    command = a.read(3)
-#    print hex(ord(command[0])), hex(ord(command[1])), hex(ord(command[2]))
+  cnt = 0
 
+  while (1):
+    command = a.read(3)
+    print hex(ord(command[0])), hex(ord(command[1])), hex(ord(command[2]))
+    if(cnt == 0):
+      a.send('\xf0\x78\x00\x01\x00\x00\xb1\x02\x63\xb1\x03\x61\xf7')
+      cnt = 1
+