Laser Sensing Display for UI interfaces in the real world

Dependencies:   mbed

Fork of skinGames_forktest by Alvaro Cassinelli

Revision:
33:43e8bc451ef0
Parent:
32:52273c3291fe
Child:
34:1244fa3f2559
--- a/main.cpp	Mon Oct 29 14:28:47 2012 +0000
+++ b/main.cpp	Mon Nov 05 06:08:35 2012 +0000
@@ -290,6 +290,10 @@
                 blobconf.allSetColor(value);
     }
     }
+    
+    else if ( !strcmp(address[0], "setAllRandomColor" ) ) {
+            blobconf.randomizeAllColors();
+    }
 
     else if ( !strcmp(address[0], "setAllGreenColor" ) ) {
         int value=data[0];
@@ -530,6 +534,15 @@
 
     // (III) ========================================= Loop control (parameters, etc) ===========================================
  
+     else if (!strcmp( address[0], "setSpeed" ) ) {
+      int value=data[0]; // value 1 means a speed of 0.1, value 10, a speed of 1, etc. 
+      if (value!=-1) { // otherwise do nothing, this is a reception error (there was no data)
+            for (int i=0; i< blobconf.numBlobs; i++) {
+                //if ((!strcmp(blobconf.blobArray[i].spotName, "rigid_following"))||(!strcmp(blobconf.blobArray[i].spotName, "rigid_following"))) {
+                blobconf.blobArray[i]->setSpeed((float)(0.1*value));
+            }
+      }
+    }
     else if (!strcmp( address[0], "speedFactor" ) ) {
       int value=data[0]; // value 100 means no change of speed. 200 is twice as fast, 50 is half as fast. 
       if (value!=-1) { // otherwise do nothing, this is a reception error (there was no data)
@@ -540,13 +553,19 @@
       }
     }
     
-  else if (!strcmp( address[0], "sizeFactor" ) ) {
-      int value=data[0]; // value 100 means no change of sice. 200 is twice as big, 50 is half as big. 
+      else if (!strcmp( address[0], "setSize" ) ) {
+      int value=data[0]; // this is the direct size of the scafold
       if (value!=-1) { // otherwise do nothing, this is a reception error (there was no data)     
-          for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->sizeFactor((float)(1.0*value/100.0));
+          for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->setSize((float)(1.0*value));
       }
     }
-    
+      else if (!strcmp( address[0], "sizeFactor" ) ) {
+          int value=data[0]; // value 100 means no change of sice. 200 is twice as big, 50 is half as big. 
+          if (value!=-1) { // otherwise do nothing, this is a reception error (there was no data)     
+              for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->sizeFactor((float)(1.0*value/100.0));
+          }
+        }
+        
     // ADJUST MIRROR ANGLE CORRECTION:
     else if (!strcmp( address[0], "adjustPlusAngle" ) ) {
       int value=data[0]; // this is not a factor, but an additive quantity to the current delay
@@ -568,8 +587,20 @@
       }
     }
 
-// ADJUST MIN CONTRAST RATIO 
-// (1) using multiplicative factor:
+    
+ // THRESHOLD MODE, and PARAMETERS:
+    //(1) using multiplicative factor:
+    else if (!strcmp( address[0], "autoThreshold" ) ) {
+      int value=data[0]; // value 100 means no change of the current contrast value. 200 means a min contrast 
+      // that is twice as large and 50 is half as large as before. 
+      if (value!=-1) { // otherwise do nothing, this is a reception error (there was no data)     
+        for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->displaySensingBuffer.setThresholdMode(value);
+      }
+    } 
+    
+ // (a) AUTO THRESHOLD:
+ // MINIMUM CONTRAST RATIO:
+ // (1) using multiplicative factor:
     else if (!strcmp( address[0], "adjustMultContrast" ) ) {
       int value=data[0]; // value 100 means no change of the current contrast value. 200 means a min contrast 
       // that is twice as large and 50 is half as large as before. 
@@ -584,8 +615,7 @@
         for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->displaySensingBuffer.setMinContrastRatio((float)(1.0*value/100.0));
       }
     }
-    
- // ADJUST THRESHOLD RATIO:
+    // THESHOLD FACTOR: 
     //(1) using multiplicative factor:
     else if (!strcmp( address[0], "adjustMultThreshold" ) ) {
       int value=data[0]; // value 100 means no change of the current contrast value. 200 means a min contrast 
@@ -601,7 +631,7 @@
         for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->displaySensingBuffer.setThresholdFactor((float)(1.0*value/100.0));
       }
     } 
-    
+    // MINIMUM ACCEPTABLE INTENSITY: 
     // Adjust minimum acceptable intensity:
      else if (!strcmp( address[0], "adjustMinAcceptableIntensity" ) ) {
       int value=data[0]; // value is DIRECT value (0 to 255)
@@ -610,6 +640,17 @@
       }
     } 
     
+   // (b) FIXED THRESHOLD: 
+    // Adjust fixedThreshold (directly):
+     else if (!strcmp( address[0], "adjustFixedThreshold" ) ) {
+      int value=data[0]; // value is DIRECT value (0 to 255)
+      if (value!=-1) { // otherwise do nothing, this is a reception error (there was no data)     
+        for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->displaySensingBuffer.setFixedThreshold(value);
+      }
+    } 
+    
+
+    
  // ===================== SEND DATA MODES =======================
  
     else if (!strcmp( address[0], "sendOSC" ) ) {