This is a fork of a functional ILI9341 display with a functional Seeed touch screen library.

Dependencies:   BMP180 UniGraphic mbed BNO055_fusionI_fixed HTU21D GPSISR Compass Fonts uGUI

Fork of TFT_test_NUCLEO-F411RE by Motoo Tanaka

/media/uploads/trevieze/win_20170427_21_31_20_pro.jpg

Had to move sensors to a remote board because of interference. Added spi burst mode to supported displays.

To do.... ugui buttons are slow. will need to add rtos to project. Finish other way points screen. Will have to rewrite portions of the touch screen class. Sense touch, delay, read values and then average, touch released, is the sequence. Add cadence input and logic to program for computer screen.

Revision:
17:4f10efd72d9d
Parent:
15:27e0a1721d13
--- a/main.cpp	Fri Apr 28 01:53:32 2017 +0000
+++ b/main.cpp	Thu Jul 20 19:34:41 2017 +0000
@@ -34,7 +34,6 @@
 #include "GPSISR.h"
 #include "nav.h"
 
-
 #include "ArialR16x17.h"
 #include "Arial24x23i.h"
 #include "Arial28x28.h"
@@ -42,7 +41,7 @@
 #include "SCProSB31x55.h"
 #include "Arial12x12.h"
 #include "ArialR20x20.h"
-#include "Compass.h"
+#include "compass.h"
 
 //#define PIN_CS_TSC      PA_9
 //#define PIN_TSC_INTR    PA_8
@@ -134,9 +133,9 @@
 void window_3_callback( UG_MESSAGE* msg );
 void cb1(void);
 
-const int centreX = 120;
-const int centreY = 150;
-const int radius  = 40;
+const int centreX = 100;
+const int centreY = 120;
+const int radius  = 180;
 float last_dx;
 float last_dy;
 
@@ -146,14 +145,6 @@
 #define PAGE2       2
 #define PAGE3       3
 
-const UG_BMP compass = {
-    (void*) compass_bmp ,
-    200 ,
-    200 ,
-    BMP_BPP_16 ,
-    BMP_RGB565
-} ;
-
 UG_GUI   gui;
 
 //Ticker to1;
@@ -242,14 +233,7 @@
     UG_ButtonSetFont (&window_3 , BTN_ID_5 , &FONT_8X8) ;
     UG_ButtonSetText (&window_3 , BTN_ID_4 , "Prev" );
     UG_ButtonSetText (&window_3 , BTN_ID_5 , "Next" );
-
-    /* Finally , show the window */
-    //UG_WindowShow(&window_1) ;
-    //UG_WindowHide(&window_2);
-    //UG_WindowHide(&window_3);
-
-    //UG_Update();
-
+  
     while (1) {
 
         cb1();
@@ -343,7 +327,17 @@
                         UG_WindowHide(&window_3);
                         UG_WindowShow(&window_2);
                         UG_Update();
-                        TFT.Bitmap(10,20,200,200,(unsigned char*)compass_bmp);
+                        if (imu.read_calib_status() > 0x0) {
+                            TFT.drawXBitmap(20,35,compass,compass_width,compass_height,C_WHITE);
+                            float angle = euler_angles.h; // Convert radians to degrees for more a more usual result
+                            // For the screen -X = up and +X = down and -Y = left and +Y = right, so does not follow coordinate conventions
+                            float dx = (radius * cos((angle-90)*PI/180)) + centreX;  // calculate X position for the screen coordinates - can be confusing!
+                            float dy = (radius * sin((angle-90)*PI/180)) + centreY;  // calculate Y position for the screen coordinates - can be confusing!
+                            arrow(last_dx,last_dy, centreX, centreY, 2,2,UG_WindowGetBackColor(&window_2));      // Erase last arrow
+                            arrow(dx,dy, centreX, centreY, 2, 2,C_WHITE);               // Draw arrow in new position
+                            last_dx = dx;
+                            last_dy = dy;
+                        }
                     }
                     pageinit = 1;
                     break;
@@ -408,14 +402,7 @@
         }
         }
 
-        float angle = euler_angles.h; // Convert radians to degrees for more a more usual result
-        // For the screen -X = up and +X = down and -Y = left and +Y = right, so does not follow coordinate conventions
-        float dx = (radius * cos((angle-90)*PI/180)) + centreX;  // calculate X position for the screen coordinates - can be confusing!
-        float dy = (radius * sin((angle-90)*PI/180)) + centreY;  // calculate Y position for the screen coordinates - can be confusing!
-        arrow(last_dx,last_dy, centreX, centreY, 2,2,White);      // Erase last arrow
-        arrow(dx,dy, centreX, centreY, 2, 2,Blue);               // Draw arrow in new position
-        last_dx = dx;
-        last_dy = dy;
+
 
 
         }
@@ -445,15 +432,15 @@
     TFT.set_font((unsigned char*) Arial12x12);
     TFT.foreground(Blue);
     TFT.background(White);
-    TFT.locate((centreX-2),(centreY-24));
-    TFT.printf("N");
-    TFT.locate((centreX-2),(centreY+17));
-    TFT.printf("S");
-    TFT.locate((centreX+19),(centreY-3));
-    TFT.printf("E");
-    TFT.locate((centreX-23),(centreY-3));
-    TFT.printf("W");
-    TFT.set_font((unsigned char*) ArialR20x20);
+    //TFT.locate((centreX-2),(centreY-24));
+    //TFT.printf("N");
+    //TFT.locate((centreX-2),(centreY+17));
+    //TFT.printf("S");
+    //TFT.locate((centreX+19),(centreY-3));
+    //TFT.printf("E");
+    //TFT.locate((centreX-23),(centreY-3));
+    //TFT.printf("W");
+    //TFT.set_font((unsigned char*) ArialR20x20);
 }
 
 void Draw_Compass_Rose(void)