Para Juan
Dependencies: NAVDATA RA8875 mbed VCODATA
Diff: main.cpp
- Revision:
- 8:941a76c2d300
- Parent:
- 7:93da358c67a1
- Child:
- 9:fe7de0e11862
diff -r 93da358c67a1 -r 941a76c2d300 main.cpp --- a/main.cpp Thu Apr 13 21:00:52 2017 +0000 +++ b/main.cpp Fri Apr 14 04:54:50 2017 +0000 @@ -93,27 +93,36 @@ lcd.SetTextCursor(0,0); // Pongo cursor en posicion lcd.cls(); lcd.puts(">>>>>>>>>>>>>< Proyecto SNOCC ><<<<<<<<<<<<<<\r\n"); - lcd.SetTextCursor(0,30); - lcd.puts("Consumo (L/M)\r\n"); - lcd.SetTextCursor(200,220); - lcd.puts("Velocidad(Kn)\r\n"); - lcd.foreground(Red); - + lcd.roundrect( 5,25, 470,270, 10,8, RGB(255,255,0)); + //lcd.fillroundrect(415,165, 470,185, 5,3, Orange); + lcd.fillroundrect(10,30, 465,264, 5,3, Green); + lcd.background(Green); + lcd.foreground(Blue); + lcd.SetTextCursor(12,32); + lcd.puts("Consumo(l/m)\r\n"); + lcd.SetTextCursor(240,240); + lcd.puts("Velocidad(kn)\r\n"); + lcd.foreground(RGB(255,255,0)); for (int x=0;x<100;x++){ s = Matrix_VCO.NAV_DATA[x].LAST_NAV_DATA[cons_mile_p]; y=200-2*s; // el consumo máximo es alrededor de 100 l/m. Multiplico por 2 para que ocupe mas pantalla. z=x*4; // para aumentar el span (eje x) - lcd.SetTextCursor(z,y); + lcd.SetTextCursor(z+25,y); //lcd.printf("%d",x); lcd.printf("."); } s = Matrix_VCO.NAV_DATA[VCO].LAST_NAV_DATA[cons_mile_p];; y=200-2*s; // el consumo máximo es alrededor de 100 l/m. Multiplico por 2 para que ocupe mas pantalla. + if (VCO>0){ z=VCO*4; // para aumentar el span (eje x) - lcd.SetTextCursor(z,y); - //lcd.printf("%d",x); - lcd.printf("%d",VCO); - + lcd.SetTextCursor(z+25,y); + lcd.printf("*"); + } + else{ + lcd.SetTextCursor(45,60); + lcd.printf("No hay datos suficientes para obtener la VCO"); + //lcd.printf("%d",VCO); + } lcd.foreground(RGB(255,255,0)); lcd.background(Black); } @@ -133,6 +142,9 @@ TestNDO.LAST_NAV_DATA[speed_p]=x; Test_Matrix_VCO.store_data(TestNDO); } + TestNDO.LAST_NAV_DATA[cons_mile_p]=1; + TestNDO.LAST_NAV_DATA[speed_p]=55; + Test_Matrix_VCO.store_data(TestNDO); for (int i=1,x=59;i<40;i++,x++){ TestNDO.LAST_NAV_DATA[cons_mile_p]=i+1; TestNDO.LAST_NAV_DATA[speed_p]=x; @@ -220,23 +232,27 @@ // en el lugar correspondiente a la velocidad del preiodo (por ahora reemplaza...ver otras opciones) lcd.puts("Rotacion exitosa!-->"); - int i=int(NAVIGATION_TABLE.LAST_NAV_DATA[speed_p]); + int i=int(NAVIGATION_TABLE.LAST_NAV_DATA[speed_p]); + int VCO=NAVIGATION_VMATRIX.get_VCO(); float timetick_f_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[time_f]; // DEBUG float distance_p_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[distance_p]; // DEBUG float speed_p_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[speed_p]; // DEBUG float longitude_f_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[longitude_f]; // DEBUG float latitude_f_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[latitude_f]; // DEBUG float cons_hour_p_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[cons_hour_p]; - //lcd.printf("Algunos datos guardados en la Matriz: \r\n"); // DEBUG - lcd.printf("INDICE_Mtrx: %d\r\n",i); // DEBUG - /*lcd.printf("Speed_f_Mtrx(%d): %f kn.\r\n",i, speed_p_Mtrx); // DEBUG - lcd.printf("Time_f_Mtrx(%d): %f Hours.\r\n",i, timetick_f_Mtrx); // DEBUG - lcd.printf("Distance_p_Mtrx(%d): %f miles.\r\n",i,distance_p_Mtrx); // DEBUG - lcd.printf("Posicion: Long(%d): %f, Lat: %f\r\n",i,longitude_f_Mtrx,latitude_f_Mtrx); // DEBUG - lcd.printf("FlujoVCOmtrx(%d): %f Litros/Hora\r\n",i, cons_hour_p_Mtrx); // DEBUG - */ + float cons_mile_p_Mtrx = NAVIGATION_VMATRIX.NAV_DATA[i].LAST_NAV_DATA[cons_mile_p]; + //lcd.printf("Algunos datos guardados en la Matriz: \r\n"); // DEBUG + lcd.printf("INDICE_Mtrx: %d\r\n\r\n",i); // DEBUG + lcd.printf("Speed_f_Mtrx(%d): %f kn.\r\n",i, speed_p_Mtrx); // DEBUG + lcd.printf("Speed_f_Mtrx(%d): %f km/h.\r\n\r\n",i, speed_p_Mtrx*1.852); // DEBUG + lcd.printf("Time_f_Mtrx(%d): %f Hours.\r\n",i, timetick_f_Mtrx); // DEBUG + lcd.printf("Dist_p_Mtrx(%d): %f miles.\r\n",i,distance_p_Mtrx); // DEBUG + lcd.printf("Posicion: Long(%d): %f ; Lat: %f\r\n",i,longitude_f_Mtrx,latitude_f_Mtrx); // DEBUG + lcd.printf("FlujoVCOmtrx(%d): %f Litros/Hora\r\n",i, cons_hour_p_Mtrx); // DEBUG + lcd.printf("FlujoVCOmtrx(%d): %f Litros/Milla\r\n",i, cons_mile_p_Mtrx); // DEBUG + lcd.printf("VCO: %d km/h\r\n", VCO); //build_test_Mtrx(NAVIGATION_VMATRIX); // DEBUG Curve - print_VCO_curve(NAVIGATION_VMATRIX); + //print_VCO_curve(NAVIGATION_VMATRIX); } else { @@ -285,14 +301,14 @@ } - for (int i=0;i<100;i++) { + for (int i=0;i<200;i++) { point_t p; lcd.fillrect(PrintScreenRect, Green); lcd.foreground(Blue); lcd.background(Green); lcd.puts(425-60, 22, "GET CURVE"); lcd.background(Black); - //wait_us(5); + wait_us(5); if (lcd.TouchPanelReadable(&p)) { //lcd.foreground(Blue); //lcd.SetTextCursor(10, 15); @@ -302,7 +318,7 @@ if (Intersect(PrintScreenRect, p)) { lcd.foreground(Red); lcd.puts(400-38, 20, "GET CURVE"); - build_test_Mtrx(NAVIGATION_VMATRIX); // DEBUG Curve + //build_test_Mtrx(NAVIGATION_VMATRIX); // DEBUG Curve print_VCO_curve(NAVIGATION_VMATRIX); //lcd.foreground(RGB(255,255,0)); wait(10);