code de la carte IHM avant les bugs et avant le travail effectué avec Melchior

Dependencies:   mbed SerialHalfDuplex SDFileSystem liaison_Bluetooth ident_crac DISCO-F469NI_portrait

Revision:
27:ff70537a7619
Parent:
24:1a13c998c7ac
Child:
28:7f2990747e09
--- a/IHM/ihm.cpp	Wed Jul 08 08:47:26 2020 +0000
+++ b/IHM/ihm.cpp	Wed Jul 08 11:24:24 2020 +0000
@@ -9,6 +9,7 @@
 #define NOIR 0xFF000000
 #define DIY_GREY 0xFFDFDFDF
 #define VIOLET 0xFF4527A0
+#define VERT_F 0xFF00C400
 TS_DISCO_F469NI ts;
 LCD_DISCO_F469NI lcd;
 
@@ -47,6 +48,9 @@
 ////////////////////////////////////////////////////////////
 
 signed char Bouton_Strat (void);
+void DrawC (int l,int h,int x, int y, unsigned char fill);
+void DrawR (int l,int h,int x, int y, unsigned char fill);
+void DrawA (int l,int h,int x, int y, unsigned char fill);
 
 void SelectionStrat (unsigned char numeroStrat);
 
@@ -72,16 +76,18 @@
             lcd.SetTextColor(LCD_COLOR_BLACK);
             lcd.Clear (LCD_COLOR_WHITE);
             wait(0.15);
-            lcd.DisplayStringAt(0, 10, (uint8_t *)"Verification des cartes", LEFT_MODE);
-            //cartes non verifiées////////////////
-            lcd.SetTextColor(DIY_GREY);
-            lcd.FillRect(0,400,400,150); //carte moteur
-            lcd.FillRect(0,600,400,150); //Balise
-            lcd.SetTextColor(LCD_COLOR_BLACK);
-            lcd.SetBackColor(DIY_GREY);
-            lcd.DisplayStringAt(80, 450, (uint8_t *)"Carte Moteur", LEFT_MODE);
-            lcd.DisplayStringAt(110,650, (uint8_t *)"Balise", LEFT_MODE);
-            ////////////////////////////////////////
+            DrawC(95,150,0,50,0);
+            DrawR(95,150,105,50,0);
+            DrawA(95,150,210,50,0);
+            DrawC(95,150,315,50,0);
+            DrawCheck(30,30,50,243,0);
+            DrawCheck(30,30,50,293,0);
+            DrawCheck(30,30,50,343,0);
+            DrawCheck(30,30,50,393,0);
+            lcd.DisplayStringAt(100, 250, (uint8_t *)"Init CAN", LEFT_MODE);
+            lcd.DisplayStringAt(100, 300, (uint8_t *)"Micro SD", LEFT_MODE);
+            lcd.DisplayStringAt(100, 350, (uint8_t *)"Carte Moteur", LEFT_MODE);
+            lcd.DisplayStringAt(100, 400, (uint8_t *)"Balise IR", LEFT_MODE);
             FORCE_LAUNCH.Draw(0xFFFF0000, 0);
 
             strat_etat_s=ATT;
@@ -836,4 +842,50 @@
             lcd.DisplayStringAt(150,0, (uint8_t *)strat_sd[Strategie], LEFT_MODE);
             break;
     }
+}
+
+void DrawC (int l,int h,int x, int y, unsigned char fill){
+    Point c[8]={{l,0},{l,h/6},{l/5,h/3},{l/5,2*(h/3)},{l,5*(h/6)},{l,h},{0,5*(h/6)},{0,h/6}};
+    for(int a=0;a<8;a++){
+        c[a].X+=x;
+        c[a].Y+=y;
+    }
+    lcd.DrawPolygon(c, 8);
+    
+}
+void DrawR (int l,int h,int x, int y, unsigned char fill){
+    Point r[10]={{0,0},{5*(l/6),0},{l,h/3},{5*(l/6),h/2},{l/2,h/2},{l,h},{2*(l/3),h},{l/4,h/2},{l/4,h},{0,h}};
+    for(int a=0;a<10;a++){
+        r[a].X+=x;
+        r[a].Y+=y;
+    }
+    lcd.DrawPolygon(r, 10);
+}
+void DrawA (int l,int h,int x, int y, unsigned char fill){
+    Point a[8]={{l/4,0},{3*(l/4),0},{l,h},{5*(l/6),h},{4*(l/6),h/2},{2*(l/6),h/2},{l/6,h},{0,h}};
+    for(int z=0;z<8;z++){
+        a[z].X+=x;
+        a[z].Y+=y;
+    }
+    lcd.DrawPolygon(a, 8);
+}
+void DrawCheck (int l,int h,int x, int y, int cochage){
+    if(x<3)x=3;
+    if(cochage == 1){
+        lcd.SetTextColor(VERT_F);
+        lcd.DrawLine(x,y-(h/2),x+l/2,y+h/2);
+        lcd.DrawLine(x-1,y-(h/2),x+l/2,y+h/2+1);
+        lcd.DrawLine(x-2,y-(h/2),x+l/2,y+h/2+2);
+        lcd.DrawLine(x+l/2,y+h/2,x+(4*(l/3)),y);
+        lcd.DrawLine(x+l/2,y+h/2+1,x+(4*(l/3))+1,y);
+        lcd.DrawLine(x+l/2,y+h/2+2,x+(4*(l/3))+2,y);
+        lcd.SetTextColor(NOIR);
+    } else {
+        Point a[4]={{0,0},{l,0},{l,h},{0,h}};
+        for(int z=0;z<8;z++){
+            a[z].X+=x;
+            a[z].Y+=y;
+        }
+        lcd.DrawPolygon(a, 4);
+    }
 }
\ No newline at end of file