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:
42:5f21a710ebc5
ca compile

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedalvaro 40:3ba2b0ea9f33 1 #include "WrapperFunctions.h"
mbedalvaro 40:3ba2b0ea9f33 2 #include "textData.h" // this just contains a special switch/case function to load an array of data, so as to store data in FLASH.
mbedalvaro 40:3ba2b0ea9f33 3
mbedalvaro 40:3ba2b0ea9f33 4 using namespace std;
mbedalvaro 40:3ba2b0ea9f33 5
mbedalvaro 40:3ba2b0ea9f33 6 extern LaserRenderer lsr;
mbedalvaro 40:3ba2b0ea9f33 7 extern Scene scene;
mbedalvaro 40:3ba2b0ea9f33 8 extern laserSensingDisplay lsd;
mbedalvaro 40:3ba2b0ea9f33 9
mbedalvaro 40:3ba2b0ea9f33 10 bool previousLsdState; //local scope - only used in this file.
mbedalvaro 40:3ba2b0ea9f33 11
mbedalvaro 40:3ba2b0ea9f33 12 // ================================= BASIC "OPENGL-like" object/scene builders and query functions ("sense") ==========================================
mbedalvaro 40:3ba2b0ea9f33 13
mbedalvaro 40:3ba2b0ea9f33 14 void clearScene() // THIS SHOULD BE CALLED WHENEVER we want to create a new scene from scratch.
mbedalvaro 40:3ba2b0ea9f33 15 {
mbedalvaro 40:3ba2b0ea9f33 16 // This is delicate: first, we have to STOP the displaying engine, then we clear the scene and we are ready to add objects (begin/end, or primitive builders)
mbedalvaro 40:3ba2b0ea9f33 17 // BUT WE NEED TO LET THE DISPLAYING ENGINE FINISH THE WORK IT'S DOING on the current buffer. TWO WAYS: DOUBLE BUFFERING, or wait:
mbedalvaro 40:3ba2b0ea9f33 18 // Check in which point of the drawing we are:
mbedalvaro 40:3ba2b0ea9f33 19 if (lsd.isRunning()) {
mbedalvaro 40:3ba2b0ea9f33 20 lsd.startDisplayCheck();
mbedalvaro 40:3ba2b0ea9f33 21 while(!lsd.isDisplayingOver());
mbedalvaro 40:3ba2b0ea9f33 22 stopDisplay();
mbedalvaro 40:3ba2b0ea9f33 23 } else { //do nothing, the display engine is not working (we don't need to wait for the display to end!)
mbedalvaro 40:3ba2b0ea9f33 24 }
mbedalvaro 40:3ba2b0ea9f33 25 scene.clear();
mbedalvaro 40:3ba2b0ea9f33 26 }
mbedalvaro 40:3ba2b0ea9f33 27
mbedalvaro 40:3ba2b0ea9f33 28 void deleteObject(int _id) {
mbedalvaro 40:3ba2b0ea9f33 29 if (lsd.isRunning()) {
mbedalvaro 40:3ba2b0ea9f33 30 lsd.startDisplayCheck();
mbedalvaro 40:3ba2b0ea9f33 31 while(!lsd.isDisplayingOver());
mbedalvaro 40:3ba2b0ea9f33 32 stopDisplay();
mbedalvaro 40:3ba2b0ea9f33 33 } else { //do nothing, the display engine is not working (we don't need to wait for the display to end!)
mbedalvaro 40:3ba2b0ea9f33 34 }
mbedalvaro 40:3ba2b0ea9f33 35 // DELETE THE OBJECT and update the scene:
mbedalvaro 40:3ba2b0ea9f33 36 scene.deleteObject(_id);
mbedalvaro 40:3ba2b0ea9f33 37 updateScene();
mbedalvaro 40:3ba2b0ea9f33 38 }
mbedalvaro 40:3ba2b0ea9f33 39
mbedalvaro 40:3ba2b0ea9f33 40 void updateScene() // THIS SHOULD BE CALLED WHENEVER we ended CREATING or MODIFYING a scene
mbedalvaro 40:3ba2b0ea9f33 41 {
mbedalvaro 40:3ba2b0ea9f33 42 // In fact, the only thing this routine does is to indicate to the (dormant!) displaying engine that the scene STRUCTURE has changed.
mbedalvaro 40:3ba2b0ea9f33 43 lsd.setSceneToDisplay(&scene); // this will compute the number of objects, points, etc, to prepare the displaying engine
mbedalvaro 40:3ba2b0ea9f33 44 resumeDisplay();// this will resume display IF it was displaying before.
mbedalvaro 40:3ba2b0ea9f33 45 }
mbedalvaro 40:3ba2b0ea9f33 46
mbedalvaro 40:3ba2b0ea9f33 47
mbedalvaro 40:3ba2b0ea9f33 48 // Object creation ("openGL-style").
mbedalvaro 40:3ba2b0ea9f33 49 // NOTE: returning the pointer will make it possible to create COLLECTIONS of objects (by creating a vector<BaseObject*> firstCollection, which is a SUBSET of the
mbedalvaro 40:3ba2b0ea9f33 50 // scene collection. In the future, I will make a "collection" class with specific sensing methods, but for the time being this can be done by hand.
mbedalvaro 40:3ba2b0ea9f33 51 BaseObject* begin(unsigned char _id=0)
mbedalvaro 40:3ba2b0ea9f33 52 {
mbedalvaro 40:3ba2b0ea9f33 53 // This will add a new object. In the future, we can have modes - lines, bezier, and points - as well as specification of the type of object (enum)
mbedalvaro 40:3ba2b0ea9f33 54 // TO DO interesting feature: MERGING OF OBJECTS if they have the same ID? Note that if we DON'T specify an ID, the index will grow automatically starting from 0.
mbedalvaro 40:3ba2b0ea9f33 55 // for (int i=0; i<scene.totalObjects(); i++) if ((scene.objectArray[i]->ID())==_id) ptr_object=scene.objectArray[i];
mbedalvaro 40:3ba2b0ea9f33 56
mbedalvaro 40:3ba2b0ea9f33 57 BaseObject* ptr_newObject=new BaseObject(_id); // note: I cannot simply do: BaseObject newObject(_id) because this would be a LOCAL object, deallocated at the exit of this function.
mbedalvaro 40:3ba2b0ea9f33 58 // NOTE: by allocating the memory for the object pointed by ptr_newObject using new BaseObject, we lost the possibility of intantiating CHILD objects.
mbedalvaro 40:3ba2b0ea9f33 59 // One possibility is to have a parameter in the begin() method to indicate the type of object (for instance: GENERIC_OBJECT, LETTER, etc...). This way,
mbedalvaro 40:3ba2b0ea9f33 60 // we can properly instantiate the object. Another possiblity is to
mbedalvaro 40:3ba2b0ea9f33 61
mbedalvaro 40:3ba2b0ea9f33 62 if (ptr_newObject) { // check to see if we could allocate memory
mbedalvaro 40:3ba2b0ea9f33 63 scene.ptr_currentObject=ptr_newObject; // type casting "slices" the child object (but in principle, "scene" WON'T use derived methods)
mbedalvaro 40:3ba2b0ea9f33 64 ptr_newObject->setColor(lsr.color); // use current color in state machine
mbedalvaro 40:3ba2b0ea9f33 65 //pc.printf("Could allocate object: %d", _id);
mbedalvaro 40:3ba2b0ea9f33 66 } else {
mbedalvaro 40:3ba2b0ea9f33 67 //pc.printf("Could not allocate object: %d", _id);
mbedalvaro 40:3ba2b0ea9f33 68 }
mbedalvaro 40:3ba2b0ea9f33 69 return(ptr_newObject);
mbedalvaro 40:3ba2b0ea9f33 70 }
mbedalvaro 40:3ba2b0ea9f33 71
mbedalvaro 40:3ba2b0ea9f33 72 void vertex(V3& _v3)
mbedalvaro 40:3ba2b0ea9f33 73 {
mbedalvaro 40:3ba2b0ea9f33 74 // Add a 3d point to the "current" object (ie, the latest added object in principle!), but do not RENDER it yet (no final projection computed).
mbedalvaro 40:3ba2b0ea9f33 75 // NOTE: the point WILL however be added by transforming it with the current MODELVIEW matrix. This way, we can create a whole 3d "scene" before rendering,
mbedalvaro 40:3ba2b0ea9f33 76 // that can be rotated again without the need to rebuilt it.
mbedalvaro 40:3ba2b0ea9f33 77
mbedalvaro 40:3ba2b0ea9f33 78 scene.ptr_currentObject->addVertex(_v3, lsr.RT);
mbedalvaro 40:3ba2b0ea9f33 79 // Or, to avoid using ptr_currentObject: scene.objectArray.back()->addVertex(_v3, lsr.RT);
mbedalvaro 40:3ba2b0ea9f33 80
mbedalvaro 40:3ba2b0ea9f33 81 // Another way: ptr_currentObject->vertexArray.push_back(lsr.RT*_v3);
mbedalvaro 40:3ba2b0ea9f33 82 // yet another way: use a method of lsr that "transform" a 3d point. Too heavy...
mbedalvaro 40:3ba2b0ea9f33 83 }
mbedalvaro 40:3ba2b0ea9f33 84
mbedalvaro 40:3ba2b0ea9f33 85 void vertex(float x, float y, float z)
mbedalvaro 40:3ba2b0ea9f33 86 {
mbedalvaro 40:3ba2b0ea9f33 87 V3 v(x, y, z);
mbedalvaro 40:3ba2b0ea9f33 88 vertex(v); // why I cannot do: vertex(V3(x, y, z)) ? because vertex(V3& _v3) needs a REFERENCE to an object that has larger scope that this method itself!
mbedalvaro 40:3ba2b0ea9f33 89 }
mbedalvaro 40:3ba2b0ea9f33 90
mbedalvaro 40:3ba2b0ea9f33 91 void vertexArray(vector<V3>& _vertexArray) {
mbedalvaro 40:3ba2b0ea9f33 92 for (int i=0; i<_vertexArray.size(); i++) {
mbedalvaro 40:3ba2b0ea9f33 93 vertex(_vertexArray[i]);
mbedalvaro 40:3ba2b0ea9f33 94 }
mbedalvaro 40:3ba2b0ea9f33 95 }
mbedalvaro 40:3ba2b0ea9f33 96
mbedalvaro 40:3ba2b0ea9f33 97 void end() // add the object to the current scene (we could add to a specific scene in the future...)
mbedalvaro 40:3ba2b0ea9f33 98 {
mbedalvaro 40:3ba2b0ea9f33 99 // note: the current object pointerd by ptr_newObject can be BaseObject or any child class. This is not a problem as long as the methods applied to the
mbedalvaro 40:3ba2b0ea9f33 100 // scene vector array don't use child methods (then we can do a dynamic cast before including in the array: pb = dynamic_cast<CBase*>(&d); ). IF we want
mbedalvaro 40:3ba2b0ea9f33 101 // the scene class to be able to use child methods, then we need to make BaseObject polymorphic, by declaring all usable methods VIRTUAL.
mbedalvaro 40:3ba2b0ea9f33 102 scene.addCurrentObject(); // add the currently tracked object to the vector array
mbedalvaro 40:3ba2b0ea9f33 103 //scene.addObject(scene.ptr_newObject); // use Scene method to add object to the scene (global).
mbedalvaro 40:3ba2b0ea9f33 104 // NOTE: scene structure changed, BUT we don't need to inform the displaying engine if we don't want (the new object won't be displayed though)
mbedalvaro 40:3ba2b0ea9f33 105 }
mbedalvaro 40:3ba2b0ea9f33 106
mbedalvaro 40:3ba2b0ea9f33 107 // Sensing methods (query and process sensed data for all objects):
mbedalvaro 40:3ba2b0ea9f33 108 // Objects: we can query the object by their ID or by just giving the object pointer. Now, since we are using begin/end to create objects (at least for now), it will
mbedalvaro 40:3ba2b0ea9f33 109 // be better to query by ID (and assume also that their IDs are different). Now, note that matching the ID may be costly (well, I assume they are not more than ten or so objects).
mbedalvaro 40:3ba2b0ea9f33 110 bool senseObject(int _id)
mbedalvaro 40:3ba2b0ea9f33 111 {
mbedalvaro 40:3ba2b0ea9f33 112 BaseObject* ptr_object=NULL;
mbedalvaro 40:3ba2b0ea9f33 113 for (int i=0; i<scene.totalObjects(); i++) if ((scene.objectArray[i]->ID())==_id) ptr_object=scene.objectArray[i];
mbedalvaro 40:3ba2b0ea9f33 114 if (ptr_object!=NULL) return(ptr_object->sense());
mbedalvaro 40:3ba2b0ea9f33 115 else return(false); // if there is no object with this ID, return false (convention)
mbedalvaro 40:3ba2b0ea9f33 116 }
mbedalvaro 40:3ba2b0ea9f33 117
mbedalvaro 40:3ba2b0ea9f33 118 bool senseScene()
mbedalvaro 40:3ba2b0ea9f33 119 {
mbedalvaro 40:3ba2b0ea9f33 120 return(scene.sense());
mbedalvaro 40:3ba2b0ea9f33 121 }
mbedalvaro 40:3ba2b0ea9f33 122
mbedalvaro 40:3ba2b0ea9f33 123 // ================================= "GLOBAL" TRANSFORMATIONS (i.e. "viewing transforms") ON OBJECTS and SCENE without rebuilding them ============================================================
mbedalvaro 40:3ba2b0ea9f33 124 // NOTE: There are two ways of doing this: (1) one is to apply the required transformation on the object/scene 3d points themselves; (2) the other is to mantain the 3d points values, but apply
mbedalvaro 40:3ba2b0ea9f33 125 // the transformation FOR rendering only. The advantage of this last technique is that there will not be any drifting of the values because
mbedalvaro 40:3ba2b0ea9f33 126 // of approximations after a while; the disadvantage is that we cannot easily track an "incremental" interactive transformation (say, scrolling a sphere). But this can be solved by using
mbedalvaro 40:3ba2b0ea9f33 127 // an "accumulator" tranformation matrix (or a quaternion). Also, the second methodology closely matches the OpenGL philosophy: defining the "modelview transformation" and the "viewing transformation",
mbedalvaro 40:3ba2b0ea9f33 128 // even though these transformations apply to the same modelview matrix.
mbedalvaro 40:3ba2b0ea9f33 129 // I will implement both, because even the first option can be useful (to create more complex scenes by rotating already created objects for instance - but it will be trickier to understand though)
mbedalvaro 40:3ba2b0ea9f33 130
mbedalvaro 40:3ba2b0ea9f33 131 // (1) applying a transformation on the 3d points (NOTE: we could also apply transformations on the projected points! this is however a work for the "viewport").
mbedalvaro 40:3ba2b0ea9f33 132 // NOTE: I am not going to create new transform methods (rotation and translations), but instead use the lsr stack. So, I assume the user has set RT to what she wants. Then, we will
mbedalvaro 40:3ba2b0ea9f33 133 // just apply RT to the object or whole scene. This method can be used to RESIZE the object (in particular when it is centered).
mbedalvaro 40:3ba2b0ea9f33 134 //(a) Objects:
mbedalvaro 40:3ba2b0ea9f33 135 void trasformObject(int _id) // use maps in the future!!!
mbedalvaro 40:3ba2b0ea9f33 136 {
mbedalvaro 40:3ba2b0ea9f33 137 BaseObject* ptr_object=NULL;
mbedalvaro 40:3ba2b0ea9f33 138 for (int i=0; i<scene.totalObjects(); i++) if ((scene.objectArray[i]->ID())==_id) ptr_object=scene.objectArray[i];
mbedalvaro 40:3ba2b0ea9f33 139 if (ptr_object!=NULL) {
mbedalvaro 40:3ba2b0ea9f33 140 // Apply the current RT transformation:
mbedalvaro 40:3ba2b0ea9f33 141 ptr_object->transform(lsr.RT);
mbedalvaro 40:3ba2b0ea9f33 142 // Them RENDER the object? no, this will be done only when drawing: the reason is that ON TOP of this transform, we may have the GLOBAL MODELVIEW matrix to apply
mbedalvaro 40:3ba2b0ea9f33 143 //lsr.renderObject(ptr_object);
mbedalvaro 40:3ba2b0ea9f33 144 }
mbedalvaro 40:3ba2b0ea9f33 145 }
mbedalvaro 40:3ba2b0ea9f33 146 // If we know the object already (this is the output of "begin" method for instance), we can apply the transformation without having to match the ID:
mbedalvaro 40:3ba2b0ea9f33 147 void transformObject(BaseObject* ptr_object)
mbedalvaro 40:3ba2b0ea9f33 148 {
mbedalvaro 40:3ba2b0ea9f33 149 ptr_object->transform(lsr.RT);
mbedalvaro 40:3ba2b0ea9f33 150 // lsr.renderObject(ptr_object);
mbedalvaro 40:3ba2b0ea9f33 151 }
mbedalvaro 40:3ba2b0ea9f33 152 // (b) Whole scene:
mbedalvaro 40:3ba2b0ea9f33 153 void transformScene()
mbedalvaro 40:3ba2b0ea9f33 154 {
mbedalvaro 40:3ba2b0ea9f33 155 scene.transform(lsr.RT); // or equialently: for (int i=0; i<scene.totalObjects(); i++) scene.objectArray[i]->transform(lsr.RT);
mbedalvaro 40:3ba2b0ea9f33 156 // lsr.renderScene(&scene);
mbedalvaro 40:3ba2b0ea9f33 157 }
mbedalvaro 40:3ba2b0ea9f33 158
mbedalvaro 40:3ba2b0ea9f33 159 //(2) Apply current RT transformation and render but KEEPING the original values of the 3d points:
mbedalvaro 40:3ba2b0ea9f33 160 //(a) Objects:
mbedalvaro 40:3ba2b0ea9f33 161 void drawObject(int _id) // use maps in the future!!!
mbedalvaro 40:3ba2b0ea9f33 162 {
mbedalvaro 40:3ba2b0ea9f33 163 BaseObject* ptr_object=NULL;
mbedalvaro 40:3ba2b0ea9f33 164 for (int i=0; i<scene.totalObjects(); i++) if ((scene.objectArray[i]->ID())==_id) ptr_object=scene.objectArray[i];
mbedalvaro 40:3ba2b0ea9f33 165 if (ptr_object!=NULL) {
mbedalvaro 40:3ba2b0ea9f33 166 // We don't apply the current RT transformation (ptr_object->transform(lsr.RT)), but instead we directly RENDER it with a pre-transformation:
mbedalvaro 40:3ba2b0ea9f33 167 lsr.renderObject(ptr_object, lsr.RT);
mbedalvaro 40:3ba2b0ea9f33 168 }
mbedalvaro 40:3ba2b0ea9f33 169 }
mbedalvaro 40:3ba2b0ea9f33 170 // If we know the object already (this is the output of "begin" method for instance), we can apply the transformation without having to match the ID:
mbedalvaro 40:3ba2b0ea9f33 171 void drawObject(BaseObject* ptr_object)
mbedalvaro 40:3ba2b0ea9f33 172 {
mbedalvaro 40:3ba2b0ea9f33 173 //ptr_object->transform(lsr.RT);
mbedalvaro 40:3ba2b0ea9f33 174 lsr.renderObject(ptr_object, lsr.RT);
mbedalvaro 40:3ba2b0ea9f33 175 }
mbedalvaro 40:3ba2b0ea9f33 176 // (b) Whole scene:
mbedalvaro 40:3ba2b0ea9f33 177 // ATTENTION: we may need START the display engine the FIRST time or nothing will be seeing (this is done by calling startDisplay()).
mbedalvaro 40:3ba2b0ea9f33 178 void drawScene()
mbedalvaro 40:3ba2b0ea9f33 179 {
mbedalvaro 40:3ba2b0ea9f33 180 //NOTE: there is no need, AND IT IS better NOT to stop/resume the display engine (detaching and reattaching the ISR).
mbedalvaro 40:3ba2b0ea9f33 181 // There is no need in principle, because we only call drawScene AFTER the scene to draw has been passed to the laserSensingDisplay object. This means
mbedalvaro 40:3ba2b0ea9f33 182 // that the number of objects and points per object did NOT change.
mbedalvaro 40:3ba2b0ea9f33 183 //scene.transform(lsr.RT); // or equialently: for (int i=0; i<scene.totalObjects(); i++) scene.objectArray[i]->transform(lsr.RT);
mbedalvaro 40:3ba2b0ea9f33 184 lsr.renderScene(&scene, lsr.RT);
mbedalvaro 40:3ba2b0ea9f33 185 }
mbedalvaro 40:3ba2b0ea9f33 186
mbedalvaro 40:3ba2b0ea9f33 187 // Color attribute transformation (for the time being, only to the whole scene):
mbedalvaro 40:3ba2b0ea9f33 188 void changeColorScene(unsigned char _color) {
mbedalvaro 40:3ba2b0ea9f33 189 for (int i=0; i<scene.totalObjects(); i++) scene.objectArray[i]->setColor(_color);
mbedalvaro 40:3ba2b0ea9f33 190 }
mbedalvaro 40:3ba2b0ea9f33 191
mbedalvaro 40:3ba2b0ea9f33 192 // ================================= OBJECT PRIMITIVES (this could be in a different file) ============================================================
mbedalvaro 40:3ba2b0ea9f33 193 // NOTE: these methods will not create new objects, unless we explicitly say so (by preceding them with "begin" and ending by "end".
mbedalvaro 40:3ba2b0ea9f33 194 // Instead, they will add the vertices to the "current object" being created.
mbedalvaro 40:3ba2b0ea9f33 195
mbedalvaro 40:3ba2b0ea9f33 196 // A line:
mbedalvaro 40:3ba2b0ea9f33 197 void line(V3& v0, V3& v1, int npoints)
mbedalvaro 40:3ba2b0ea9f33 198 {
mbedalvaro 40:3ba2b0ea9f33 199 V3 stepVector=(v1-v0)/(npoints-1);
mbedalvaro 40:3ba2b0ea9f33 200 for (int i=0; i<npoints; i++) {
mbedalvaro 40:3ba2b0ea9f33 201 V3 v(v0+stepVector*i); // vertex added to the current object
mbedalvaro 40:3ba2b0ea9f33 202 vertex(v);
mbedalvaro 40:3ba2b0ea9f33 203 }
mbedalvaro 40:3ba2b0ea9f33 204 }
mbedalvaro 40:3ba2b0ea9f33 205 void line(float x0, float y0, float z0, float x1, float y1, float z1, int npoints)
mbedalvaro 40:3ba2b0ea9f33 206 {
mbedalvaro 40:3ba2b0ea9f33 207 // NOTE: we don't clear the current modelview, but use it's current value.
mbedalvaro 40:3ba2b0ea9f33 208 V3 A(x0, y0, z0), B(x1, y1, z1);
mbedalvaro 40:3ba2b0ea9f33 209 line(A, B, npoints);
mbedalvaro 40:3ba2b0ea9f33 210 }
mbedalvaro 40:3ba2b0ea9f33 211 // A line in the z=0 plane:
mbedalvaro 40:3ba2b0ea9f33 212 void line(float x0, float y0, float x1, float y1, int npoints)
mbedalvaro 40:3ba2b0ea9f33 213 {
mbedalvaro 40:3ba2b0ea9f33 214 // NOTE: we don't clear the current modelview, but use it's current value.
mbedalvaro 40:3ba2b0ea9f33 215 V3 A(x0, y0, 0), B(x1, y1, 0);
mbedalvaro 40:3ba2b0ea9f33 216 line(A, B, npoints);
mbedalvaro 40:3ba2b0ea9f33 217 }
mbedalvaro 40:3ba2b0ea9f33 218
mbedalvaro 40:3ba2b0ea9f33 219 // A square in the z=0 plane
mbedalvaro 40:3ba2b0ea9f33 220 void square(float sideSize, int npointsSide)
mbedalvaro 40:3ba2b0ea9f33 221 {
mbedalvaro 40:3ba2b0ea9f33 222 V3 A(0,0, 0), B(sideSize, 0, 0);
mbedalvaro 40:3ba2b0ea9f33 223 line(A, B, npointsSide);
mbedalvaro 40:3ba2b0ea9f33 224 A.x = sideSize;
mbedalvaro 40:3ba2b0ea9f33 225 A.y = sideSize;
mbedalvaro 40:3ba2b0ea9f33 226 line(B, A, npointsSide);
mbedalvaro 40:3ba2b0ea9f33 227 B.x = 0;
mbedalvaro 40:3ba2b0ea9f33 228 B.y = sideSize;
mbedalvaro 40:3ba2b0ea9f33 229 line(A, B, npointsSide);
mbedalvaro 40:3ba2b0ea9f33 230 A.x = 0;
mbedalvaro 40:3ba2b0ea9f33 231 A.y = 0;
mbedalvaro 40:3ba2b0ea9f33 232 line(B, A, npointsSide);
mbedalvaro 40:3ba2b0ea9f33 233 }
mbedalvaro 40:3ba2b0ea9f33 234
mbedalvaro 40:3ba2b0ea9f33 235 // A rectangle in the z=0 plane
mbedalvaro 40:3ba2b0ea9f33 236 void rectangle(float sideSizeX, float sideSizeY, int interPointDistance)
mbedalvaro 40:3ba2b0ea9f33 237 // note: interPointDistance (degrees per point) would be the equivalent of "pixels" separation for the laser projector
mbedalvaro 40:3ba2b0ea9f33 238 {
mbedalvaro 40:3ba2b0ea9f33 239 V3 A(0,0, 0), B(sideSizeX, 0, 0);
mbedalvaro 40:3ba2b0ea9f33 240 line(A, B, sideSizeX/interPointDistance);
mbedalvaro 40:3ba2b0ea9f33 241 A.x = sideSizeX;
mbedalvaro 40:3ba2b0ea9f33 242 A.y = sideSizeY;
mbedalvaro 40:3ba2b0ea9f33 243 line(B, A, sideSizeY/interPointDistance);
mbedalvaro 40:3ba2b0ea9f33 244 B.x = 0;
mbedalvaro 40:3ba2b0ea9f33 245 B.y = sideSizeY;
mbedalvaro 40:3ba2b0ea9f33 246 line(A, B, sideSizeX/interPointDistance);
mbedalvaro 40:3ba2b0ea9f33 247 A.x = 0;
mbedalvaro 40:3ba2b0ea9f33 248 A.y = 0;
mbedalvaro 40:3ba2b0ea9f33 249 line(B, A, sideSizeY/interPointDistance);
mbedalvaro 40:3ba2b0ea9f33 250 }
mbedalvaro 40:3ba2b0ea9f33 251
mbedalvaro 40:3ba2b0ea9f33 252
mbedalvaro 40:3ba2b0ea9f33 253
mbedalvaro 40:3ba2b0ea9f33 254 void circle(float radius, int numpoints)
mbedalvaro 40:3ba2b0ea9f33 255 {
mbedalvaro 40:3ba2b0ea9f33 256 float angleStep=360.0/numpoints;
mbedalvaro 40:3ba2b0ea9f33 257 lsr.pushPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 258 for (int i=0; i<numpoints; i++) {
mbedalvaro 40:3ba2b0ea9f33 259 vertex(radius, 0, 0);
mbedalvaro 40:3ba2b0ea9f33 260 lsr.rotateZ(angleStep);
mbedalvaro 40:3ba2b0ea9f33 261 }
mbedalvaro 40:3ba2b0ea9f33 262 // Redo the first point to close the cirlce:
mbedalvaro 40:3ba2b0ea9f33 263 vertex(radius, 0, 0);
mbedalvaro 40:3ba2b0ea9f33 264 lsr.popPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 265 }
mbedalvaro 40:3ba2b0ea9f33 266
mbedalvaro 40:3ba2b0ea9f33 267 // A "cube" (with one corner at the origin):
mbedalvaro 40:3ba2b0ea9f33 268 void cube(float sideSize, int nbpointsSide)
mbedalvaro 40:3ba2b0ea9f33 269 {
mbedalvaro 40:3ba2b0ea9f33 270 lsr.pushPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 271 square(sideSize, nbpointsSide);
mbedalvaro 40:3ba2b0ea9f33 272 line(0,0,0,0,0,sideSize, nbpointsSide);
mbedalvaro 40:3ba2b0ea9f33 273 lsr.translate(0,0,sideSize);
mbedalvaro 40:3ba2b0ea9f33 274 square(sideSize, nbpointsSide);
mbedalvaro 40:3ba2b0ea9f33 275 lsr.popPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 276 }
mbedalvaro 40:3ba2b0ea9f33 277
mbedalvaro 40:3ba2b0ea9f33 278 // LETTERS and STRINGS:
mbedalvaro 40:3ba2b0ea9f33 279 // NOTE: for the time being, these letters are not special object. I will just add the vertex of the letter to a normal BaseObject.
mbedalvaro 40:3ba2b0ea9f33 280 void letter3d(char _letter, float width, float height)
mbedalvaro 40:3ba2b0ea9f33 281 {
mbedalvaro 40:3ba2b0ea9f33 282 unsigned char numpoints=fillAuxBuffer(_letter);
mbedalvaro 40:3ba2b0ea9f33 283 lsr.pushPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 284 lsr.resize(0.1*width, 1.0/15.0*height, 1); // note: letter size as defined in textData.h is: width = 10, height = 15
mbedalvaro 40:3ba2b0ea9f33 285 for (int i=0; i<numpoints; i++ ) vertex(auxbuffer[2*i], auxbuffer[2*i+1], 0);
mbedalvaro 40:3ba2b0ea9f33 286 lsr.popPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 287 }
mbedalvaro 40:3ba2b0ea9f33 288
mbedalvaro 40:3ba2b0ea9f33 289 // To create a string: either as a single object, or separate objects. In the later case, we should NOT call to "begin/end", because this will be done
mbedalvaro 40:3ba2b0ea9f33 290 // in THIS wrapping function... how to indicate this? and which index? So, for the time being, I will consider the FIRST case only. If we want to have
mbedalvaro 40:3ba2b0ea9f33 291 // separate objects, we will need to do this explicitly, basically copying this code and interspeeding it with "begin/end" and numbering the objects (cool
mbedalvaro 40:3ba2b0ea9f33 292 // for detecting individual touched letters).
mbedalvaro 40:3ba2b0ea9f33 293 void string3d(string _text, float totalWidth, float height)
mbedalvaro 40:3ba2b0ea9f33 294 {
mbedalvaro 40:3ba2b0ea9f33 295 float stepX=1.0*totalWidth/_text.length(); // this is just fontWidth, or some percentage of it
mbedalvaro 40:3ba2b0ea9f33 296 lsr.pushPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 297 for (unsigned short i=0; i<_text.length(); i++) {
mbedalvaro 40:3ba2b0ea9f33 298 char ch=_text.at(i);
mbedalvaro 40:3ba2b0ea9f33 299 lsr.translate(1.3*stepX,0,0); // slightly larger than the fontWidth...
mbedalvaro 40:3ba2b0ea9f33 300 if (ch!=' ') letter3d(ch, stepX, height);
mbedalvaro 40:3ba2b0ea9f33 301 }
mbedalvaro 40:3ba2b0ea9f33 302 lsr.popPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 303 }
mbedalvaro 40:3ba2b0ea9f33 304
mbedalvaro 40:3ba2b0ea9f33 305
mbedalvaro 40:3ba2b0ea9f33 306
mbedalvaro 40:3ba2b0ea9f33 307 // ========= MULTI OBJECTS ==================================================================================
mbedalvaro 40:3ba2b0ea9f33 308
mbedalvaro 40:3ba2b0ea9f33 309 // A simple "normalized" grid on the z=0 plane (with points, repeated to get them more "clear").
mbedalvaro 40:3ba2b0ea9f33 310 // Also, it may be interesting to make each group of points a separate object (for switching off laser, but also querying touch)
mbedalvaro 40:3ba2b0ea9f33 311 // Corner of the grid at the origin.
mbedalvaro 40:3ba2b0ea9f33 312 // NOTE: this is an example of a "multi-object" that does NOT need "begin/end" in the main
mbedalvaro 40:3ba2b0ea9f33 313 void grid(int nx, int ny, int repeatpoint)
mbedalvaro 40:3ba2b0ea9f33 314 {
mbedalvaro 40:3ba2b0ea9f33 315 float px=1.0/(nx-1), py=1.0/(ny-1);
mbedalvaro 40:3ba2b0ea9f33 316 //lsr.pushPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 317 for (int i=0; i<ny; i++) {
mbedalvaro 40:3ba2b0ea9f33 318 // pc.printf("\n");
mbedalvaro 40:3ba2b0ea9f33 319 if (i%2==0) { // to do zig-zag...
mbedalvaro 40:3ba2b0ea9f33 320 for (int j=0; j<nx; j++) {
mbedalvaro 40:3ba2b0ea9f33 321 begin(ny*i+j);
mbedalvaro 40:3ba2b0ea9f33 322 for (int k=0; k<repeatpoint; k++)
mbedalvaro 40:3ba2b0ea9f33 323 //vertex(1.0*j*px,1.0*i*py,0); // faster than using translations...
mbedalvaro 40:3ba2b0ea9f33 324 vertex(1.0*i*py,1.0*j*px,0);
mbedalvaro 40:3ba2b0ea9f33 325 end();
mbedalvaro 40:3ba2b0ea9f33 326 //pc.printf("%4.2f ", 1.0*j*px);
mbedalvaro 40:3ba2b0ea9f33 327 }
mbedalvaro 40:3ba2b0ea9f33 328 } else { // odd line:
mbedalvaro 40:3ba2b0ea9f33 329 for (int j=nx-1; j>=0; j--) {
mbedalvaro 40:3ba2b0ea9f33 330 begin(ny*i+j);
mbedalvaro 40:3ba2b0ea9f33 331 for (int k=0; k<repeatpoint; k++)
mbedalvaro 40:3ba2b0ea9f33 332 // vertex(1.0*j*px,1.0*i*py,0); // faster than using translations...
mbedalvaro 40:3ba2b0ea9f33 333 vertex(1.0*i*py,1.0*j*px,0);
mbedalvaro 40:3ba2b0ea9f33 334 end();
mbedalvaro 40:3ba2b0ea9f33 335 //pc.printf("%4.2f ", 1.0*j*px);
mbedalvaro 40:3ba2b0ea9f33 336 }
mbedalvaro 40:3ba2b0ea9f33 337 }
mbedalvaro 40:3ba2b0ea9f33 338 }
mbedalvaro 40:3ba2b0ea9f33 339 //lsr.popPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 340 }
mbedalvaro 40:3ba2b0ea9f33 341
mbedalvaro 40:3ba2b0ea9f33 342 // A simple "muti-object" grid, not normalized (this is just for convenience):
mbedalvaro 40:3ba2b0ea9f33 343 void grid(float sizeX, float sizeY, int nx, int ny, int repeatpoint)
mbedalvaro 40:3ba2b0ea9f33 344 {
mbedalvaro 40:3ba2b0ea9f33 345 lsr.pushPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 346 lsr.resize(sizeX, sizeY, 1);
mbedalvaro 40:3ba2b0ea9f33 347 grid(nx, ny, repeatpoint);
mbedalvaro 40:3ba2b0ea9f33 348 lsr.popPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 349 }
mbedalvaro 40:3ba2b0ea9f33 350
mbedalvaro 40:3ba2b0ea9f33 351 //Normalized grid of circles:
mbedalvaro 40:3ba2b0ea9f33 352 void gridCircles(int nx, int ny, float radius, int nbpointsCircle)
mbedalvaro 40:3ba2b0ea9f33 353 {
mbedalvaro 40:3ba2b0ea9f33 354 float px=1.0/(nx-1), py=1.0/(ny-1);
mbedalvaro 40:3ba2b0ea9f33 355 lsr.pushPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 356 for (int i=0; i<ny; i++) {
mbedalvaro 40:3ba2b0ea9f33 357 if (i%2==0) { // to do zig-zag...
mbedalvaro 40:3ba2b0ea9f33 358 for (int j=0; j<nx; j++) {
mbedalvaro 40:3ba2b0ea9f33 359 begin(ny*i+j);
mbedalvaro 40:3ba2b0ea9f33 360 circle(radius, nbpointsCircle);
mbedalvaro 40:3ba2b0ea9f33 361 end();
mbedalvaro 40:3ba2b0ea9f33 362 lsr.translate(px, 0, 0);
mbedalvaro 40:3ba2b0ea9f33 363 }
mbedalvaro 40:3ba2b0ea9f33 364 } else { // odd line:
mbedalvaro 40:3ba2b0ea9f33 365 for (int j=nx-1; j>=0; j--) {
mbedalvaro 40:3ba2b0ea9f33 366 begin(ny*i+j);
mbedalvaro 40:3ba2b0ea9f33 367 circle(radius, nbpointsCircle);
mbedalvaro 40:3ba2b0ea9f33 368 end();
mbedalvaro 40:3ba2b0ea9f33 369 lsr.translate(-px, 0, 0);
mbedalvaro 40:3ba2b0ea9f33 370 }
mbedalvaro 40:3ba2b0ea9f33 371 }
mbedalvaro 40:3ba2b0ea9f33 372 lsr.translate(0, py, 0);
mbedalvaro 40:3ba2b0ea9f33 373 }
mbedalvaro 40:3ba2b0ea9f33 374 lsr.popPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 375 }
mbedalvaro 40:3ba2b0ea9f33 376
mbedalvaro 40:3ba2b0ea9f33 377 // Not normalized grid of circles:
mbedalvaro 40:3ba2b0ea9f33 378 void gridCircles(float sizeX, float sizeY, int nx, int ny, float radius, int nbpointsCircle)
mbedalvaro 40:3ba2b0ea9f33 379 {
mbedalvaro 40:3ba2b0ea9f33 380 float px=sizeX/(nx-1), py=sizeY/(ny-1);
mbedalvaro 40:3ba2b0ea9f33 381 lsr.pushPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 382 for (int i=0; i<ny; i++) {
mbedalvaro 40:3ba2b0ea9f33 383 if (i%2==0) { // to do zig-zag...
mbedalvaro 40:3ba2b0ea9f33 384 for (int j=0; j<nx; j++) {
mbedalvaro 40:3ba2b0ea9f33 385 begin(ny*i+j);
mbedalvaro 40:3ba2b0ea9f33 386 circle(radius, nbpointsCircle);
mbedalvaro 40:3ba2b0ea9f33 387 end();
mbedalvaro 40:3ba2b0ea9f33 388 lsr.translate(px, 0, 0);
mbedalvaro 40:3ba2b0ea9f33 389 }
mbedalvaro 40:3ba2b0ea9f33 390 } else { // odd line:
mbedalvaro 40:3ba2b0ea9f33 391 for (int j=nx-1; j>=0; j--) {
mbedalvaro 40:3ba2b0ea9f33 392 lsr.translate(-px, 0, 0);
mbedalvaro 40:3ba2b0ea9f33 393 begin(ny*i+j);
mbedalvaro 40:3ba2b0ea9f33 394 circle(radius, nbpointsCircle);
mbedalvaro 40:3ba2b0ea9f33 395 end();
mbedalvaro 40:3ba2b0ea9f33 396 }
mbedalvaro 40:3ba2b0ea9f33 397 }
mbedalvaro 40:3ba2b0ea9f33 398 lsr.translate(0, py, 0);
mbedalvaro 40:3ba2b0ea9f33 399 }
mbedalvaro 40:3ba2b0ea9f33 400 lsr.popPoseMatrix();
mbedalvaro 40:3ba2b0ea9f33 401 }
mbedalvaro 40:3ba2b0ea9f33 402
mbedalvaro 40:3ba2b0ea9f33 403 // WRAPPERS TO CREATE ARBITRARY OBJECTS FROM SENT DATA POINTS (V3 array) =============================================
mbedalvaro 40:3ba2b0ea9f33 404 void createShapeObject(int idobject, vector<V3> &arrayVertices) {
mbedalvaro 40:3ba2b0ea9f33 405 begin(idobject);
mbedalvaro 40:3ba2b0ea9f33 406 vertexArray(arrayVertices);
mbedalvaro 40:3ba2b0ea9f33 407 end();
mbedalvaro 40:3ba2b0ea9f33 408 }
mbedalvaro 40:3ba2b0ea9f33 409
mbedalvaro 40:3ba2b0ea9f33 410 // WRAPPERS TO LOAD OBJECTS FROM SYSTEM FILE =========================================================================
mbedalvaro 40:3ba2b0ea9f33 411 // ... to do
mbedalvaro 40:3ba2b0ea9f33 412
mbedalvaro 40:3ba2b0ea9f33 413 // WRAPPERS TO LOAD MATRICES FROM SYSTEM FILE ==========================================================================
mbedalvaro 40:3ba2b0ea9f33 414 // ...to do
mbedalvaro 40:3ba2b0ea9f33 415
mbedalvaro 40:3ba2b0ea9f33 416 // ================================= WRAPPERS FOR MORE BASIC IO FUNCTIONS =================================
mbedalvaro 40:3ba2b0ea9f33 417 void showLimitsMirrors(unsigned short pointsPerLine, unsigned short durationSecs)
mbedalvaro 40:3ba2b0ea9f33 418 {
mbedalvaro 40:3ba2b0ea9f33 419 // Stop the display engine and lasers:
mbedalvaro 40:3ba2b0ea9f33 420 stopDisplay();
mbedalvaro 40:3ba2b0ea9f33 421 // but we need to ensure that the DISPLAYING lasers are ON:
mbedalvaro 40:3ba2b0ea9f33 422 IO.setRGBPower(0x07);
mbedalvaro 40:3ba2b0ea9f33 423 IO.showLimitsMirrors(pointsPerLine, durationSecs);
mbedalvaro 40:3ba2b0ea9f33 424 resumeDisplay();
mbedalvaro 40:3ba2b0ea9f33 425 }
mbedalvaro 40:3ba2b0ea9f33 426
mbedalvaro 40:3ba2b0ea9f33 427 void scanSerial(unsigned short pointsPerLine)
mbedalvaro 40:3ba2b0ea9f33 428 {
mbedalvaro 40:3ba2b0ea9f33 429 // Stop the display engine and lasers:
mbedalvaro 40:3ba2b0ea9f33 430 stopDisplay();
mbedalvaro 40:3ba2b0ea9f33 431 // ...but we need to ensure that the sensing laser is ON:
mbedalvaro 40:3ba2b0ea9f33 432 IO.setLaserLockinPower(1);
mbedalvaro 40:3ba2b0ea9f33 433 IO.scan_serial(pointsPerLine);
mbedalvaro 40:3ba2b0ea9f33 434 resumeDisplay();
mbedalvaro 40:3ba2b0ea9f33 435 }
mbedalvaro 40:3ba2b0ea9f33 436
mbedalvaro 40:3ba2b0ea9f33 437 void recomputeLookUpTable()
mbedalvaro 40:3ba2b0ea9f33 438 {
mbedalvaro 40:3ba2b0ea9f33 439 // Stop the display engine and lasers:
mbedalvaro 40:3ba2b0ea9f33 440 stopDisplay();
mbedalvaro 40:3ba2b0ea9f33 441 // but we need to ensure that the sensing laser is ON:
mbedalvaro 40:3ba2b0ea9f33 442 IO.setLaserLockinPower(1);
mbedalvaro 40:3ba2b0ea9f33 443 IO.scanLUT(); // this recreates and SAVES the LUT table
mbedalvaro 40:3ba2b0ea9f33 444 resumeDisplay();
mbedalvaro 40:3ba2b0ea9f33 445 }
mbedalvaro 40:3ba2b0ea9f33 446
mbedalvaro 40:3ba2b0ea9f33 447 // This is a special function that needs to be called at least once to set the displaying engine ON, thus setting the current state of the engine:
mbedalvaro 40:3ba2b0ea9f33 448 void startDisplay() {
mbedalvaro 40:3ba2b0ea9f33 449 IO.setLaserLockinPower(1);
mbedalvaro 40:3ba2b0ea9f33 450 lsd.run();
mbedalvaro 40:3ba2b0ea9f33 451 }
mbedalvaro 40:3ba2b0ea9f33 452
mbedalvaro 40:3ba2b0ea9f33 453 void stopDisplay() // save previous displaying status, stops the displaying engine, and switch off lasers
mbedalvaro 40:3ba2b0ea9f33 454 {
mbedalvaro 40:3ba2b0ea9f33 455 previousLsdState=lsd.isRunning();
mbedalvaro 40:3ba2b0ea9f33 456 lsd.stop();
mbedalvaro 40:3ba2b0ea9f33 457 // also, switch off lasers:
mbedalvaro 40:3ba2b0ea9f33 458 IO.setLaserLockinPower(0);
mbedalvaro 40:3ba2b0ea9f33 459 IO.switchOffDisplayLasers();
mbedalvaro 40:3ba2b0ea9f33 460 }
mbedalvaro 40:3ba2b0ea9f33 461
mbedalvaro 40:3ba2b0ea9f33 462 void resumeDisplay() // go back to previous state of displaying engine
mbedalvaro 40:3ba2b0ea9f33 463 // and set the sensing laser ON (no need to explicitly switch the DISPLAYING lasers ON - this is done in the displaying engine ISR).
mbedalvaro 40:3ba2b0ea9f33 464 {
mbedalvaro 40:3ba2b0ea9f33 465 if (previousLsdState) {
mbedalvaro 40:3ba2b0ea9f33 466 //switch on sensing lasers:
mbedalvaro 40:3ba2b0ea9f33 467 IO.setLaserLockinPower(1);
mbedalvaro 40:3ba2b0ea9f33 468 lsd.run();
mbedalvaro 40:3ba2b0ea9f33 469 // rem: no need to set the displaying lasers: this is done per-object basis
mbedalvaro 40:3ba2b0ea9f33 470 }
mbedalvaro 40:3ba2b0ea9f33 471 }
mbedalvaro 40:3ba2b0ea9f33 472
mbedalvaro 40:3ba2b0ea9f33 473 // =============================== HARDWARE KNOBS: switches, potentiometers... =================================================
mbedalvaro 40:3ba2b0ea9f33 474 void hardwareKnobs()
mbedalvaro 40:3ba2b0ea9f33 475 {
mbedalvaro 40:3ba2b0ea9f33 476 // Potentiometer, switches, etc:
mbedalvaro 40:3ba2b0ea9f33 477 //(1) Check for change of threshold mode button (switch one):
mbedalvaro 40:3ba2b0ea9f33 478 //!!! ATTENTION: this does not work very well to say the truth: bouncing+adc settings problems...
mbedalvaro 40:3ba2b0ea9f33 479 bool stateswitch;
mbedalvaro 40:3ba2b0ea9f33 480 if (IO.switchOneCheck(stateswitch)) {
mbedalvaro 40:3ba2b0ea9f33 481 if (stateswitch) pc.printf("Set: AUTO threshold mode\n");
mbedalvaro 40:3ba2b0ea9f33 482 else pc.printf("Set: FIXED threshold mode\n");
mbedalvaro 40:3ba2b0ea9f33 483 for (int i=0; i< scene.totalObjects(); i++) scene.objectArray[i]->displaySensingBuffer.setThresholdMode((stateswitch? 1 : 0));
mbedalvaro 40:3ba2b0ea9f33 484 }
mbedalvaro 40:3ba2b0ea9f33 485 //(2) Check the current pot value and update the "fixed threshold" when pressing second switch (I don't care if the threshold mode
mbedalvaro 40:3ba2b0ea9f33 486 // is fixed or not - this will set the VALUE of the fixed threshold)
mbedalvaro 40:3ba2b0ea9f33 487 // NOTE: as thresholding mode CAN be object dependent though, but this is a simple hardware command that set the fixed threshold for all the objects.
mbedalvaro 40:3ba2b0ea9f33 488 if (IO.switchTwoCheck(stateswitch)) {
mbedalvaro 40:3ba2b0ea9f33 489 IO.updatePotValue();
mbedalvaro 40:3ba2b0ea9f33 490 for (int i=0; i< scene.totalObjects(); i++) scene.objectArray[i]->displaySensingBuffer.setFixedThreshold(IO.potValue);
mbedalvaro 40:3ba2b0ea9f33 491 pc.printf("Fixed Threshold :%d\n", IO.potValue);
mbedalvaro 40:3ba2b0ea9f33 492 }
mbedalvaro 40:3ba2b0ea9f33 493 }
mbedalvaro 40:3ba2b0ea9f33 494