version with updated libs

Dependencies:   F7_Ethernet mbed MbedJSONValue LCD_DISCO_F746NG mbed-rtos BSP_DISCO_F746NG CANMsg NetworkAPI SDFileSystem_Warning_Fixed GroveStreamsmodified LcdDiscoF746NgTracer JSON

Files at this revision

API Documentation at this revision

Comitter:
38domo
Date:
Tue Sep 15 19:11:11 2020 +0000
Branch:
jpa
Parent:
9:332bd237b98f
Child:
11:b198b2f2676f
Commit message:
grov stream lib updated

Changed in this revision

GroveStreams.lib Show annotated file Show diff for this revision Revisions of this file
GuiJPA.cpp Show annotated file Show diff for this revision Revisions of this file
ManageBufferJPA.cpp Show annotated file Show diff for this revision Revisions of this file
ManageBufferJPA.cpp.orig Show annotated file Show diff for this revision Revisions of this file
SDFileSystem_Warning_Fixed.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp.orig Show annotated file Show diff for this revision Revisions of this file
touchScreenJPA.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/GroveStreams.lib	Tue Sep 08 15:01:08 2020 +0000
+++ b/GroveStreams.lib	Tue Sep 15 19:11:11 2020 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/38domo/code/GroveStreamsmodified/#e69854e65c88
+https://os.mbed.com/users/38domo/code/GroveStreamsmodified/#b77ba7f2611b
--- a/GuiJPA.cpp	Tue Sep 08 15:01:08 2020 +0000
+++ b/GuiJPA.cpp	Tue Sep 15 19:11:11 2020 +0000
@@ -7,12 +7,17 @@
 int touchButtonJPA1(int numButton);
 extern uint32_t backColorButton[5];
 extern uint32_t txtColorButton[5];
-extern char textButton[5][30];
-extern char text1Button[5][30];
+char textButton[5][30];
+ char text1Button[5][30];
 extern char statusButton[5][30];
+
+extern int ethernet_actif ;  // use ethernet connection
+extern int wifi_actif ;  // use wifi connection
+
 uint32_t backColorTemp1=LCD_COLOR_BLACK, txtColorTemp1=LCD_COLOR_GREEN;
 uint32_t backColorTemp2=LCD_COLOR_BLACK, txtColorTemp2=LCD_COLOR_GREEN;
 
+// ----------------------------------------------------
 int setTemp1(std::string temp1)
     {
     printf("\nTemp1 : %s\n", temp1.c_str());
@@ -23,7 +28,7 @@
     BSP_LCD_SetFont(&Font12);
     return 1;
     } 
