Laser Sensing Display for UI interfaces in the real world

Dependencies:   mbed

Fork of skinGames_forktest by Alvaro Cassinelli

Committer:
mbedalvaro
Date:
Wed Oct 16 16:14:27 2013 +0000
Revision:
40:3ba2b0ea9f33
Child:
43:1dd4cfc30788
ca compile

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedalvaro 40:3ba2b0ea9f33 1 #include "laserSensingDisplay.h"
mbedalvaro 40:3ba2b0ea9f33 2
mbedalvaro 40:3ba2b0ea9f33 3 laserSensingDisplay lsd; // pre-instantiated cross-file global object
mbedalvaro 40:3ba2b0ea9f33 4
mbedalvaro 40:3ba2b0ea9f33 5 // The constructor:
mbedalvaro 40:3ba2b0ea9f33 6 laserSensingDisplay::laserSensingDisplay()
mbedalvaro 40:3ba2b0ea9f33 7 {
mbedalvaro 40:3ba2b0ea9f33 8 // pointDisplayCounter=65535;
mbedalvaro 40:3ba2b0ea9f33 9 runningState=false;// this is important for the FIRST time (could be better in an "init" function?).
mbedalvaro 40:3ba2b0ea9f33 10 }
mbedalvaro 40:3ba2b0ea9f33 11
mbedalvaro 40:3ba2b0ea9f33 12 void laserSensingDisplay::run() // start the ticker on laserDisplayThread
mbedalvaro 40:3ba2b0ea9f33 13 {
mbedalvaro 40:3ba2b0ea9f33 14 timerForRendering.attach(this, &laserSensingDisplay::laserDisplayThread, RENDER_INTERVAL); // the address of the object, member function, and interval (in seconds)
mbedalvaro 40:3ba2b0ea9f33 15 runningState=true;
mbedalvaro 40:3ba2b0ea9f33 16 }
mbedalvaro 40:3ba2b0ea9f33 17
mbedalvaro 40:3ba2b0ea9f33 18 void laserSensingDisplay::stop() // stop the ticker on laserDisplayThread
mbedalvaro 40:3ba2b0ea9f33 19 {
mbedalvaro 40:3ba2b0ea9f33 20 timerForRendering.detach();
mbedalvaro 40:3ba2b0ea9f33 21 runningState=false;
mbedalvaro 40:3ba2b0ea9f33 22 }
mbedalvaro 40:3ba2b0ea9f33 23
mbedalvaro 40:3ba2b0ea9f33 24 bool laserSensingDisplay::isRunning()
mbedalvaro 40:3ba2b0ea9f33 25 {
mbedalvaro 40:3ba2b0ea9f33 26 return(runningState);
mbedalvaro 40:3ba2b0ea9f33 27 }
mbedalvaro 40:3ba2b0ea9f33 28
mbedalvaro 40:3ba2b0ea9f33 29 void laserSensingDisplay::setSceneToDisplay(Scene* ptScene)
mbedalvaro 40:3ba2b0ea9f33 30 {
mbedalvaro 40:3ba2b0ea9f33 31 //Note: if the scene is recreated, it is important to first stop the displaying, and call to this function again, and only then re-attach the interrupt
mbedalvaro 40:3ba2b0ea9f33 32
mbedalvaro 40:3ba2b0ea9f33 33 ptSceneToDisplay=ptScene;
mbedalvaro 40:3ba2b0ea9f33 34 totalObjects=ptSceneToDisplay->totalObjects();
mbedalvaro 40:3ba2b0ea9f33 35
mbedalvaro 40:3ba2b0ea9f33 36 // overlap display to avoid deformed saccade and give time to the mirrors to be well in the saccade trajectory
mbedalvaro 40:3ba2b0ea9f33 37 // NOTE: ideally, numOverlapPoints depends on the number of points of EACH blob, as well as the distance between the spots.
mbedalvaro 40:3ba2b0ea9f33 38 // But for the time being, this will be a fixed quantity (DEFAULT_OVERLAP_POINTS).
mbedalvaro 40:3ba2b0ea9f33 39 if (totalObjects>1) numOverlapPoints=DEFAULT_OVERLAP_POINTS;
mbedalvaro 40:3ba2b0ea9f33 40 else numOverlapPoints=0;
mbedalvaro 40:3ba2b0ea9f33 41
mbedalvaro 40:3ba2b0ea9f33 42 configTotalPoints=ptSceneToDisplay->totalPoints();
mbedalvaro 40:3ba2b0ea9f33 43 // configTotalPoints contains the number of points of the config, and will be used to ensure that a FULL DISPLAY has been done BEFORE updating and "re-drawing" the trajectory in the buffer,
mbedalvaro 40:3ba2b0ea9f33 44 // wherever the current point being displayed when we start the update/draw.
mbedalvaro 40:3ba2b0ea9f33 45 // pointDisplayCounter=0;
mbedalvaro 40:3ba2b0ea9f33 46
mbedalvaro 40:3ba2b0ea9f33 47 // Set time counters to 0:
mbedalvaro 40:3ba2b0ea9f33 48 // NOTE: the waiting times (normal, start and end point) can be OBJECT dependent. This may be a nice future (TO DO?).
mbedalvaro 40:3ba2b0ea9f33 49 waitFirst=0;
mbedalvaro 40:3ba2b0ea9f33 50 waitFirstLaser=0;
mbedalvaro 40:3ba2b0ea9f33 51 waitNormal=0;
mbedalvaro 40:3ba2b0ea9f33 52 waitLaser=0;
mbedalvaro 40:3ba2b0ea9f33 53 waitLast=0;
mbedalvaro 40:3ba2b0ea9f33 54
mbedalvaro 40:3ba2b0ea9f33 55 // IMPORTANT: we have to start like this:
mbedalvaro 40:3ba2b0ea9f33 56 stateLsd=START_FIRST_OBJECT;
mbedalvaro 40:3ba2b0ea9f33 57 }
mbedalvaro 40:3ba2b0ea9f33 58
mbedalvaro 40:3ba2b0ea9f33 59 bool laserSensingDisplay::isDisplayingOver()
mbedalvaro 40:3ba2b0ea9f33 60 {
mbedalvaro 40:3ba2b0ea9f33 61 return(displayingFinished); // the value of displayingFinished will become true when the renderer finished displaying all points of all objects.
mbedalvaro 40:3ba2b0ea9f33 62 }
mbedalvaro 40:3ba2b0ea9f33 63
mbedalvaro 40:3ba2b0ea9f33 64 void laserSensingDisplay::startDisplayCheck()
mbedalvaro 40:3ba2b0ea9f33 65 {
mbedalvaro 40:3ba2b0ea9f33 66 displayingFinished=false; // we set it to false, wherever we where in the displaying process; when it becomes true, it means we had
mbedalvaro 40:3ba2b0ea9f33 67 // completed at least one full display of the unchanged scene.
mbedalvaro 40:3ba2b0ea9f33 68 }
mbedalvaro 40:3ba2b0ea9f33 69
mbedalvaro 40:3ba2b0ea9f33 70 // THE CORE OF THE DISPLAYING ENGINE:
mbedalvaro 40:3ba2b0ea9f33 71 // Note: this routine should run in a thread - but in fact it is running in an interrupt routine for the time being.
mbedalvaro 40:3ba2b0ea9f33 72 void laserSensingDisplay::laserDisplayThread()
mbedalvaro 40:3ba2b0ea9f33 73 {
mbedalvaro 40:3ba2b0ea9f33 74 // For tests:
mbedalvaro 40:3ba2b0ea9f33 75 myLed1=!myLed1;
mbedalvaro 40:3ba2b0ea9f33 76 // pc.printf("Point nb: %d\n", currentPoint);// does serial works in the interrupt?
mbedalvaro 40:3ba2b0ea9f33 77
mbedalvaro 40:3ba2b0ea9f33 78 switch (stateLsd) {
mbedalvaro 40:3ba2b0ea9f33 79 case NORMAL_POINT:
mbedalvaro 40:3ba2b0ea9f33 80 if (currentPoint<currentTotalPoints+numOverlapPoints) { // Attention: use modulo currentTotalPoints when accessing trajectory index.
mbedalvaro 40:3ba2b0ea9f33 81 if (waitNormal==0) { // Send mirrors position the first time (note: I don't put this inside the waitNormal<WAIT_NORMAL, because WAIT_NORMAL can be 0!
mbedalvaro 40:3ba2b0ea9f33 82 uint8_t currentPointWrap=currentPoint%currentTotalPoints;
mbedalvaro 40:3ba2b0ea9f33 83 x= ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.lsdTrajectory[currentPointWrap].v2.x;
mbedalvaro 40:3ba2b0ea9f33 84 y= ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.lsdTrajectory[currentPointWrap].v2.y;
mbedalvaro 40:3ba2b0ea9f33 85
mbedalvaro 40:3ba2b0ea9f33 86 IO.writeOutX(x);
mbedalvaro 40:3ba2b0ea9f33 87 IO.writeOutY(y);
mbedalvaro 40:3ba2b0ea9f33 88 // for tests:
mbedalvaro 40:3ba2b0ea9f33 89 // pc.printf("%d - %d\n", x, y);// does serial works in the interrupt?
mbedalvaro 40:3ba2b0ea9f33 90 }
mbedalvaro 40:3ba2b0ea9f33 91 if (waitNormal<WAIT_NORMAL) {
mbedalvaro 40:3ba2b0ea9f33 92 waitNormal++;// wait a little to correct for mirror delay (note: the mirror effective waiting time is WAIT_NORMAL + WAIT_LASER)
mbedalvaro 40:3ba2b0ea9f33 93 } else { // if we got here, it means the mirrors are well positionned: activate laser:
mbedalvaro 40:3ba2b0ea9f33 94 if ((waitLaser==0)&&(currentPoint>numOverlapPoints)) { // change laser output the first time:
mbedalvaro 40:3ba2b0ea9f33 95 #ifdef SENSING_LASER_BLANKING
mbedalvaro 40:3ba2b0ea9f33 96 IO.setLaserLockinPower(1);
mbedalvaro 40:3ba2b0ea9f33 97 #endif
mbedalvaro 40:3ba2b0ea9f33 98 #ifndef debugDelayMirrors
mbedalvaro 40:3ba2b0ea9f33 99 IO.setRGBPower(currentColor);
mbedalvaro 40:3ba2b0ea9f33 100 #else // TEST MODE for delay using blue laser:
mbedalvaro 40:3ba2b0ea9f33 101 uint8_t delayedPoint=(currentPoint+currentTotalPoints-ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.delayMirrorSamples)%currentTotalPoints;
mbedalvaro 40:3ba2b0ea9f33 102 if ( ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.lsdTrajectory[delayedPoint].lightZone<0) { // note: we use PREVIOUS sensing - so as not to wait again for
mbedalvaro 40:3ba2b0ea9f33 103 //IO.setRGBPower((currentColor&0x02)|0x04); // RED always on, BLUE OFF (and green whatever it was)
mbedalvaro 40:3ba2b0ea9f33 104 // Note: better not use complicated calls?
mbedalvaro 40:3ba2b0ea9f33 105 IO.setRGBPower(currentColor|0x02); // add blue (if blue was on, nothing happens...)
mbedalvaro 40:3ba2b0ea9f33 106 } else {
mbedalvaro 40:3ba2b0ea9f33 107 IO.setGreenPower(currentColor);
mbedalvaro 40:3ba2b0ea9f33 108 }
mbedalvaro 40:3ba2b0ea9f33 109 #endif
mbedalvaro 40:3ba2b0ea9f33 110 }
mbedalvaro 40:3ba2b0ea9f33 111 if (waitLaser<WAIT_LASER) {
mbedalvaro 40:3ba2b0ea9f33 112 waitLaser++; // increment wait laser counter
mbedalvaro 40:3ba2b0ea9f33 113 } else { // If we got here, it means that mirrors and laser power are both properly set:
mbedalvaro 40:3ba2b0ea9f33 114
mbedalvaro 40:3ba2b0ea9f33 115 // READ the intensity and move to the next point:
mbedalvaro 40:3ba2b0ea9f33 116 uint8_t currentPointWrap=currentPoint%currentTotalPoints;
mbedalvaro 40:3ba2b0ea9f33 117 ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.lsdTrajectory[currentPointWrap].intensity=(unsigned char)(255.0*IO.lockInCorrectedValue(x,y));
mbedalvaro 40:3ba2b0ea9f33 118 ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.lsdTrajectory[currentPointWrap].intensity=(unsigned char)(255.0*IO.lockInCorrectedValue(x,y));
mbedalvaro 40:3ba2b0ea9f33 119
mbedalvaro 40:3ba2b0ea9f33 120 // Move to next point:
mbedalvaro 40:3ba2b0ea9f33 121 currentPoint++;
mbedalvaro 40:3ba2b0ea9f33 122
mbedalvaro 40:3ba2b0ea9f33 123 waitNormal=0;
mbedalvaro 40:3ba2b0ea9f33 124 waitLaser=0;
mbedalvaro 40:3ba2b0ea9f33 125
mbedalvaro 40:3ba2b0ea9f33 126 // Update the point display counter (meaning: this point has been properly acquired - we need (at least) configTotalPoints
mbedalvaro 40:3ba2b0ea9f33 127 // of those good acquisitions before updating and re-draw). But attention! this counter may OVERFLOW!
mbedalvaro 40:3ba2b0ea9f33 128 //pointDisplayCounter++;
mbedalvaro 40:3ba2b0ea9f33 129 }
mbedalvaro 40:3ba2b0ea9f33 130 }
mbedalvaro 40:3ba2b0ea9f33 131 } else { // this means we ended rendering this blob, with or without partial duplication
mbedalvaro 40:3ba2b0ea9f33 132
mbedalvaro 40:3ba2b0ea9f33 133 #ifdef debugDelayMirrors // this means that we will process the saccade data all the time, not only when querying the data! can be useful for tests only
mbedalvaro 40:3ba2b0ea9f33 134 ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.processSensedData();
mbedalvaro 40:3ba2b0ea9f33 135 #endif
mbedalvaro 40:3ba2b0ea9f33 136
mbedalvaro 40:3ba2b0ea9f33 137 if (totalObjects>1) stateLsd=LAST_POINT;
mbedalvaro 40:3ba2b0ea9f33 138 else { // this means we are rendering a unique blob:
mbedalvaro 40:3ba2b0ea9f33 139 // currentObject does not change (equal to 0 always), stateLsd is always NORMAL_POINT
mbedalvaro 40:3ba2b0ea9f33 140 // The only thing we need to do is to reset "currentPoint" to 0, and eventually change the color of the blob:
mbedalvaro 40:3ba2b0ea9f33 141 currentPoint=0;
mbedalvaro 40:3ba2b0ea9f33 142 currentColor=ptSceneToDisplay->objectArray[currentObject]->myColor;
mbedalvaro 40:3ba2b0ea9f33 143
mbedalvaro 40:3ba2b0ea9f33 144 // Also, note that this means we ended displaying a whole "configuration", hence:
mbedalvaro 40:3ba2b0ea9f33 145 displayingFinished=true; // (whatever the previous state was).
mbedalvaro 40:3ba2b0ea9f33 146 }
mbedalvaro 40:3ba2b0ea9f33 147 }
mbedalvaro 40:3ba2b0ea9f33 148 break;
mbedalvaro 40:3ba2b0ea9f33 149 case LAST_POINT:
mbedalvaro 40:3ba2b0ea9f33 150 // pc.printf("LAST\n");// does serial works in the interrupt?
mbedalvaro 40:3ba2b0ea9f33 151
mbedalvaro 40:3ba2b0ea9f33 152 // We need to pause for a while (this is for avoiding a deformed end of a blob when there are more than one blob AND we did not properly correct the mirror delay - this may be because
mbedalvaro 40:3ba2b0ea9f33 153 // we want a faster display, in which case we will need to adjust the mirrorDelay variable to something different from 0)
mbedalvaro 40:3ba2b0ea9f33 154 if (waitLast<WAIT_LAST) waitLast++;
mbedalvaro 40:3ba2b0ea9f33 155 else {
mbedalvaro 40:3ba2b0ea9f33 156 // switch off displaying lasers AND if required, the sensing laser (NOTE: there is no need to wait for switch off time)
mbedalvaro 40:3ba2b0ea9f33 157 IO.setRGBPower(0x00);
mbedalvaro 40:3ba2b0ea9f33 158 #ifdef SENSING_LASER_BLANKING
mbedalvaro 40:3ba2b0ea9f33 159 IO.setLaserLockinPower(0);
mbedalvaro 40:3ba2b0ea9f33 160 #endif
mbedalvaro 40:3ba2b0ea9f33 161 waitLast=0;
mbedalvaro 40:3ba2b0ea9f33 162 stateLsd=MOVE_NEXT_OBJECT;
mbedalvaro 40:3ba2b0ea9f33 163 }
mbedalvaro 40:3ba2b0ea9f33 164 break;
mbedalvaro 40:3ba2b0ea9f33 165
mbedalvaro 40:3ba2b0ea9f33 166 case START_FIRST_OBJECT:
mbedalvaro 40:3ba2b0ea9f33 167 // pc.printf("START NEW OBJECT\n");// does serial works in the interrupt?
mbedalvaro 40:3ba2b0ea9f33 168
mbedalvaro 40:3ba2b0ea9f33 169 currentObject=0;
mbedalvaro 40:3ba2b0ea9f33 170
mbedalvaro 40:3ba2b0ea9f33 171 // currentMirrorDelay=ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.delayMirrorSamples; // per blob delay!
mbedalvaro 40:3ba2b0ea9f33 172 currentTotalPoints=ptSceneToDisplay->objectArray[currentObject]->size(); // or using: displaySensingBuffer.lsdTrajectory.size() (but now I made it private to mantain size consistancy between 3d and 2d array size)
mbedalvaro 40:3ba2b0ea9f33 173 currentColor=ptSceneToDisplay->objectArray[currentObject]->myColor;
mbedalvaro 40:3ba2b0ea9f33 174 currentPoint=0;
mbedalvaro 40:3ba2b0ea9f33 175
mbedalvaro 40:3ba2b0ea9f33 176 if (totalObjects>1) stateLsd=START_POINT;
mbedalvaro 40:3ba2b0ea9f33 177 else stateLsd=NORMAL_POINT; // in this case, we can skip the waiting for the last point (and first point too)
mbedalvaro 40:3ba2b0ea9f33 178 break;
mbedalvaro 40:3ba2b0ea9f33 179
mbedalvaro 40:3ba2b0ea9f33 180 case MOVE_NEXT_OBJECT:
mbedalvaro 40:3ba2b0ea9f33 181 // TO DO: line and counter to avoid overshoot?
mbedalvaro 40:3ba2b0ea9f33 182
mbedalvaro 40:3ba2b0ea9f33 183 // Start processing next blob:
mbedalvaro 40:3ba2b0ea9f33 184 currentObject=(currentObject+1)%totalObjects;
mbedalvaro 40:3ba2b0ea9f33 185
mbedalvaro 40:3ba2b0ea9f33 186 // NOTE: check if this was the last object:
mbedalvaro 40:3ba2b0ea9f33 187 if (currentObject==0) {
mbedalvaro 40:3ba2b0ea9f33 188 displayingFinished=true; // that meant we cycle over the whole configuration
mbedalvaro 40:3ba2b0ea9f33 189 }
mbedalvaro 40:3ba2b0ea9f33 190
mbedalvaro 40:3ba2b0ea9f33 191 // currentMirrorDelay=ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.delayMirrorSamples; // per blob delay!
mbedalvaro 40:3ba2b0ea9f33 192 currentTotalPoints=ptSceneToDisplay->objectArray[currentObject]->size();// displaySensingBuffer.lsdTrajectory.size();
mbedalvaro 40:3ba2b0ea9f33 193 currentColor=ptSceneToDisplay->objectArray[currentObject]->myColor;
mbedalvaro 40:3ba2b0ea9f33 194 currentPoint=0;
mbedalvaro 40:3ba2b0ea9f33 195
mbedalvaro 40:3ba2b0ea9f33 196 if (totalObjects>1) stateLsd=START_POINT;
mbedalvaro 40:3ba2b0ea9f33 197 else stateLsd=NORMAL_POINT; // in this case, we can skip the waiting for the last point (and first point too)
mbedalvaro 40:3ba2b0ea9f33 198
mbedalvaro 40:3ba2b0ea9f33 199 break;
mbedalvaro 40:3ba2b0ea9f33 200
mbedalvaro 40:3ba2b0ea9f33 201 case START_POINT:
mbedalvaro 40:3ba2b0ea9f33 202 if (waitFirst==0) {
mbedalvaro 40:3ba2b0ea9f33 203 // Send command to position the mirrors on the first point of NEXT blob (laser is flying in between during this time... )
mbedalvaro 40:3ba2b0ea9f33 204 x= ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.lsdTrajectory[0].v2.x;
mbedalvaro 40:3ba2b0ea9f33 205 y= ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.lsdTrajectory[0].v2.y;
mbedalvaro 40:3ba2b0ea9f33 206 IO.writeOutX(x);
mbedalvaro 40:3ba2b0ea9f33 207 IO.writeOutY(y);
mbedalvaro 40:3ba2b0ea9f33 208 }
mbedalvaro 40:3ba2b0ea9f33 209 if (waitFirst<WAIT_FIRST) waitFirst++; // time for positioning of mirrors on next blob.
mbedalvaro 40:3ba2b0ea9f33 210 else { //mirrors are positioned: activate laser and lock in (needs time):
mbedalvaro 40:3ba2b0ea9f33 211 if (waitFirstLaser==0) {
mbedalvaro 40:3ba2b0ea9f33 212 // activate laser - important in particular for giving time to the Lock-in to catch signal, then laser rouge:
mbedalvaro 40:3ba2b0ea9f33 213 IO.setRGBPower(currentColor);
mbedalvaro 40:3ba2b0ea9f33 214 #ifdef SENSING_LASER_BLANKING
mbedalvaro 40:3ba2b0ea9f33 215 IO.setLaserLockinPower(1);
mbedalvaro 40:3ba2b0ea9f33 216 #endif
mbedalvaro 40:3ba2b0ea9f33 217 }
mbedalvaro 40:3ba2b0ea9f33 218 if (waitFirstLaser<WAIT_FIRST_LASER) waitFirstLaser++;
mbedalvaro 40:3ba2b0ea9f33 219 else {
mbedalvaro 40:3ba2b0ea9f33 220 waitFirst=0;
mbedalvaro 40:3ba2b0ea9f33 221 waitFirstLaser=0;
mbedalvaro 40:3ba2b0ea9f33 222 stateLsd=NORMAL_POINT; // start normal point
mbedalvaro 40:3ba2b0ea9f33 223 }
mbedalvaro 40:3ba2b0ea9f33 224 }
mbedalvaro 40:3ba2b0ea9f33 225 break;
mbedalvaro 40:3ba2b0ea9f33 226 }
mbedalvaro 40:3ba2b0ea9f33 227 }
mbedalvaro 40:3ba2b0ea9f33 228
mbedalvaro 40:3ba2b0ea9f33 229 /*
mbedalvaro 40:3ba2b0ea9f33 230 void laserSensingDisplay::laserRenderThreadONEBLOBONLY() {
mbedalvaro 40:3ba2b0ea9f33 231 // When we arrive here, we ASSUME the mirrors are well positioned at the currentPoint-1, so we need to process the currentPoint:
mbedalvaro 40:3ba2b0ea9f33 232
mbedalvaro 40:3ba2b0ea9f33 233 // Current mirror position:
mbedalvaro 40:3ba2b0ea9f33 234 x= ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.lsdTrajectory[currentPoint].v2.x;
mbedalvaro 40:3ba2b0ea9f33 235 y= ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.lsdTrajectory[currentPoint].v2.y;
mbedalvaro 40:3ba2b0ea9f33 236
mbedalvaro 40:3ba2b0ea9f33 237 // (2) Send command to position the mirrors to the next position:
mbedalvaro 40:3ba2b0ea9f33 238 IO.writeOutX(x);
mbedalvaro 40:3ba2b0ea9f33 239 IO.writeOutY(y);
mbedalvaro 40:3ba2b0ea9f33 240
mbedalvaro 40:3ba2b0ea9f33 241 // int delayedPoint=(currentPoint+currentMirrorDelay)%currentTotalPoints;
mbedalvaro 40:3ba2b0ea9f33 242
mbedalvaro 40:3ba2b0ea9f33 243 #ifdef debugDelayMirrors
mbedalvaro 40:3ba2b0ea9f33 244 if ( ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.lsdTrajectory[currentPoint].lightZone<0) {
mbedalvaro 40:3ba2b0ea9f33 245 IO.setBluePower(0);
mbedalvaro 40:3ba2b0ea9f33 246 // myled3=0;
mbedalvaro 40:3ba2b0ea9f33 247 } else {
mbedalvaro 40:3ba2b0ea9f33 248 IO.setBluePower(1);
mbedalvaro 40:3ba2b0ea9f33 249 // myled3=1;
mbedalvaro 40:3ba2b0ea9f33 250 }
mbedalvaro 40:3ba2b0ea9f33 251 //IO.setRGBPower(0x04); else IO.setRGBPower(0x07);
mbedalvaro 40:3ba2b0ea9f33 252 #endif
mbedalvaro 40:3ba2b0ea9f33 253
mbedalvaro 40:3ba2b0ea9f33 254 // (1) SENSING (on the current blob and particle index with mirror delay: )
mbedalvaro 40:3ba2b0ea9f33 255 ptSceneToDisplay->objectArray[currentObject]->displaySensingBuffer.lsdTrajectory[currentPoint].intensity=(unsigned char)(255.0*IO.lockInCorrectedValue(x,y));
mbedalvaro 40:3ba2b0ea9f33 256 //=lockin.getMedianValue(); //lockin.getLastValue();//
mbedalvaro 40:3ba2b0ea9f33 257
mbedalvaro 40:3ba2b0ea9f33 258 // increment the current point index:
mbedalvaro 40:3ba2b0ea9f33 259 currentPoint=(currentPoint+1)%currentTotalPoints;
mbedalvaro 40:3ba2b0ea9f33 260
mbedalvaro 40:3ba2b0ea9f33 261 }
mbedalvaro 40:3ba2b0ea9f33 262 */
mbedalvaro 40:3ba2b0ea9f33 263