Rihards Balass / 4DGL-mbed-32PTU
Revision:
4:50511ed54ab4
Parent:
3:dcfbceb81fef
Child:
5:890ddd974624
--- a/Picaso_4DGL-32PTU_graphics.cpp	Fri Sep 09 10:19:54 2016 +0000
+++ b/Picaso_4DGL-32PTU_graphics.cpp	Fri Sep 09 12:45:28 2016 +0000
@@ -363,4 +363,54 @@
     writeCOMMAND(command, 16);
 }
 
+//**************************************************************************
+// The Calculate Orbit command calculates the x, y coordinates of a distant point relative
+// to the current origin, where the only known parameters are the angle and the distance
+// from the current origin. The new coordinates are calculated and then placed in the
+// destination variables Xdest and Ydest.
+//**************************************************************************
+void PICASO_4DGL :: calculateOrbit(short angle, short distance) {
+    
+    int i, temp = 0, resp = 0;
+    char response[5] = "";
+    char command[6] = "";
+    
+    command[0] = (CALCULATE_ORBIT >> (8*1)) & 0xff;
+    command[1] = (CALCULATE_ORBIT >> (8*0)) & 0xff;
+    command[2] = (angle >> (8*1)) & 0xff;
+    command[3] = (angle >> (8*0)) & 0xff;
+    command[4] = (distance >> (8*1)) & 0xff;
+    command[5] = (distance >> (8*0)) & 0xff;
+    
+    writeCOMMAND(command, 6);
+/*
+    freeBUFFER();
 
+    for (i = 0; i < 6; i++) writeBYTE(command[i]); // send command to serial port
+    
+    while (!_cmd.readable()) wait_ms(TEMPO);    // wait for screen answer
+
+    while (_cmd.readable()) {
+        temp = _cmd.getc();
+        response[resp++] = (char)temp;
+    }
+    switch (resp) {
+        case 5 :
+            pc.printf("   Orbit received : 0x %02X %02X %02X %02X %02X\n\r", response[0], response[1], response[2], response[3], response[4]);
+            //resp = (int)response[1];            // if OK populate data
+            break;
+        default :
+            //resp =  -1;                         // else return   0
+            break;
+    }
+    #if DEBUGMODE
+        //pc.printf("   Answer received : %d\n\r", resp);
+    #endif
+*/
+    //return resp;
+}
+
+
+
+
+