-
+// ------------------------------------------------
 int setTemp2(std::string temp2)
     {
     printf("\nTemp2 : %s\n", temp2.c_str());
@@ -39,6 +44,7 @@
 uint32_t backColorTempTitle[3], txtColorTempTitle[3];
 char textTempTitle[3][30];
 
+// ------------------------------------------------------------
 int setDisplayTemp()
    { int numTemp=0;    
      for (numTemp=1;numTemp<3;numTemp=numTemp+1)
@@ -55,6 +61,7 @@
     return 1;   
     }
 
+// -------------------------------------------------------
 int initDisplayTemp()
    { printf("\nInit DisplayTemp \n");        
      xTempTitle[1]=14;yTempTitle[1]=30;
@@ -79,7 +86,8 @@
 extern GroveStreams groveStreams;
 
 extern const char* myMac;
-
+int displayOn = 0;
+// ------------------------------------------------------------
 int initDatasGuiJPA()
     {       ////lcd.clear();          
             ////lcd.printf("Getting Samples...");
@@ -95,21 +103,39 @@
             char resultBuffer[2000]= {0};
             //Sending Samples (and returning current command stream values)
             int sendResult=1;
+            printf("InitDataGuiJPA - Ethernet actif %i \n", ethernet_actif); 
+            if (ethernet_actif == 0)  // ethernet inactif
+            {  // on n'utilise pas ethernet. lecture valeurs from sdcard
+               printf("Use local graphic datas\n"); 
+               // display temp1  window                     
+               // display temp2
+               // add wifi test. 
+               // if wifi actif  send request tasmota to retrieve   values text box & buttons status
+               if (wifi_actif == 0)  
+               {   // si wifi actif launch tasmota request
+               
+                   // reteive tasmota results to display
+               }                       
+               displayOn = (0x01 | displayOn);// display temp1 & temp2 box
+              
+            }
+            else
+            {    
             sendResult = groveStreams.sendInitDatasJPA(myMac, samples, gsCompName, gsCompTmplId, resultBuffer, sizeof resultBuffer);
-            if (sendResult == 0) {
-                ////lcd.printf("Send Successful");
+            if (sendResult == 0) 
+            {   ////lcd.printf("Send Successful");
                 printf("Send Successful\n");               
                 //Handle command streams
-                if (strlen(resultBuffer) > 0 && resultBuffer[0] == '{') {
-                    printf("Datas : %s\n",resultBuffer);
+                if (strlen(resultBuffer) > 0 && resultBuffer[0] == '{') 
+                {   printf("Datas : %s\n",resultBuffer);
                     MbedJSONValue mbedJson;
                     parse(mbedJson, resultBuffer);       
                     //sprintf((char*)text, "HTTP string : %s\n", resultBuffer);
                     //BSP_LCD_DisplayStringAt(0, LINE(10), (uint8_t *)&text, LEFT_MODE);
-                    int displayOn = 0;
+                    //int displayOn = 0;
                     string s;
-                    if (mbedJson.hasMember("Temp1")) {
-                        s = mbedJson["Temp1"]["backColorTemp"].get<std::string>();
+                    if (mbedJson.hasMember("Temp1")) 
+                    {   s = mbedJson["Temp1"]["backColorTemp"].get<std::string>();
                         backColorTemp1 = (uint32_t)strtoul(s.c_str(), NULL,16);
                         //printf("Temp1 backColorTemp1 : %s %X\n",s.c_str(),(uint32_t)strtoul(s.c_str(), NULL,0));
                         s = mbedJson["Temp1"]["txtColorTemp"].get<std::string>();
@@ -119,9 +145,9 @@
                         sprintf(textTempTitle[1],s.c_str());
                         printf("Temp1 text : %s\n",s.c_str());
                         displayOn = (0x01 | displayOn);
-                        }
-                    if (mbedJson.hasMember("Temp2")) {
-                        s = mbedJson["Temp2"]["backColorTemp"].get<std::string>();
+                    }
+                    if (mbedJson.hasMember("Temp2")) 
+                    {   s = mbedJson["Temp2"]["backColorTemp"].get<std::string>();
                         backColorTemp2 = (uint32_t)strtoul(s.c_str(), NULL,16);
                         //printf("Temp2 text : %s\n",s.c_str());
                         s = mbedJson["Temp2"]["txtColorTemp"].get<std::string>();
@@ -131,9 +157,9 @@
                         sprintf(textTempTitle[2],s.c_str());
                         printf("Temp2 text : %s\n",s.c_str());
                         displayOn = (0x01 | displayOn);
-                        }                   
-                    if (mbedJson.hasMember("Touche1")) {
-                        s = mbedJson["Touche1"]["Status"].get<std::string>();
+                    }                   
+                    if (mbedJson.hasMember("Touche1")) 
+                    {   s = mbedJson["Touche1"]["Status"].get<std::string>();
                         sprintf(statusButton[1],s.c_str());
                         printf("Touche1 Status : %s\n",s.c_str());
                         s = mbedJson["Touche1"]["BackColor"].get<std::string>();
@@ -149,9 +175,9 @@
                         sprintf(text1Button[1],s.c_str());
                         printf("Touche1 text1 : %s\n",s.c_str());
                         displayOn = (0x02 | displayOn);
-                        }                                                               
-                    if (mbedJson.hasMember("Touche2")) {
-                        s = mbedJson["Touche2"]["Status"].get<std::string>();
+                    }                                                               
+                    if (mbedJson.hasMember("Touche2")) 
+                    {   s = mbedJson["Touche2"]["Status"].get<std::string>();
                         sprintf(statusButton[2],s.c_str());
                         printf("Touche2 Status : %s\n",s.c_str());
                         s = mbedJson["Touche2"]["BackColor"].get<std::string>();
@@ -167,9 +193,9 @@
                         sprintf(text1Button[2],s.c_str());
                         printf("Touche2 text1 : %s\n",s.c_str());
                         displayOn = (0x04 | displayOn);
-                        }
-                    if (mbedJson.hasMember("Touche3")) {
-                        s = mbedJson["Touche3"]["Status"].get<std::string>();
+                    }
+                    if (mbedJson.hasMember("Touche3")) 
+                    {   s = mbedJson["Touche3"]["Status"].get<std::string>();
                         sprintf(statusButton[3],s.c_str());
                         printf("Touche3 Status : %s\n",s.c_str());
                         s = mbedJson["Touche3"]["BackColor"].get<std::string>();
@@ -185,9 +211,9 @@
                         sprintf(text1Button[3],s.c_str());
                         printf("Touche3 text1 : %s\n",s.c_str());
                         displayOn = (0x08 | displayOn);
-                        }
-                    if (mbedJson.hasMember("Touche4")) {
-                        s = mbedJson["Touche4"]["Status"].get<std::string>();
+                    }
+                    if (mbedJson.hasMember("Touche4")) 
+                    {   s = mbedJson["Touche4"]["Status"].get<std::string>();
                         sprintf(statusButton[4],s.c_str());
                         printf("Touche4 Status : %s\n",s.c_str());
                         s = mbedJson["Touche4"]["BackColor"].get<std::string>();
@@ -203,20 +229,23 @@
                         sprintf(text1Button[4],s.c_str());
                         printf("Touche4 text1 : %s\n",s.c_str());
                         displayOn = (0x10 | displayOn);
-                        }
-                    if (mbedJson.hasMember("Temp1")) {
-                        //int pp=setTemp1(mbedJson["Temp1"].get<std::string>());
-                        }
-                    if (mbedJson.hasMember("Temp2")) {
-                        //int pp=setTemp1(mbedJson["Temp2"].get<std::string>());
-                        }                    
-                    if ((displayOn & 0x01) > 0) {setDisplayTemp();}
+                    }
+                    if (mbedJson.hasMember("Temp1")) 
+                    {   //int pp=setTemp1(mbedJson["Temp1"].get<std::string>());
+                    }
+                    if (mbedJson.hasMember("Temp2")) 
+                    {   //int pp=setTemp1(mbedJson["Temp2"].get<std::string>());
+                    }                    
+                    
                     if ((displayOn & 0x02) > 0) {touchButtonJPA1(1);}
                     if ((displayOn & 0x04) > 0) {touchButtonJPA1(2);}
                     if ((displayOn & 0x08) > 0) {touchButtonJPA1(3);}
                     if ((displayOn & 0x10) > 0) {touchButtonJPA1(4);}
                 }
-            }
+            }  // fin test send result
+            }  // fin test ethernet actif
+            if ((displayOn & 0x01) > 0) {setDisplayTemp();}
+            
         return 1; 
         }   
 
--- a/ManageBufferJPA.cpp	Tue Sep 08 15:01:08 2020 +0000
+++ b/ManageBufferJPA.cpp	Tue Sep 15 19:11:11 2020 +0000
@@ -43,7 +43,7 @@
         }
     return;
     }
-
+// ---------------------------------------------------------------------------
 void serial2_int_recv()
     {       
     if(serial2.readable()) 
@@ -56,12 +56,13 @@
         }
     return;
     }
-
+// ----------------------------------------------------------------------------
 void serial7_int_recv()
     {       
     if(serial7.readable()) 
-        {   
+        {           
         bufferSerial7[idxSerialInt7]=(serial7.getc());
+        //printf("%c",bufferSerial7[idxSerialInt7]);
         idxSerialInt7++;
         if (idxSerialInt7 >= kMaxBufferSize) {idxSerialInt7 = 0;}
         bufferSerial7[idxSerialInt7]= 0;
@@ -69,27 +70,26 @@
         }
     return;
     }   
-    
+// --------------------------------------------------------------------------------   
 void initSerial()
     {
     serialUSB.baud(115200);
     serialUSB.attach(&serialUSB_int_recv, Serial::RxIrq);
-    serial2.baud(115200);  // required for UDP bridge
+    serial2.baud(115200);  // required for Tasmota
+    //serial2.baud(57600);  // required for UDP bridge
     serial2.attach(&serial2_int_recv, Serial::RxIrq);
     serial7.baud(115200);  // required for tasmota
-    serial7.attach(&serial7_int_recv, Serial::RxIrq);
- 
-    
+    serial7.attach(&serial7_int_recv, Serial::RxIrq);    
     bufferSerialUSB[0] = '\0';
     bufferSerial2[0] = '\0';
-    bufferSerial7[0] = '\0';
-    
+    bufferSerial7[0] = '\0';   
     }
-      
+// ---------------------------------------------------------------------------      
 void sendSerialUSB(char * str)
     {
     serialUSB.printf(str);
     }
+// ---------------------------------------------------------------------------    
 void receiveSerialUSB()
     {
     char x;
@@ -111,11 +111,12 @@
         msgSerialUSB = 0;
         }
     }
