Arkadi Rafalovich / Mbed 2 deprecated TAU_ReSpeaker_Switch_V02

Dependencies:   mbed MbedJSONValue

Files at this revision

API Documentation at this revision

Comitter:
Arkadi
Date:
Thu Jul 12 10:11:04 2018 +0000
Parent:
7:9153b6566524
Child:
9:e893fa820315
Commit message:
minor changes - added debugging command

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Apr 09 14:37:12 2018 +0000
+++ b/main.cpp	Thu Jul 12 10:11:04 2018 +0000
@@ -1,6 +1,6 @@
 ////////////////////////////////////////
 //      Tau_ReSpeaker_Sitch_V01       //
-//  Arkadiraf@gmail.com - 09/04/2018  //
+//  Arkadiraf@gmail.com - 12/06/2018  //
 ////////////////////////////////////////
 /*
  json format: json:{"name":"auto"}                               - automatic mode
@@ -11,6 +11,7 @@
     Bugs:
     PA_14 and PA_13 are share with stlink - not available as interrupt pins
     Used in polling mode instead
+    didnt switch to spk 5 - changed spk limits in auto switch perhaps this was the issue.
 */
 /*
    Board : Nucleo STM32F446RE
@@ -98,6 +99,7 @@
 //#define DEBUG_MOD3   // switch handler
 //#define DEBUG_MOD4   // serial with dsp module
 //#define DEBUG_MOD10   // responsivity msges to gui
+bool debuggingEn = 0;
 
 #define MSG_BUFFER_SIZE 512
 #define HEADER_SIZE 5
@@ -296,7 +298,7 @@
     
     // simple selection mode
     micChannle = micEvent;
-    if ((micChannle >= 0) && (micChannle <= 4)) {// verify mic is in the limit
+    if ((micChannle >= 1) && (micChannle <= 5)) {// verify mic is in the limit
         spkChannle[micChannle-1] = 1;
     }
     
@@ -507,7 +509,9 @@
 
     // GUI message format Switch: {"name":"switch","mic":0, "spk": [0,1,0,0,0]}
     parse(guiCmd, json);
-
+    if (debuggingEn){
+        pc.printf("%s", json);
+    }
     // get target:
     targetName = guiCmd["name"].get<string>(); // switch / dsp
 
@@ -547,9 +551,13 @@
 {
     int micChannle = 0;
     bool spkChannle[5]= {0};
-
+    
+    // get debbug status
+    debuggingEn = guiCmd["debug"].get<int>();
+    
     // get mic channle
     micChannle = guiCmd["mic"].get<int>();
+    
     // get speakers output
     for (int ii=0 ; ii < 5 ; ii++) {
         spkChannle[ii] = guiCmd["spk"][ii].get<bool>();