just a test

Dependencies:   mbed

Fork of scoreLight_Advanced by Alvaro Cassinelli

Revision:
10:6f8e48dca1bd
Parent:
9:3321170d157c
Child:
11:62f7183a03e7
--- a/main.cpp	Wed Apr 11 13:06:23 2012 +0000
+++ b/main.cpp	Wed Apr 11 14:51:08 2012 +0000
@@ -16,7 +16,7 @@
 
 
 // To test the time it takes for executing one loop in the main program:
-#define LOOPTIMECOMPUTE
+//#define LOOPTIMECOMPUTE
 
 // To get serial commands (for debug, or other things using a Terminal - for instance, a laser scan)
 //#define SERIAL_COMMANDS
@@ -105,12 +105,12 @@
 
     // Tested modes:
     blobconf.clearConfig();
-  blobconf.addOneElasticLoopContractCentral();
-//  blobconf.addOneElasticContourFollowing();
+//    blobconf.addOneElasticLoopContractCentral();
+  blobconf.addOneElasticContourFollowing();
 
 //    blobconf.addOneRigidLoopBouncing();
 //  blobconf.addOneRigidLoopBouncing();
- //blobconf.addOneRigidLoopFollowing();
+//blobconf.addOneRigidLoopFollowing();
 
 
 //blobconf.addOneRigidLoopTest();
@@ -158,12 +158,14 @@
             // update config dynamics (this also could be threaded?):
             blobconf.update();
 
+
             // draw the config (note: each kind of blob renders differently)
             blobconf.draw();
 
             // __enable_irq();
 
             //     measureUpdatePeriod.start();
+
         }
 
 
@@ -177,16 +179,18 @@
         if (pc.readable()>0) processSerial();
 #endif
 
-        // (b)Sending Data: // PUT THIS IN AN INTERRUPT OR USE A TIMER!!! it may be TOO FAST...
-        // NOTE: better use a timer, so the only ISR "ticker" is the laser rendering (otherwise the laser rendering will be interrupted by the sending of data - the other way is ok):
-        if (measureSendPeriod.read_ms()>25) {
-            measureSendPeriod.stop();
-            measureSendPeriod.reset();
 
-            blobconf.sendConfData();
+            // (b)Sending Data: // PUT THIS IN AN INTERRUPT OR USE A TIMER!!! it may be TOO FAST...
+            // NOTE: better use a timer, so the only ISR "ticker" is the laser rendering (otherwise the laser rendering will be interrupted by the sending of data - the other way is ok):
+            if (measureSendPeriod.read_ms()>25) {
+                measureSendPeriod.stop();
+                measureSendPeriod.reset();
 
-            measureSendPeriod.start();
-        }
+                blobconf.sendConfData();
+
+                measureSendPeriod.start();
+            }
+
 
         // text:
         /*
@@ -205,10 +209,10 @@
             measureLoopPeriod.stop();
             sendMes.setTopAddress("/timeloop");
             sendMes.setSubAddress("/");
-          //  long x=(long)(int(measureLoopPeriod.read_us()/100.0));
+            //  long x=(long)(int(measureLoopPeriod.read_us()/100.0));
             // long x=(long)(blobconf.blobArray[0]->displaySensingBuffer.lsdTrajectory.size());
             // long x=(long)(blobconf.blobArray[0]->normRecenteringVector);
-             long x=(long)(1000*blobconf.blobArray[0]->displaySensingBuffer.lsdTrajectory[0].intensity);
+            long x=(long)(1000*blobconf.blobArray[0]->displaySensingBuffer.lsdTrajectory[0].intensity);
             sendMes.setArgs( "i", &x);
             osc.sendOsc( &sendMes );
             timeCounterNum=0;