-    
+// ------------------------------------------------------------------------------    
 void sendSerial2(char * str)
     {
     serial2.printf(str);
     }
+// ------------------------------------------------------------------------------    
 void receiveSerial2()
     {
     char x;
@@ -137,11 +138,12 @@
         msgSerial2 = 0;
         }
     }
-       
+// --------------------------------------------------------------------------------       
 void sendSerial7(char * str)
     {
     serial7.printf(str);
     }
+// -------------------------------------------------------------------------------    
 void receiveSerial7()
     {
     char x;
@@ -150,7 +152,7 @@
         while(idxSerialInt7 != idxSerialUser7)
             {
             x=bufferSerial7[idxSerialUser7];
-            printf("%c",x);  
+            //printf("%c",x);  
             idxSerialUser7 = idxSerialUser7 + 1;
             if (idxSerialUser7 >= kMaxBufferSize) {idxSerialUser7 = 0;} 
             
@@ -160,6 +162,7 @@
                 {stringSerial7[idxSerialString7-1] = 10;idxSerialString7 = 0;stringSerial7ok = 1;}
             if (x == 10) {idxSerialString7 = 0;stringSerial7ok = 1;}
             }
-        msgSerial2 = 0;
+        //msgSerial2 = 0;
+        msgSerial7 = 0;
         }
     }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ManageBufferJPA.cpp.orig	Tue Sep 15 19:11:11 2020 +0000
@@ -0,0 +1,127 @@
+#include "mbed.h"
+
+const int        kMaxBufferSize = 125;
+
+volatile char    bufferSerialUSB[kMaxBufferSize+3];
+volatile int     idxSerialIntUSB = 0;
+int              idxSerialUserUSB = 0;
+volatile int     msgSerialUSB = 0;
+
+volatile char    bufferSerial2[kMaxBufferSize+3];
+volatile int     idxSerialInt2 = 0;
+int              idxSerialUser2 = 0;
+volatile int     msgSerial2 = 0;
+
+volatile char    bufferSerial7[kMaxBufferSize+3];
+volatile int     idxSerialInt7 = 0;
+int              idxSerialUser7 = 0;
+volatile int     msgSerial7 = 0;
+
+//RawSerial
+RawSerial          serialUSB(USBTX, USBRX);    // serial PC
+RawSerial          serial2(PC_6, PC_7); // TX, RX for udp bridge
+RawSerial          serial7(PF_7, PF_6); // TX, RX for extension
+volatile char x;
+// ---------------------------------------------------
+void serialUSB_int_recv()
+    {       
+    if(serialUSB.readable()) 
+        {   
+        bufferSerialUSB[idxSerialIntUSB]=(serialUSB.getc());
+        idxSerialIntUSB++;
+        if (idxSerialIntUSB >= kMaxBufferSize) {idxSerialIntUSB = 0;}
+        bufferSerialUSB[idxSerialIntUSB]= 0;
+        msgSerialUSB = 1;
+        }
+    return;
+    }
+// --------------------------------------------------
+void serial2_int_recv()
+    {       
+    if(serial2.readable()) 
+        {   
+        bufferSerial2[idxSerialInt2]=(serial2.getc());
+        idxSerialInt2++;
+        if (idxSerialInt2 >= kMaxBufferSize) {idxSerialInt2 = 0;}
+        bufferSerial2[idxSerialInt2]= 0;
+        msgSerial2 = 1;
+        }
+    return;
+    }
+// ------------------------------------------------------
+void serial7_int_recv()
+    {       
+    if(serial7.readable()) 
+        {   
+        bufferSerial7[idxSerialInt7]=(serial7.getc());
+        idxSerialInt7++;
+        if (idxSerialInt7 >= kMaxBufferSize) {idxSerialInt7 = 0;}
+        bufferSerial7[idxSerialInt7]= 0;
+        msgSerial7 = 1;
+        }
+    return;
+    }   
+ // ----------------------------------------------   
+void initSerial()
+    {
+    serialUSB.baud(115200);
+    serialUSB.attach(&serialUSB_int_recv, Serial::RxIrq);
+    serial2.baud(115200);  // required for UDP bridge
+    serial2.attach(&serial2_int_recv, Serial::RxIrq);
+    serial7.baud(115200);  // required for tasmota
+    serial7.attach(&serial7_int_recv, Serial::RxIrq);    
+    bufferSerialUSB[0] = '\0';
+    bufferSerial2[0] = '\0';
+    bufferSerial7[0] = '\0';   
+    }
+// ----------------------------------------------------      
+void sendSerialUSB(char * str)
+    {
+    serialUSB.printf(str);
+    }
+// -------------------------------------------------------------    
+void receiveSerialUSB()
+    {
+    while(idxSerialIntUSB != idxSerialUserUSB)
+        {
+        x=bufferSerialUSB[idxSerialUserUSB];
+        printf("%c",x);  
+        idxSerialUserUSB = idxSerialUserUSB + 1;
+        if (idxSerialUserUSB >= kMaxBufferSize) {idxSerialUserUSB = 0;} 
+        }
+    msgSerialUSB = 0;
+    }
+// -------------------------------------    
+void sendSerial2(char * str)
+    {
+    serial2.printf(str);
+    }
+// -----------------------------------------------    
+void receiveSerial2()
+    {
+    while(idxSerialInt2 != idxSerialUser2)
+        {
+        x=bufferSerial2[idxSerialUser2];
+        printf("%c",x);  
+        idxSerialUser2 = idxSerialUser2 + 1;
+        if (idxSerialUser2 >= kMaxBufferSize) {idxSerialUser2 = 0;} 
+        }
+    msgSerial2 = 0;
+    }
+// ----------------------------------------------------       
+void sendSerial7(char * str)
+    {
+    serial7.printf(str);
+    }
+// --------------------------------------------------------    
+void receiveSerial7()
+    {
+    while(idxSerialInt7 != idxSerialUser7)
+        {
+        x=bufferSerial7[idxSerialUser7];
+        printf("%c",x);  
+        idxSerialUser7 = idxSerialUser7 + 1;
+        if (idxSerialUser7 >= kMaxBufferSize) {idxSerialUser7 = 0;} 
+        }
+    msgSerial7 = 0;
+    }
\ No newline at end of file
--- a/SDFileSystem_Warning_Fixed.lib	Tue Sep 08 15:01:08 2020 +0000
+++ b/SDFileSystem_Warning_Fixed.lib	Tue Sep 15 19:11:11 2020 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/38domo/code/SDFileSystem_Warning_Fixed/#72435639e4e7
+https://os.mbed.com/users/38domo/code/SDFileSystem_Warning_Fixed/#f76a96b18109
--- a/main.cpp	Tue Sep 08 15:01:08 2020 +0000
+++ b/main.cpp	Tue Sep 15 19:11:11 2020 +0000
@@ -1,6 +1,9 @@
 /* --------------------------------------------------------------------------
 // test compile ok 31/07/2020 
 
+// 01/09/2020 : update JPA serial  et CAN : tests OK sur CAN et 1 srial 2
+              : attention 1 seul serial operationnel serial 2 - serial 7 ne marche pas en reception
+//            : test ok send/receive tasmota sur serial 2
 // 30/08/2020 : emission CAN OK en Wifi sur tasmota ou udp bridge
 //              mais pb reception caracteres sur port serie ( idem port series pc ouu serial 7
 
@@ -58,6 +61,9 @@
 
 #include "main.h"
 
+extern char textButton[5][8];
+extern char text1Button[5][8];
+extern char textTempTitle[3][30];
 
 //#include "touchScreen.cpp"
 int touchInitJPA1();
@@ -82,11 +88,49 @@
 const char      gsStreamId1[] = "voltage";
 const char      gsStreamId2[] = "temperature";
 char            gsStreamIPdatas[] = "192.168.1.49";
-char            ethernet_actif[] = "O";
-char            wifi_actif[] = "O";
-char            can_actif[] = "O";
-char            serial_actif[] = "O";
+int             ethernet_actif = '0';
+int             wifi_actif = '1';
+int             can_actif = '1';
+int             serial_actif = '1';
 char            read_sd[] = "";
+char function_mod[]= "O";
+ 
+ char touch1_status[]= "0";
+ char touch1_back_color[]= "0xFF404040";
+ char touch1_text_color[]= "0xFFFFFF00";
+ char touch1_text[]= "Touch1";
+ char touch1_text1[]= "Text1";
+
+ char touch2_status[]= "0";
+ char touch2_back_color[]= "0xFF404040";
+ char touch2_text_color[]= "0xFFFFFF00";
+ char touch2_text[]= "Touch2";
+ char touch2_text1[]= "Text2";
+
+ char touch3_status[]= "0";
+ char touch3_back_color[]= "0xFF404040";
+ char touch3_text_color[]= "0xFFFFFF00";
+ char touch3_text[]= "Touch3";
+ char touch3_text1[]= "Text3";
+
+ char touch4_status[]= "0";
+ char touch4_back_color[]= "0xFF404040";
+ char touch4_text_color[]= "0xFFFFFF00";
+ char touch4_text[]= "Touch4";
+ char touch4_text1[]= "Text4";
+
+ char temp1_text[]= "Temp1";
+ char temp1_back_color[]= "0xFF404040";
+ char temp1_text_color[]= "0xFFFFFF00";
+
+ char temp2_text[]= "Temp2";
+ char temp2_back_color[]= "0xFF404040";
+ char temp2_text_color[]= "0xFFFFFF00";
+ 
+
+
+int len_line_sd = 0;
+
 uint8_t         text2[30];
 uint8_t         counter = 0;
 float           voltage;
@@ -147,8 +191,7 @@
         printf("\n");       
     }    
     else
-    {  
-         printf(" Can message receive : ");
+    {   printf(" Can message receive : ");
         /*
         printf("  ID      = 0x%.3X\r\n", msg.id);
         printf("  Type    = %d\r\n", msg.type);
@@ -167,21 +210,17 @@
  */
 int CanRcv = 0;
 void onCanReceived(void)
