Para Juan

Dependencies:   NAVDATA RA8875 mbed VCODATA

Committer:
gstedile
Date:
Mon Apr 10 05:12:51 2017 +0000
Revision:
6:aebb3a0a040c
Parent:
5:56d63eaa8415
Child:
7:93da358c67a1
Agrego Touch Buttom que muestra curva de VCO

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gstedile 0:d92271b032c7 1
gstedile 0:d92271b032c7 2 #include "mbed.h" // v112
gstedile 0:d92271b032c7 3 #include "RA8875.h" // v102
gstedile 0:d92271b032c7 4 #include "MyFont18x32.h"
gstedile 0:d92271b032c7 5 #include "BPG_Arial08x08.h"
gstedile 0:d92271b032c7 6 #include "BPG_Arial10x10.h"
gstedile 0:d92271b032c7 7 #include "BPG_Arial20x20.h"
gstedile 0:d92271b032c7 8 #include "BPG_Arial31x32.h"
gstedile 0:d92271b032c7 9 #include "BPG_Arial63x63.h"
gstedile 0:d92271b032c7 10
gstedile 0:d92271b032c7 11 // Agrego includes para uso en la comunicacion con el gps.
gstedile 4:9901f6da64b7 12 #include "GPS.h"
gstedile 4:9901f6da64b7 13 // Agrego includes para la clase NAVDATA que maneja los datos de navegación del último período.
gstedile 4:9901f6da64b7 14 #include "NAVDATA.h"
gstedile 4:9901f6da64b7 15 // Agrego includes para la clase VCODATA que maneja los datos de navegación más recientes parametrizados por velocidad de cada período.
gstedile 3:0c9ee19fb976 16 #include "VCODATA.h"
gstedile 3:0c9ee19fb976 17
gstedile 4:9901f6da64b7 18 #include <sstream> //include this to use string streams
gstedile 4:9901f6da64b7 19 #include <string>
gstedile 0:d92271b032c7 20
gstedile 3:0c9ee19fb976 21 float Counter=0; //Contador de pulsos del sensor de flujo.
gstedile 3:0c9ee19fb976 22 float LCounter=0; //Consumo en litros
gstedile 3:0c9ee19fb976 23 float Consumo_km=0; //Consumo en litros/km.
gstedile 3:0c9ee19fb976 24 NAVDATA NAVIGATION_TABLE; //Objeto que maneja los datos de navegación del último período. $
gstedile 3:0c9ee19fb976 25 VCODATA NAVIGATION_VMATRIX(NAVIGATION_TABLE); // Objeto que maneja la matriz de datos de navegación $
gstedile 0:d92271b032c7 26
gstedile 0:d92271b032c7 27
gstedile 0:d92271b032c7 28
gstedile 4:9901f6da64b7 29 LocalFileSystem local("local"); // Because I want <PrintScreen>
gstedile 4:9901f6da64b7 30 Serial pc(USBTX, USBRX); // And a little feedback
gstedile 0:d92271b032c7 31
gstedile 4:9901f6da64b7 32 RA8875 lcd(p5, p6, p7, p12, NC, "tft"); // MOSI, MISO, SCK, /ChipSelect, /reset, name
gstedile 0:d92271b032c7 33
gstedile 6:aebb3a0a040c 34 //>>>>>>>>>>>>>>>>>> SECCION AGREGADA PROVISORIAMENTE PARA EL TOUCH PANEL <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
gstedile 6:aebb3a0a040c 35
gstedile 6:aebb3a0a040c 36 extern "C" void mbed_reset();
gstedile 6:aebb3a0a040c 37
gstedile 6:aebb3a0a040c 38
gstedile 6:aebb3a0a040c 39 #define min(a,b) ((a<b)?a:b)
gstedile 6:aebb3a0a040c 40 #define max(a,b) ((a>b)?a:b)
gstedile 6:aebb3a0a040c 41
gstedile 6:aebb3a0a040c 42 bool Intersect(rect_t rect, point_t p)
gstedile 6:aebb3a0a040c 43 {
gstedile 6:aebb3a0a040c 44 if (p.x >= min(rect.p1.x, rect.p2.x) && p.x <= max(rect.p1.x, rect.p2.x)
gstedile 6:aebb3a0a040c 45 && p.y >= min(rect.p1.y, rect.p2.y) && p.y <= max(rect.p1.y, rect.p2.y))
gstedile 6:aebb3a0a040c 46 return true;
gstedile 6:aebb3a0a040c 47 else
gstedile 6:aebb3a0a040c 48 return false;
gstedile 6:aebb3a0a040c 49 }
gstedile 6:aebb3a0a040c 50
gstedile 6:aebb3a0a040c 51 int GetScreenCapture(void)
gstedile 6:aebb3a0a040c 52 {
gstedile 6:aebb3a0a040c 53 char fqfn[50];
gstedile 6:aebb3a0a040c 54 int i = 0;
gstedile 6:aebb3a0a040c 55
gstedile 6:aebb3a0a040c 56 pc.printf("Screen Capture... ");
gstedile 6:aebb3a0a040c 57 for (i=1; i< 100; i++) {
gstedile 6:aebb3a0a040c 58 snprintf(fqfn, sizeof(fqfn), "/local/Screen%02d.bmp", i);
gstedile 6:aebb3a0a040c 59 FILE * fh = fopen(fqfn, "rb");
gstedile 6:aebb3a0a040c 60 if (!fh) {
gstedile 6:aebb3a0a040c 61 lcd.PrintScreen(0,0,480,272,fqfn);
gstedile 6:aebb3a0a040c 62 pc.printf(" as /local/Screen%02d.bmp\r\n", i);
gstedile 6:aebb3a0a040c 63 return i;
gstedile 6:aebb3a0a040c 64 } else {
gstedile 6:aebb3a0a040c 65 fclose(fh); // close this and try the next
gstedile 6:aebb3a0a040c 66 }
gstedile 6:aebb3a0a040c 67 }
gstedile 6:aebb3a0a040c 68 return 0;
gstedile 6:aebb3a0a040c 69 }
gstedile 6:aebb3a0a040c 70 //>>>>>>>>>>>>>>>>>> FIN SECCION AGREGADA PROVISORIAMENTE PARA EL TOUCH PANEL <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
gstedile 6:aebb3a0a040c 71
gstedile 6:aebb3a0a040c 72
gstedile 6:aebb3a0a040c 73
gstedile 6:aebb3a0a040c 74
gstedile 6:aebb3a0a040c 75
gstedile 6:aebb3a0a040c 76
gstedile 4:9901f6da64b7 77 void trigger() { //Función para la interrupción
gstedile 0:d92271b032c7 78 Counter++;
gstedile 0:d92271b032c7 79 LCounter=Counter/2500;
gstedile 0:d92271b032c7 80 //point_t p_cursor = lcd.GetTextCursor();
gstedile 0:d92271b032c7 81 //lcd.SetTextCursor(0,200);
gstedile 0:d92271b032c7 82 //lcd.printf("Flujo %d pulsos", Counter);
gstedile 0:d92271b032c7 83 //lcd.SetTextCursor(p_cursor);
gstedile 0:d92271b032c7 84 }
gstedile 5:56d63eaa8415 85 /* Funcion print_VCO_curve : Imprime la curva de consumo/milla en funcion de la velocidad a partir del vector de objetos NAV_DATA de la clase VCODATA.*/
gstedile 5:56d63eaa8415 86
gstedile 5:56d63eaa8415 87 void print_VCO_curve(VCODATA Matrix_VCO){
gstedile 5:56d63eaa8415 88 int s,y,z;
gstedile 6:aebb3a0a040c 89
gstedile 6:aebb3a0a040c 90 lcd.background(RGB(255,255,255));
gstedile 6:aebb3a0a040c 91 lcd.foreground(Blue);
gstedile 6:aebb3a0a040c 92 lcd.SetTextCursor(0,0); // Pongo cursor en posicion
gstedile 6:aebb3a0a040c 93 lcd.cls();
gstedile 6:aebb3a0a040c 94 lcd.puts(">>>>>>>>>>>>>< Proyecto SNOCC ><<<<<<<<<<<<<<\r\n");
gstedile 6:aebb3a0a040c 95 lcd.SetTextCursor(0,30);
gstedile 6:aebb3a0a040c 96 lcd.puts("Consumo (L/M)\r\n");
gstedile 6:aebb3a0a040c 97 lcd.SetTextCursor(200,220);
gstedile 6:aebb3a0a040c 98 lcd.puts("Velocidad(Kn)\r\n");
gstedile 6:aebb3a0a040c 99 lcd.foreground(Red);
gstedile 5:56d63eaa8415 100 for (int x=0;x<100;x++){
gstedile 5:56d63eaa8415 101 s = Matrix_VCO.NAV_DATA[x].LAST_NAV_DATA[cons_mile_p];
gstedile 5:56d63eaa8415 102 y=200-2*s; // el consumo máximo es alrededor de 100 l/m. Multiplico por 2 para que ocupe mas pantalla.
gstedile 5:56d63eaa8415 103 z=x*4; // para aumentar el span (eje x)
gstedile 5:56d63eaa8415 104 lcd.SetTextCursor(z,y);
gstedile 5:56d63eaa8415 105 //lcd.printf("%d",x);
gstedile 5:56d63eaa8415 106 lcd.printf(".");
gstedile 5:56d63eaa8415 107 }
gstedile 6:aebb3a0a040c 108 lcd.foreground(RGB(255,255,0));
gstedile 6:aebb3a0a040c 109 lcd.background(Black);
gstedile 5:56d63eaa8415 110 }
gstedile 5:56d63eaa8415 111
gstedile 5:56d63eaa8415 112
gstedile 6:aebb3a0a040c 113 /* Funcion build_test_Mtrx: Carga los datos (consumo/milla) del vector LAST_NAV_DATA de los objetos NAVDATA de VCODATA para testing.*/
gstedile 5:56d63eaa8415 114
gstedile 5:56d63eaa8415 115 void build_test_Mtrx(VCODATA Test_Matrix_VCO){
gstedile 5:56d63eaa8415 116 NAVDATA TestNDO;
gstedile 5:56d63eaa8415 117 for (int i=0;i<50;i++){
gstedile 6:aebb3a0a040c 118 TestNDO.LAST_NAV_DATA[cons_mile_p]=i+1;
gstedile 5:56d63eaa8415 119 TestNDO.LAST_NAV_DATA[speed_p]=i;
gstedile 5:56d63eaa8415 120 Test_Matrix_VCO.store_data(TestNDO);
gstedile 5:56d63eaa8415 121 }
gstedile 5:56d63eaa8415 122 for (int i=50,x=50;i>0;i--,x++){
gstedile 5:56d63eaa8415 123 TestNDO.LAST_NAV_DATA[cons_mile_p]=i;
gstedile 5:56d63eaa8415 124 TestNDO.LAST_NAV_DATA[speed_p]=x;
gstedile 5:56d63eaa8415 125 Test_Matrix_VCO.store_data(TestNDO);
gstedile 5:56d63eaa8415 126 }
gstedile 5:56d63eaa8415 127 }
gstedile 5:56d63eaa8415 128
gstedile 0:d92271b032c7 129
gstedile 0:d92271b032c7 130 int main()
gstedile 0:d92271b032c7 131 {
gstedile 0:d92271b032c7 132 pc.baud(460800); // I like a snappy terminal, so crank it up!
gstedile 0:d92271b032c7 133 pc.printf("\r\nRA8875 Soft Fonts - Build " __DATE__ " " __TIME__ "\r\n");
gstedile 0:d92271b032c7 134
gstedile 0:d92271b032c7 135 lcd.init();
gstedile 6:aebb3a0a040c 136
gstedile 6:aebb3a0a040c 137 lcd.TouchPanelCalibrate("Calibrate the touch panel"); // 4 touch
gstedile 6:aebb3a0a040c 138 lcd.cls();
gstedile 6:aebb3a0a040c 139
gstedile 6:aebb3a0a040c 140 rect_t PrintScreenRect = { 425-65, 20, 425+65, 60};
gstedile 6:aebb3a0a040c 141
gstedile 4:9901f6da64b7 142
gstedile 4:9901f6da64b7 143 // **************************
gstedile 0:d92271b032c7 144 //RunTestSet(lcd, pc); // If the library was compiled for test mode...
gstedile 0:d92271b032c7 145
gstedile 0:d92271b032c7 146 lcd.foreground(RGB(255,255,0)); // Seteo del color de las letras.
gstedile 0:d92271b032c7 147 lcd.SelectUserFont(BPG_Arial20x20); // Seleccion de tipo y tamaño de letras
gstedile 0:d92271b032c7 148 //lcd.puts("BPG_Arial63x63");
gstedile 6:aebb3a0a040c 149
gstedile 0:d92271b032c7 150 GPS gps(p9, p10); // Agrego para comunicacion con el GPS
gstedile 0:d92271b032c7 151
gstedile 0:d92271b032c7 152 //Inicializo variables para el sensor de flujo
gstedile 0:d92271b032c7 153 //----------------------------------------------------
gstedile 0:d92271b032c7 154 DigitalOut myled(LED1);
gstedile 0:d92271b032c7 155 DigitalOut myled2(LED2);
gstedile 0:d92271b032c7 156 DigitalOut myled3(LED3);
gstedile 0:d92271b032c7 157 DigitalOut myled4(LED4);
gstedile 0:d92271b032c7 158
gstedile 0:d92271b032c7 159
gstedile 0:d92271b032c7 160 //DebounceIn pb(p8);
gstedile 0:d92271b032c7 161 /*DigitalIn pb(p11);
gstedile 0:d92271b032c7 162 int count=0; //Comento esto porque voy a usar interrupciones
gstedile 0:d92271b032c7 163 int old_pb=0;
gstedile 0:d92271b032c7 164 int new_pb;
gstedile 0:d92271b032c7 165 // Use internal pullup for pushbutton
gstedile 0:d92271b032c7 166 pb.mode(PullUp);
gstedile 0:d92271b032c7 167 //pb.mode(PullNone);
gstedile 0:d92271b032c7 168 // Delay for initial pullup to take effect
gstedile 0:d92271b032c7 169 wait(.001);*/
gstedile 0:d92271b032c7 170
gstedile 4:9901f6da64b7 171 //----------------------------------------------------
gstedile 4:9901f6da64b7 172 // Sensor de flujo:
gstedile 0:d92271b032c7 173 //-----------------------------------------------------
gstedile 0:d92271b032c7 174 InterruptIn pulse_sensor(p11); // Defino pulse_sensor como una entrada de interrupción en p11.
gstedile 0:d92271b032c7 175 pulse_sensor.mode(PullUp); // PullUp para esa entrada.
gstedile 0:d92271b032c7 176 //DigitalOut led(LED1);
gstedile 0:d92271b032c7 177 pulse_sensor.rise(&trigger); // Dispara interrupción con flanco ascendente. (Podría tambien ser desecendente--> fall)
gstedile 0:d92271b032c7 178
gstedile 4:9901f6da64b7 179
gstedile 4:9901f6da64b7 180
gstedile 4:9901f6da64b7 181
gstedile 4:9901f6da64b7 182 while(1) {
gstedile 4:9901f6da64b7 183
gstedile 5:56d63eaa8415 184 lcd.SetTextCursor(0,0); // Pongo cursor en posicion
gstedile 5:56d63eaa8415 185 lcd.puts(">>>>>>>>>>>>>< Proyecto SNOCC ><<<<<<<<<<<<<<\r\n");
gstedile 4:9901f6da64b7 186
gstedile 0:d92271b032c7 187
gstedile 0:d92271b032c7 188 //-----------------------------------------------------
gstedile 0:d92271b032c7 189
gstedile 3:0c9ee19fb976 190 //lcd.SetTextCursor(0,20);
gstedile 0:d92271b032c7 191 //lcd.printf("M0: %s \r\n\r\n", gps.msg); //Imprimo el mensaje crudo proveniente de la uart
gstedile 0:d92271b032c7 192 //lcd.printf("M1: %s \r\n", gps.mensaje1);
gstedile 0:d92271b032c7 193 //lcd.printf("M2: %s \r\n", gps.mensaje2);
gstedile 0:d92271b032c7 194 //lcd.printf("M3: %s \r\n", gps.mensaje3);
gstedile 0:d92271b032c7 195 //lcd.printf("M4: %s \r\n", gps.mensaje4);
gstedile 0:d92271b032c7 196 //lcd.printf("Posicion actual_0: %f, %f \r\n", gps.longitude, gps.latitude);
gstedile 0:d92271b032c7 197 //lcd.printf("Contador = %d", Counter);
gstedile 0:d92271b032c7 198
gstedile 0:d92271b032c7 199 if(gps.sample()) { // Si es exitosa la obtencion de datos del gps.
gstedile 3:0c9ee19fb976 200 lcd.cls();
gstedile 5:56d63eaa8415 201 lcd.SetTextCursor(0,0); // Pongo cursor en posicion
gstedile 5:56d63eaa8415 202 lcd.puts(">>>>>>>>>>>>>< Proyecto SNOCC ><<<<<<<<<<<<<<\r\n");
gstedile 3:0c9ee19fb976 203
gstedile 4:9901f6da64b7 204 if (NAVIGATION_TABLE.rotate_data(gps.longitude, gps.latitude, gps.time, Counter)){
gstedile 4:9901f6da64b7 205 NAVIGATION_VMATRIX.store_data(NAVIGATION_TABLE);// Luego de rotar los datos en la tabla de navegacion, la guarda en la matriz,
gstedile 4:9901f6da64b7 206 // en el lugar correspondiente a la velocidad del preiodo (por ahora reemplaza...ver otras opciones)
gstedile 5:56d63eaa8415 207
gstedile 5:56d63eaa8415 208 lcd.puts("Rotacion exitosa!-->");
gstedile 5:56d63eaa8415 209 int i=int(NAVIGATION_TABLE.LAST_NAV_DATA[speed_p]);
gstedile 4:9901f6da64b7 210 float timetick_f_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[time_f]; // DEBUG
gstedile 4:9901f6da64b7 211 float distance_p_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[distance_p]; // DEBUG
gstedile 4:9901f6da64b7 212 float speed_p_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[speed_p]; // DEBUG
gstedile 4:9901f6da64b7 213 float longitude_f_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[longitude_f]; // DEBUG
gstedile 4:9901f6da64b7 214 float latitude_f_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[latitude_f]; // DEBUG
gstedile 4:9901f6da64b7 215 float cons_hour_p_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[cons_hour_p];
gstedile 5:56d63eaa8415 216 //lcd.printf("Algunos datos guardados en la Matriz: \r\n"); // DEBUG
gstedile 5:56d63eaa8415 217 lcd.printf("INDICE_Mtrx: %d\r\n",i); // DEBUG
gstedile 5:56d63eaa8415 218 /*lcd.printf("Speed_f_Mtrx(%d): %f kn.\r\n",i, speed_p_Mtrx); // DEBUG
gstedile 5:56d63eaa8415 219 lcd.printf("Time_f_Mtrx(%d): %f Hours.\r\n",i, timetick_f_Mtrx); // DEBUG
gstedile 5:56d63eaa8415 220 lcd.printf("Distance_p_Mtrx(%d): %f miles.\r\n",i,distance_p_Mtrx); // DEBUG
gstedile 5:56d63eaa8415 221 lcd.printf("Posicion: Long(%d): %f, Lat: %f\r\n",i,longitude_f_Mtrx,latitude_f_Mtrx); // DEBUG
gstedile 5:56d63eaa8415 222 lcd.printf("FlujoVCOmtrx(%d): %f Litros/Hora\r\n",i, cons_hour_p_Mtrx); // DEBUG
gstedile 5:56d63eaa8415 223 */
gstedile 6:aebb3a0a040c 224 //build_test_Mtrx(NAVIGATION_VMATRIX); // DEBUG Curve
gstedile 5:56d63eaa8415 225 print_VCO_curve(NAVIGATION_VMATRIX);
gstedile 4:9901f6da64b7 226 }
gstedile 3:0c9ee19fb976 227 else
gstedile 4:9901f6da64b7 228 {
gstedile 3:0c9ee19fb976 229 lcd.puts("Periodo no valido!\r\n");
gstedile 4:9901f6da64b7 230 int i=int(NAVIGATION_TABLE.LAST_NAV_DATA[speed_p]);
gstedile 4:9901f6da64b7 231 float timetick_f_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[time_f]; // DEBUG
gstedile 4:9901f6da64b7 232 float distance_p_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[distance_p]; // DEBUG
gstedile 4:9901f6da64b7 233 float speed_p_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[speed_p]; // DEBUG
gstedile 4:9901f6da64b7 234 float longitude_f_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[longitude_f]; // DEBUG
gstedile 4:9901f6da64b7 235 float latitude_f_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[latitude_f]; // DEBUG
gstedile 4:9901f6da64b7 236 float cons_hour_p_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[cons_hour_p]; // DEBUG
gstedile 4:9901f6da64b7 237 lcd.printf("Algunos datos guardados en la Matriz: \r\n"); // DEBUG
gstedile 5:56d63eaa8415 238 lcd.printf("INDICE_Mtrx: %d (Parte entera de speed)\r\n",i); // DEBUG
gstedile 5:56d63eaa8415 239 lcd.printf("Speed_f_Mtrx(%d): %f kn.\r\n",i, speed_p_Mtrx); // DEBUG
gstedile 5:56d63eaa8415 240 lcd.printf("Time_f_Mtrx(%d): %f Hours.\r\n",i, timetick_f_Mtrx); // DEBUG
gstedile 5:56d63eaa8415 241 lcd.printf("Distance_p_Mtrx(%d): %f miles.\r\n",i,distance_p_Mtrx); // DEBUG
gstedile 5:56d63eaa8415 242 lcd.printf("Posicion: Long(%d): %f, Lat: %f\r\n",i,longitude_f_Mtrx,latitude_f_Mtrx); // DEBUG
gstedile 5:56d63eaa8415 243 lcd.printf("FlujoVCOmtrx(%d): %f Litros/Hora\r\n",i, cons_hour_p_Mtrx); // DEBUG
gstedile 4:9901f6da64b7 244 }
gstedile 4:9901f6da64b7 245 /* lcd.SetTextCursor(0,80);
gstedile 3:0c9ee19fb976 246 //lcd.printf("Posicion: %f, %f\r\n", gps.longitude, gps.latitude);
gstedile 4:9901f6da64b7 247 lcd.printf("Posicion: %f, %f\r\n", NAVIGATION_TABLE.LAST_NAV_DATA[longitude_f], NAVIGATION_TABLE.LAST_NAV_DATA[latitude_f]); // $
gstedile 3:0c9ee19fb976 248 //lcd.printf("Velocidad %f km/h", gps.speed);
gstedile 3:0c9ee19fb976 249 lcd.printf("Distancia_p %f km\r\n", NAVIGATION_TABLE.LAST_NAV_DATA[distance_p]);
gstedile 3:0c9ee19fb976 250 lcd.printf("Velocidad %f km/h\r\n", NAVIGATION_TABLE.LAST_NAV_DATA[speed_p]);
gstedile 3:0c9ee19fb976 251 lcd.printf("Timetick_i %f h\r\n", NAVIGATION_TABLE.LAST_NAV_DATA[time_i]);
gstedile 3:0c9ee19fb976 252 lcd.printf("Timetick_f %f h\r\n", NAVIGATION_TABLE.LAST_NAV_DATA[time_f]);
gstedile 3:0c9ee19fb976 253 lcd.printf("Timetick_gps %f NMEA\r\n", gps.time);
gstedile 4:9901f6da64b7 254 // lcd.printf("Consumo %f l/km", getConsumo(Count; gps.speed); */
gstedile 5:56d63eaa8415 255 //lcd.SetTextCursor(0,220);
gstedile 4:9901f6da64b7 256 //lcd.printf("Flujo %f Litros/Hora\r\n", NAVIGATION_TABLE.LAST_NAV_DATA[cons_hour_p]);
gstedile 4:9901f6da64b7 257 //lcd.printf("FlujoVCOmtrx %f Litros/Hora\r\n", cons_hour_p_Mtrx);
gstedile 5:56d63eaa8415 258 //lcd.printf("Flujo acumulado (contador):%f Litros\r\n", LCounter);
gstedile 0:d92271b032c7 259
gstedile 4:9901f6da64b7 260 }
gstedile 4:9901f6da64b7 261 else {
gstedile 0:d92271b032c7 262 lcd.cls();
gstedile 5:56d63eaa8415 263 lcd.SetTextCursor(0,0); // Pongo cursor en posicion
gstedile 5:56d63eaa8415 264 lcd.puts(">>>>>>>>>>>>>< Proyecto SNOCC ><<<<<<<<<<<<<<\r\n");
gstedile 0:d92271b032c7 265 lcd.SetTextCursor(0,100);
gstedile 6:aebb3a0a040c 266 lcd.printf("Aun no hay datos disponibles :(\r\n");
gstedile 3:0c9ee19fb976 267 lcd.SetTextCursor(0,180);
gstedile 6:aebb3a0a040c 268 lcd.printf("Timetick %f h\r\n", NAVIGATION_TABLE.LAST_NAV_DATA[time_f]);
gstedile 6:aebb3a0a040c 269 lcd.printf("Flujo Mtrx: %f Litros/Hora\r\n", NAVIGATION_TABLE.LAST_NAV_DATA[cons_hour_p]);
gstedile 6:aebb3a0a040c 270 lcd.printf("Flujo Counter: %f Litros\r\n", LCounter);
gstedile 0:d92271b032c7 271 }
gstedile 6:aebb3a0a040c 272
gstedile 6:aebb3a0a040c 273
gstedile 6:aebb3a0a040c 274 for (int i=0;i<100;i++) {
gstedile 6:aebb3a0a040c 275 point_t p;
gstedile 6:aebb3a0a040c 276 lcd.fillrect(PrintScreenRect, Green);
gstedile 6:aebb3a0a040c 277 lcd.foreground(Blue);
gstedile 6:aebb3a0a040c 278 lcd.background(Green);
gstedile 6:aebb3a0a040c 279 lcd.puts(425-60, 22, "GET CURVE");
gstedile 6:aebb3a0a040c 280 lcd.background(Black);
gstedile 6:aebb3a0a040c 281 //wait_us(5);
gstedile 6:aebb3a0a040c 282 if (lcd.TouchPanelReadable(&p)) {
gstedile 6:aebb3a0a040c 283 //lcd.foreground(Blue);
gstedile 6:aebb3a0a040c 284 //lcd.SetTextCursor(10, 15);
gstedile 6:aebb3a0a040c 285 //lcd.printf("(%3d,%3d)", p.x, p.y);
gstedile 6:aebb3a0a040c 286 //lcd.foreground(RGB(255,255,0));
gstedile 6:aebb3a0a040c 287
gstedile 6:aebb3a0a040c 288 if (Intersect(PrintScreenRect, p)) {
gstedile 6:aebb3a0a040c 289 lcd.foreground(Red);
gstedile 6:aebb3a0a040c 290 lcd.puts(400-38, 20, "GET CURVE");
gstedile 6:aebb3a0a040c 291 build_test_Mtrx(NAVIGATION_VMATRIX); // DEBUG Curve
gstedile 6:aebb3a0a040c 292 print_VCO_curve(NAVIGATION_VMATRIX);
gstedile 6:aebb3a0a040c 293 //lcd.foreground(RGB(255,255,0));
gstedile 6:aebb3a0a040c 294 wait(10);
gstedile 6:aebb3a0a040c 295 break;
gstedile 6:aebb3a0a040c 296 //GetScreenCapture();
gstedile 6:aebb3a0a040c 297 }
gstedile 6:aebb3a0a040c 298
gstedile 6:aebb3a0a040c 299 /*for (int i=0; i<3; i++) {
gstedile 6:aebb3a0a040c 300 if (Intersect(RGBList[i], p)) {
gstedile 6:aebb3a0a040c 301 uint8_t mag = (255 * (p.x - RGBList[i].p1.x)) / (RGBList[i].p2.x - RGBList[i].p1.x);
gstedile 6:aebb3a0a040c 302 rgbVal[i] = mag;
gstedile 6:aebb3a0a040c 303 lcd.SetTextCursor(380, 15);
gstedile 6:aebb3a0a040c 304 lcd.foreground(Blue);
gstedile 6:aebb3a0a040c 305 //lcd.printf("(%02X,%02X,%02X)", rgbVal[0], rgbVal[1], rgbVal[2]);
gstedile 6:aebb3a0a040c 306 //rgb = RGB(rgbVal[0], rgbVal[1], rgbVal[2]);
gstedile 6:aebb3a0a040c 307 //lcd.fillrect(RGBList[3], rgb);
gstedile 6:aebb3a0a040c 308 break;
gstedile 6:aebb3a0a040c 309 }*/
gstedile 6:aebb3a0a040c 310 }
gstedile 6:aebb3a0a040c 311 lcd.foreground(RGB(255,255,0));
gstedile 6:aebb3a0a040c 312 }
gstedile 6:aebb3a0a040c 313 }
gstedile 4:9901f6da64b7 314 }
gstedile 6:aebb3a0a040c 315
gstedile 6:aebb3a0a040c 316