-{   
-    can.read(rxMsg);
+{   can.read(rxMsg);
     CanRcv = 1;
 }
 
-
 // ------------------------------------------------------------------------------------------
 int main()
-{   
-    initSerial();
-
-    
+{   initSerial();   
    // attach ISR to handle received messages
     timer.start();          // start timer
     sendSerialUSB("CAN_Hello board serialUSB #1\r\n");
+    
     sendSerial2("CAN_Hello board serial2 #1\r\n");
     sendSerial7("CAN_Hello board serial7 #1\r\n");
     
@@ -190,11 +229,15 @@
     // reaf following datas
     // IP address, Ethernet actif, Wifi actif, Can actif, serial actif,fonction, buttons parameters
     // store local variables from sd
-    //extern char gsStreamIPdatas[];
-    //extern char ethernet_actif[] ;
-    //extern char wifi_actif[];
-    //extern char can_actif[];
-    //extern char serial_actif[];
+    // gsStreamIPdatas[];
+    // ethernet_actif[] ; wifi_actif[];can_actif[]; serial_actif[]; function_mod[]= "O";   
+    // touch1_status[]= "0"; touch1_back_color[]= "0xFF404040"; touch1_text_color[]= "0xFFFFFF00"; touch1_text[]= "Touch1"; touch1_text1[]= "Text1";
+    // touch2_status[]= "0"; touch2_back_color[]= "0xFF404040"; touch2_text_color[]= "0xFFFFFF00"; touch2_text[]= "Touch2"; touch2_text1[]= "Text2";
+    // touch3_status[]= "0"; touch3_back_color[]= "0xFF404040"; touch3_text_color[]= "0xFFFFFF00"; touch3_text[]= "Touch3"; touch3_text1[]= "Text3";
+    // touch4_status[]= "0"; touch4_back_color[]= "0xFF404040"; touch4_text_color[]= "0xFFFFFF00"; touch4_text[]= "Touch4"; touch4_text1[]= "Text4";
+    // temp1_text[]= "Temp1"; temp1_back_color[]= "0xFF404040"; temp1_text_color[]= "0xFFFFFF00";
+    // temp2_text[]= "Temp2"; temp2_back_color[]= "0xFF404040"; temp2_text_color[]= "0xFFFFFF00";
+ 
     printf("\nFin init SDCard ...\n");
     BSP_LCD_Clear(LCD_COLOR_DARKBLUE);  // clear LCD
     uint8_t text[300];
@@ -210,9 +253,9 @@
     yy = initDisplayTemp();   // from guijpa.cpp - Init display
     printf("\ninit touchInitJPA1 ...\n");
     yy = touchInitJPA1();  // from touchscreen.cpp - init touchscreen
-    yy = touchInitGuiJPA1();  // from touchscreen.cpp 
+    yy = touchInitGuiJPA1();  // from touchscreen.cpp - display buttons
     printf("\ninit initDatasGuiJPA ...\n");
-    yy = initDatasGuiJPA();  // from guijpa.cpp - config buttons             
+    yy = initDatasGuiJPA();  // from guijpa.cpp - config buttons  - ethernet connection          
     ////lcd.printf("Starting...");
     printf("Starting...\n");
     lastToucheTime = time(NULL);
@@ -225,36 +268,67 @@
     
     BSP_LCD_DisplayOff();
     BSP_LCD_DisplayOn();
+    //BSP_LCD_SetBackColor(LCD_COLOR_RED);
+    BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
+    BSP_LCD_SetBackColor(LCD_COLOR_RED);
+        BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
+    int pp = setTemp1("temp1");  // display temp1 on lcd
+    BSP_LCD_DisplayStringAt(0, LINE(7), (uint8_t *)"displ temp1", CENTER_MODE);
+    
     // main loop ---------------------------------------------------
-    while (true) {
-        
+    while (true) {       
         if (CanRcv > 0)
-            {
-            CanRcv = 0;    
+        {   CanRcv = 0;    
             printMsg(rxMsg,1);  
             BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"Can msg rec", CENTER_MODE);
-            if (rxMsg.id == RX_ID) {
-                rxMsg >> counter;
+            if (rxMsg.id == RX_ID) 
+            {   rxMsg >> counter;
                 rxMsg >> voltage;    
                 //serialUSB.printf("  counter = %d\r\n", counter);
                 //serialUSB.printf("  voltage = %e V\r\n", voltage);
-                 }
             }
-
+        }
         if (msgSerialUSB > 0) {receiveSerialUSB();}
         if (stringSerialUSBok == 1) {printf("Trame SerialUSB : %s",stringSerialUSB);stringSerialUSBok=0;}
         
         if (msgSerial2 > 0) {receiveSerial2();}
-        if (stringSerial2ok == 1) {printf("Trame Serial2 : %s",stringSerial2);stringSerial2ok=0;}
-        
+        if (stringSerial2ok == 1) 
+        {   printf("Trame Serial2 : %s",stringSerial2);
+            stringSerial2ok=0;
+            // decodage json datas
+            // trame reçue : {"Temp1":"25","Temp2":"30"}
+            char resultBuffer[100]= {0};
+            //resultBuffer = stringSerial2;
+            //if (strlen(resultBuffer) > 0 && resultBuffer[0] == '{') 
+            if (strlen(stringSerial2) > 0 && stringSerial2[0] == '{') 
+            {        MbedJSONValue mbedJson;
+                    //parse(mbedJson, resultBuffer); 
+                    parse(mbedJson, stringSerial2);                   
+                    //sprintf((char*)text, "HTTP string : %s\n", resultBuffer);
+                    sprintf((char*)text, "HTTP string : %s\n", stringSerial2);
+                    //BSP_LCD_DisplayStringAt(0, LINE(1), (uint8_t *)&text, LEFT_MODE);                
+                    if (mbedJson.hasMember("Temp1")) {
+                         printf("Serial2 temp1: %s",stringSerial2);
+                        //int pp=setTemp1(mbedJson["Temp1"].get<std::string>());
+                        int pp = setTemp1(mbedJson["Temp1"].get<std::string>());  // display temp1 on lcd
+                        
+                    }
+                    if (mbedJson.hasMember("Temp2")) {
+                        int tt=setTemp2(mbedJson["Temp2"].get<std::string>());
+                        
+                    }
+                    
+                }
+            
+              
+            
+        }       
         if (msgSerial7 > 0) {receiveSerial7();}
         if (stringSerial7ok == 1) {printf("Trame Serial7 : %s",stringSerial7);stringSerial7ok=0;}
      
         // timer send can 
        if(timer.read_ms() >= 10000)            // check for timeout
-       {    
-            
-            timer.stop();                       // stop the timer
+       {    timer.stop();                       // stop the timer
             timer.reset();                      // reset the timer
             counter = (counter+1) & 1;                          // increment the counter
             voltage = 0;////(analogIn * 3.3f)/4096.0f;// read the small drifting voltage from analog input
@@ -262,8 +336,7 @@
             txMsg.id = 0x100130CA;//TX_ID;                   // set the message ID
             txMsg.format = CANExtended ; //extended
             txMsg.len=2;
-            txMsg.data[0]=8;txMsg.data[1]=counter;        // append data (total data length must be <= 8 bytes!)
-            
+            txMsg.data[0]=8;txMsg.data[1]=counter;        // append data (total data length must be <= 8 bytes!)           
             if(can.write(txMsg))       // transmit message
             {   //if(can->write(txMsg)) {             // transmit the CAN message
                 printMsg(txMsg,0);
@@ -280,8 +353,7 @@
         //touch screen
         int xx = touchJPA1();  //
         if (xx > 0) 
-        {  
-           if (xx == 4)
+        {  if (xx == 4)
            { // send trame to can
             txMsg.id = 0x100130CB;//TX_ID;                   // set the message ID
             txMsg.format = CANExtended ; //extended
@@ -289,21 +361,17 @@
             txMsg.data[0]=8;txMsg.data[1]=2;        // append data (total data length must be <= 8 bytes!)
           
            if(can.write(txMsg))       // transmit message
-            {   
-                printMsg(txMsg,0);
+            {   printMsg(txMsg,0);
                 BSP_LCD_DisplayStringAt(0, LINE(3), (uint8_t *)"TX CAN OK", CENTER_MODE);
                 BSP_LCD_DisplayStringAt(0, LINE(4), (uint8_t *)"--------", CENTER_MODE);
              }
             else
-            {
-                BSP_LCD_DisplayStringAt(0, LINE(4), (uint8_t *)"TX CAN Fail", CENTER_MODE);
+            {   BSP_LCD_DisplayStringAt(0, LINE(4), (uint8_t *)"TX CAN Fail", CENTER_MODE);
                 BSP_LCD_DisplayStringAt(0, LINE(3), (uint8_t *)"-----------", CENTER_MODE);
             }    
            }    
-           xx = sendTouchJPA(xx);  
-            
-           lastToucheTime = time(NULL);
-           
+           xx = sendTouchJPA(xx);              
+           lastToucheTime = time(NULL);          
         } 
         else 
         {  lastToucheTime = 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp.orig	Tue Sep 15 19:11:11 2020 +0000
@@ -0,0 +1,354 @@
+/* --------------------------------------------------------------------------
+// test compile ok 31/07/2020 
+
+// 30/08/2020 : emission CAN OK en Wifi sur tasmota ou udp bridge
+//              mais pb reception caracteres sur port serie ( idem port series pc ouu serial 7
+
+// 02/08/2020
+// add sd parameters: read ok
+// ip address
+// ethernet actif
+// wifi actif
+// can actif
+// serial actif
+// fonction
+// Touche1 status (0/1)
+// Touche1 backcolor
+// touche1 text color
+// Touche1 text
+// Touche1 text1
+// Touche2
+// Touche3
+// Touche4
+// Temp1 text
+// Temp2 text
+
+// works ok 31/07/2020
+// updated package from jpa
+// added fonts in  bsp_disco_f746ng/utilities/fonts
+// fonts.h updated to manage added fonts
+// grovestream.cpp & grovesttream.h updated
+// remove stm32746ng_dicovery_sd in /bsp_disco_f746ng/drivers/stm32746ng_discovery
+// mainSDAcardJPA issue: add sdcardjpa.cpp in lib /sdfilesystem_warning_fixed
+// isue with big fonts: replace /bsp_disco_f746ng/drivers/stm32746ng-discovery/stm32746ng-discovery_lcd.c &.h
+
+// need to add CAN and WiFi
+
+ STM32F746 GroveStreams Stream Feed via Ethernet
+
+ This GroveStreams example is designed for the STM32F746.
+ https://www.grovestreams.com/developers/getting_started_stm32F746.html
+
+ The STM32 uses DHCP and DNS for a simpler network setup.
+
+*/
+
+#if !FEATURE_LWIP
+#error [NOT_SUPPORTED] LWIP not supported for this target
+#endif
+
+#include "mbed.h"
+#include "LcdDiscoF746NgTracer.h"
+#include "GroveStreams.h"
+#include "MbedJSONValue.h"
+#include "stm32746g_discovery_lcd.h"
+#include "stm32746g_discovery_ts.h"
+#include "CANMsg.h"
+//#include "ManageBufferJPA.h"
+
+#include "main.h"
+
+
+//#include "touchScreen.cpp"
+int touchInitJPA1();
+int touchJPA1();
+int touchInitGuiJPA1();
+int sendTouchJPA(int xx);
+time_t lastToucheTime = 0;
+int touchButtonJPA1(int numButton);
+
+//#include "GuiJPA.cpp"
+int initDisplayTemp();
+int initDatasGuiJPA();
+int setTemp1(std::string temp1);
+int setTemp2(std::string temp2);
+int sendInitDatasJPA(int xx);
+
+//#SDCARD
+int mainSDCardJPA(); //in sdcardjpa.cpp in lib /sdfilesystem_warning_fixedd
+
+//GroveStreams Stream IDs. Stream IDs tell GroveStreams which component streams the values will be assigned to.
+//Don't change these unless you edit your GroveStreams component definition and change the stream IDs to match these.
+const char      gsStreamId1[] = "voltage";
+const char      gsStreamId2[] = "temperature";
+char            gsStreamIPdatas[] = "192.168.1.49";
+char            ethernet_actif[] = "O";
+char            wifi_actif[] = "O";
+char            can_actif[] = "O";
+char            serial_actif[] = "O";
+char            read_sd[] = "";
+uint8_t         text2[30];
+uint8_t         counter = 0;
+float           voltage;
+
+Timer           timer;
+AnalogIn        analogIn(A0);
+
+// CAN ------------------------------------------------------------
+CAN             can(PB_8, PB_9);  // CAN Rx pin name, CAN Tx pin name
+CANMsg          rxMsg;
+CANMsg          txMsg;
+
+// Other Settings
+int             updateFrequency = 20;    // Update frequency in seconds. Change this to change your sample frequency.
+
+AnalogIn        adc_temp(ADC_TEMP);
+AnalogIn        adc_vref(ADC_VREF);
+DigitalOut      myled(LED1);
+
+void initSerial();
+void sendSerialUSB(char * str);
+void receiveSerialUSB();
+void sendSerial2(char * str);
+void receiveSerial2();
+void sendSerial7(char * str);
+void receiveSerial7();
+
+//extern volatile char            bufferSerialUSB[];
+extern volatile int             msgSerialUSB;
+extern volatile int             msgSerial2;
+extern volatile int             msgSerial7;
+
+//extern Serial          serialUSB(USBTX, USBRX);    // serial PC
+//extern Serial          serial2(PC_6, PC_7); // TX, RX for udp bridge
+//extern Serial          serial7(PF_7, PF_6); // TX, RX for extension
+
+#define BOARD1                  1       // comment out this line when compiling for board #2
+    const unsigned int  RX_ID = 0x101;
+    const unsigned int  TX_ID = 0x100;
+
+
+// ---------------------------------------------------------------------------------------
+//* @brief   Prints CAN message to PC's serial terminal
+void printMsg(CANMessage& msg, int dir)
+{   if (dir ==0)
+    {  //BSP_LCD_DisplayStringAt(0, LINE(6), (uint8_t *)"Message sent    ", LEFT_MODE); 
+         printf(" Can message sent : ");
+         printf("ID = 0x%.3X Data=", msg.id);
+         for(int i = 0; i < msg.len; i++) printf(" 0x%.2X", msg.data[i]);
+        printf("\n");       
+    }    
+    else
+    {  
+         printf(" Can message receive : ");
+        /*
+        printf("  ID      = 0x%.3X\r\n", msg.id);
+        printf("  Type    = %d\r\n", msg.type);
+        printf("  Format  = %d\r\n", msg.format);
+        printf("  Length  = %d\r\n", msg.len);
+        */
+        printf("ID = 0x%.3X Data=", msg.id);
+        for(int i = 0; i < msg.len; i++) printf(" 0x%.2X", msg.data[i]);
+        printf("\n");
+    }
+}
+
+/** -----------------------------------------------------------------------------------------
+ * @brief   Handles received CAN messages
+ * @note    Called on 'CAN message received' interrupt.
+ */
+int CanRcv = 0;
+void onCanReceived(void)
+{   
+    can.read(rxMsg);
+    CanRcv = 1;
+}
+
+
+// ------------------------------------------------------------------------------------------
+int main()
+{   
+    initSerial(); 
+   // attach ISR to handle received messages
+    timer.start();          // start timer
+    sendSerialUSB("CAN_Hello board serialUSB #1\r\n");
+    sendSerial2("CAN_Hello board serial2 #1\r\n");
+    sendSerial7("CAN_Hello board serial7 #1\r\n");
+    
+    printf("\nInit SDCard ...\n");
+    mainSDCardJPA() ;  // init SD - read  prog parameters from SD (from sdcardjpa.cpp in sdfilesystem_warning_fixed lib
+    // reaf following datas
+    // IP address, Ethernet actif, Wifi actif, Can actif, serial actif,fonction, buttons parameters
+    // store local variables from sd
+    //extern char gsStreamIPdatas[];
+    //extern char ethernet_actif[] ;
+    //extern char wifi_actif[];
+    //extern char can_actif[];
+    //extern char serial_actif[];
+    printf("\nFin init SDCard ...\n");
+    BSP_LCD_Clear(LCD_COLOR_DARKBLUE);  // clear LCD
+    uint8_t text[300];
+    printf("Start Prog\n");    
+    std::string temp1;
+    std::string temp2;
+    
+    //lastSuccessfulUploadTime is used for upload frequency.
+    time_t lastSuccessfulUploadTime = 0;    
+    printf("\n Init touchJPA1 ...\n");
+    int yy;
+    printf("\n Init initDisplayTemp ...\n"); 
+    yy = initDisplayTemp();   // from guijpa.cpp - Init display
+    printf("\ninit touchInitJPA1 ...\n");
+    yy = touchInitJPA1();  // from touchscreen.cpp - init touchscreen
+    yy = touchInitGuiJPA1();  // from touchscreen.cpp 
+    printf("\ninit initDatasGuiJPA ...\n");
+    yy = initDatasGuiJPA();  // from guijpa.cpp - config buttons             
+    ////lcd.printf("Starting...");
+    printf("Starting...\n");
+    lastToucheTime = time(NULL);
+     char data[5];
+     
+   // config can --------------------------------------
+    can.frequency(125000); // set CAN bit rate to 125 kbps
+    //can.filter(RX_ID, 0xFFF, CANStandard, 0); // set filter #0 to accept only standard messages with ID == RX_ID
+    can.attach(onCanReceived, CAN::RxIrq);   
+    
+    BSP_LCD_DisplayOff();
+    BSP_LCD_DisplayOn();
+    // main loop ---------------------------------------------------
+    while (true) {  
+       //process input can msg     
+        if (CanRcv > 0)
+            {
+            CanRcv = 0;    
+            printMsg(rxMsg,1);  
+            BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"Can msg rec", CENTER_MODE);
+            if (rxMsg.id == RX_ID) {
+                rxMsg >> counter;
+                rxMsg >> voltage;    
+                //serialUSB.printf("  counter = %d\r\n", counter);
+                //serialUSB.printf("  voltage = %e V\r\n", voltage);
+                 }
+            }
+        // process serial input messages
+        if (msgSerialUSB > 0) {receiveSerialUSB();}
+        if (msgSerial2 > 0) 
+        {   receiveSerial2();
+        }
+           // sendSerial7("message received from Serial2\n");
+           // sendSerial7(bufferSerial2);
+        
+        if (msgSerial7 > 0) 
+        {   receiveSerial7();
+            //sendSerial2("message received from Serial7\n");
+            //sendSerial2(bufferSerial7);
+        }
+     
+        // timer send can 
+       if(timer.read_ms() >= 10000)            // check for timeout
+       {              
+            timer.stop();                       // stop the timer
+            timer.reset();                      // reset the timer
+            counter = (counter+1) & 1;                          // increment the counter
+            voltage = 0;////(analogIn * 3.3f)/4096.0f;// read the small drifting voltage from analog input
+            txMsg.clear();                      // clear the Tx message storage
+            txMsg.id = 0x100130CA;//TX_ID;                   // set the message ID
+            txMsg.format = CANExtended ; //extended
+            txMsg.len=2;
+            txMsg.data[0]=8;txMsg.data[1]=counter;        // append data (total data length must be <= 8 bytes!)
+            
+            if(can.write(txMsg))       // transmit message
+            {   //if(can->write(txMsg)) {             // transmit the CAN message
+                printMsg(txMsg,0);
+                BSP_LCD_DisplayStringAt(0, LINE(3), (uint8_t *)"TX CAN OK", CENTER_MODE);
+                BSP_LCD_DisplayStringAt(0, LINE(4), (uint8_t *)"--------", CENTER_MODE);
+            }
+            else
+            {   //serialUSB.printf("Transmission error\r\n");
+                BSP_LCD_DisplayStringAt(0, LINE(4), (uint8_t *)"TX CAN Fail", CENTER_MODE);
+                BSP_LCD_DisplayStringAt(0, LINE(3), (uint8_t *)"-----------", CENTER_MODE);
+            }    
+            timer.start();                  // insert transmission lag
+        }  // end if timer
+        //touch screen
+        int xx = touchJPA1();  //
+        if (xx > 0) 
+        {  
+           if (xx == 4)
+           { // send trame to can
+            txMsg.id = 0x100130CB;//TX_ID;                   // set the message ID
+            txMsg.format = CANExtended ; //extended
+            txMsg.len=2;
+            txMsg.data[0]=8;txMsg.data[1]=2;        // append data (total data length must be <= 8 bytes!)
+          
+           if(can.write(txMsg))       // transmit message
+            {   
+                printMsg(txMsg,0);
+                BSP_LCD_DisplayStringAt(0, LINE(3), (uint8_t *)"TX CAN OK", CENTER_MODE);
+                BSP_LCD_DisplayStringAt(0, LINE(4), (uint8_t *)"--------", CENTER_MODE);
+             }
+            else
+            {
+                BSP_LCD_DisplayStringAt(0, LINE(4), (uint8_t *)"TX CAN Fail", CENTER_MODE);
+                BSP_LCD_DisplayStringAt(0, LINE(3), (uint8_t *)"-----------", CENTER_MODE);
+            }    
+           }    
+           xx = sendTouchJPA(xx);  
+            
+           lastToucheTime = time(NULL);
+           
+        } 
+        else 
+        {  lastToucheTime = 0;
+        }   // send mqtt
+        // Update sensor data to GroveStreams
+        time_t seconds = time(NULL);
+        if(seconds - lastSuccessfulUploadTime > updateFrequency) {
+            ////lcd.clear();            
+            ////lcd.printf("Getting Samples...");
+            printf("Getting Samples...\n");          
+            //Assemble the samples into URL parameters which are seperated with the "&" character
+            // Example: &s1=6.2&s2=78.231
+            int temperature = 0; //adc_temp.read() * 100.0f;
+            int voltage = 0; //adc_vref.read() * 100.0f;
+            char samples[64] = {0};
+            sprintf(samples, "&%s=%d&%s=%d", gsStreamId1, voltage, gsStreamId2, temperature);           
+            //Append on command requests (request stream values)
+            //This will indicate to GroveStreams to return the last value
+            // of each request stream during the sample upload
+            strcat(samples, "&rsid=freq&rsid=led");            
+            char resultBuffer[700]= {0};
+            //Sending Samples (and returning current command stream values)
+            time_t connectAttemptTime = time(NULL);
+            int sendResult = groveStreams.send(myMac, samples, gsCompName, gsCompTmplId, resultBuffer, sizeof resultBuffer);  //receive mqtt
+            
+            if (sendResult == 0) {
+                ////lcd.printf("Send Successful");
+                printf("Send Successful\n");
+                lastSuccessfulUploadTime = connectAttemptTime;               
+                //Handle command streams
+                if (strlen(resultBuffer) > 0 && resultBuffer[0] == '{') {
+                    MbedJSONValue mbedJson;
+                    parse(mbedJson, resultBuffer);                    
+                    sprintf((char*)text, "HTTP string : %s\n", resultBuffer);
+                    //BSP_LCD_DisplayStringAt(0, LINE(1), (uint8_t *)&text, LEFT_MODE);                
+                    if (mbedJson.hasMember("Temp1")) {
+                        int pp=setTemp1(mbedJson["Temp1"].get<std::string>());
+                    }
+                    if (mbedJson.hasMember("Temp2")) {
+                        int tt=setTemp2(mbedJson["Temp2"].get<std::string>());
+                    }
+                    if (mbedJson.hasMember("led")) {
+                        //Change LED
+                        myled = mbedJson["led"].get<bool>() ? 1 : 0;
+                        ////lcd.printf("LED: %s", mbedJson["led"].get<bool>() ? "On" : "Off");
+                        printf("LED: %s\n", mbedJson["led"].get<bool>() ? "On" : "Off");
+                    }
+                }
+            } 
+        }
+        
+    }
+}
+
+
--- a/touchScreenJPA.cpp	Tue Sep 08 15:01:08 2020 +0000
+++ b/touchScreenJPA.cpp	Tue Sep 15 19:11:11 2020 +0000
@@ -22,7 +22,9 @@
 extern time_t seconds;
 time_t seconds_touches = 0;
 extern time_t lastToucheTime;  
+// char touch1_text1;
 
+// -----------------------------------------------------------------
 int touchInitJPA1()
     {    //touch screen init
     //touch screen
@@ -32,31 +34,35 @@
     BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER);
     BSP_LCD_SetFont(&Font12); 
     status = BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize());
-    if (status != TS_OK) {
-        BSP_LCD_Clear(LCD_COLOR_RED);
+    if (status != TS_OK) 
+    {   BSP_LCD_Clear(LCD_COLOR_RED);
         BSP_LCD_SetBackColor(LCD_COLOR_RED);
         BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
         BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT FAIL", CENTER_MODE);
-        }
-    else {
+    }
+    else 
+    {
         BSP_LCD_Clear(LCD_COLOR_DARKBLUE);
         BSP_LCD_SetBackColor(LCD_COLOR_BLACK);
         BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
         //BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT OK", CENTER_MODE);
-        }  
+    }  
     int tt = 0;
     for (tt=0;tt<16;tt++) 
-        {if(timer_touch[tt].read_ms() > 500) 
-            {timer_touch[tt].stop();timer_touch[tt].reset();}}
+    {   if(timer_touch[tt].read_ms() > 500) 
+        {  timer_touch[tt].stop();timer_touch[tt].reset();
+        }
+    }
     return 0;   
     }
-
+// -------------------------------------------------------
 int xButton[5],yButton[5],dxButton[5],dyButton[5],xTxtButton[5],yTxtButton[5];
 uint32_t backColorButton[5], txtColorButton[5];
-char textButton[5][30];
-char text1Button[5][30];
+extern char textButton[5][8];
+extern char text1Button[5][8];
 char statusButton[5][30];
 
+// -----------------------------------------------------------------------------------------
 int touchButtonJPA1(int numButton)
     {
     if ((numButton > 0) && (numButton < 5))
@@ -74,32 +80,33 @@
     return 0;
     }
 
-
+// ----------------------------------------------------------------------------------
 // generation de fonts : http://omz-software.com/pythonista/docs/ios/ImageFont.html
 int touchInitGuiJPA1()
-    {   
+    {  // button 1 en bas a gauche 
     xButton[1]=10;yButton[1]=185;dxButton[1]=100;dyButton[1]=80;xTxtButton[1]=12;yTxtButton[1]=190;
-    backColorButton[1] = LCD_COLOR_GRAY; txtColorButton[1] = LCD_COLOR_GREEN;
-    sprintf(textButton[1],"Lampe ");
-    sprintf(text1Button[1],"Sejour");
+    backColorButton[1] = LCD_COLOR_GRAY; 
+    txtColorButton[1] = LCD_COLOR_GREEN;    
+    //sprintf(textButton[1],"Lampe ");
+    //sprintf(text1Button[1],"Sejour");
     sprintf(statusButton[1],"off");
-
+    // bouton 2 a cote bouton 1
     xButton[2]=130;yButton[2]=185;dxButton[2]=100;dyButton[2]=80;xTxtButton[2]=132;yTxtButton[2]=190;
     backColorButton[2] = LCD_COLOR_GRAY; txtColorButton[2] = LCD_COLOR_GREEN;
-    sprintf(textButton[2],"Lampe ");
-    sprintf(text1Button[2],"Sejours");
+    //sprintf(textButton[2],"Lampe ");
+    //sprintf(text1Button[2],"Sejours");
     sprintf(statusButton[2],"off");
-       
+    // bouton 3   
     xButton[3]=250;yButton[3]=185;dxButton[3]=100;dyButton[3]=80;xTxtButton[3]=252;yTxtButton[3]=190;
     backColorButton[3] = LCD_COLOR_GRAY; txtColorButton[3] = LCD_COLOR_GREEN;
-    sprintf(textButton[3],"Lampe ");
-    sprintf(text1Button[3],"Sejour");
+    //sprintf(textButton[3],"Lampe ");
+    //sprintf(text1Button[3],"Sejour");
     sprintf(statusButton[3],"off");
-       
+    // bouton 4 en bas a ddroite   
     xButton[4]=370;yButton[4]=185;dxButton[4]=100;dyButton[4]=80;xTxtButton[4]=372;yTxtButton[4]=190;
     backColorButton[4] = LCD_COLOR_GRAY; txtColorButton[4] = LCD_COLOR_GREEN;
-    sprintf(textButton[4],"Lampe ");
-    sprintf(text1Button[4],"Sejour");
+    //sprintf(textButton[4],"Lampe ");
+    //sprintf(text1Button[4],"Sejour");
     sprintf(statusButton[4],"off");
 
     touchButtonJPA1(1);
@@ -113,7 +120,8 @@
     BSP_LCD_SetFont(&Font12); 
     return 0; 
     }
-    
+
+// --------------------------------------------------------------------------    
 int touchJPA1()
     {
     //touch screen
@@ -188,7 +196,8 @@
         //touch screen    
     return status;
     }
-    
+ 
+ // -----------------------------------------------------------------------   
 int sendTouchJPA(int xx)
     {
     uint8_t status = 0;