![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
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
Diff: GuiJPA.cpp
- Branch:
- jpa
- Revision:
- 17:f3c5ec9ca00f
- Parent:
- 12:15ae35cfb03f
diff -r f0d946e6da36 -r f3c5ec9ca00f GuiJPA.cpp --- a/GuiJPA.cpp Wed Dec 30 17:22:27 2020 +0000 +++ b/GuiJPA.cpp Wed Jan 13 19:52:35 2021 +0000 @@ -1,5 +1,4 @@ -/* - +/* var LCD_COLOR_BLUE = "0xFF0000FF"; var LCD_COLOR_GREEN = "0xFF00FF00"; var LCD_COLOR_RED = "0xFFFF0000"; @@ -28,18 +27,17 @@ var LCD_COLOR_TRANSPARENT = "0xFF000000"; */ - #include "stm32746g_discovery_lcd.h" #include "stm32746g_discovery_ts.h" #include "MbedJSONValue.h" #include "GroveStreams.h" -#include <string> +//#include <string> int touchButtonJPA1(int numButton); extern uint32_t backColorButton[5]; extern uint32_t txtColorButton[5]; char textButton[5][30]; - char text1Button[5][30]; +char text1Button[5][30]; extern char statusButton[5][30]; extern int ethernet_actif ; // use ethernet connection @@ -47,11 +45,21 @@ uint32_t backColorTemp1=LCD_COLOR_BLACK, txtColorTemp1=LCD_COLOR_GREEN; uint32_t backColorTemp2=LCD_COLOR_BLACK, txtColorTemp2=LCD_COLOR_GREEN; +int xTempTitle[3],yTempTitle[3],dxTempTitle[3],dyTempTitle[3],xTxtTempTitle[3],yTxtTempTitle[3]; +uint32_t backColorTempTitle[3], txtColorTempTitle[3]; +char textTempTitle[3][30]; +// GroveStreams Settings +extern const char gsApiKey[] = "YOUR_SECRET_API_KEY_HERE"; //Change This!!! +extern const char gsCompName[] = "STM32F746+Discovery"; //Optionally change. Set this to give your component a name when it initially registers. Encode special chars such as spaces. +extern const char gsCompTmplId[]= ""; //Optional. Tells GS what template to use when the feed initially arrives and a new component needs to be created. +////GroveStreams groveStreams(gsApiKey, &lcd); +//extern GroveStreams groveStreams; +extern const char* myMac; +int displayOn = 0; // ---------------------------------------------------- int setTemp1(std::string temp1) - { - printf("\nTemp1 : %s\n", temp1.c_str()); + { printf("\nTemp1 : %s\n", temp1.c_str()); BSP_LCD_SetBackColor(backColorTemp1); BSP_LCD_SetTextColor(txtColorTemp1); BSP_LCD_SetFont(&FontFreeMono64); @@ -61,8 +69,7 @@ } // ------------------------------------------------ int setTemp2(std::string temp2) - { - printf("\nTemp2 : %s\n", temp2.c_str()); + { printf("\nTemp2 : %s\n", temp2.c_str()); BSP_LCD_SetBackColor(backColorTemp2); BSP_LCD_SetTextColor(txtColorTemp2); BSP_LCD_SetFont(&FontFreeMono64); @@ -71,16 +78,11 @@ return 1; } -int xTempTitle[3],yTempTitle[3],dxTempTitle[3],dyTempTitle[3],xTxtTempTitle[3],yTxtTempTitle[3]; -uint32_t backColorTempTitle[3], txtColorTempTitle[3]; -char textTempTitle[3][30]; - // ------------------------------------------------------------ int setDisplayTemp() - { int numTemp=0; - for (numTemp=1;numTemp<3;numTemp=numTemp+1) - { - BSP_LCD_SetFont(&Font16); + { int numTemp=0; + for (numTemp=1;numTemp<3;numTemp=numTemp+1) + { BSP_LCD_SetFont(&Font16); BSP_LCD_SetBackColor(backColorTempTitle[numTemp]); BSP_LCD_SetTextColor(backColorTempTitle[numTemp]); BSP_LCD_FillRect(xTempTitle[numTemp], yTempTitle[numTemp], dxTempTitle[numTemp], dyTempTitle[numTemp]); @@ -99,25 +101,14 @@ dxTempTitle[1]=200;dyTempTitle[1]=23; xTxtTempTitle[1]=15;yTxtTempTitle[1]=34; backColorTempTitle[1]=LCD_COLOR_BLACK;txtColorTempTitle[1]=LCD_COLOR_GREEN; - sprintf(textTempTitle[1]," temp Salon "); + //sprintf(textTempTitle[1]," temp Salon "); xTempTitle[2]=264;yTempTitle[2]=30;dxTempTitle[2]=200;dyTempTitle[2]=23;xTxtTempTitle[2]=265;yTxtTempTitle[2]=34; backColorTempTitle[2]=LCD_COLOR_BLACK;txtColorTempTitle[2]=LCD_COLOR_GREEN; - sprintf(textTempTitle[2]," temp Ext "); + // sprintf(textTempTitle[2]," temp Ext "); int xx=setDisplayTemp(); return 1; } -// GroveStreams Settings -extern const char gsApiKey[] = "YOUR_SECRET_API_KEY_HERE"; //Change This!!! -extern const char gsCompName[] = "STM32F746+Discovery"; //Optionally change. Set this to give your component a name when it initially registers. Encode special chars such as spaces. - -extern const char gsCompTmplId[]= ""; //Optional. Tells GS what template to use when the feed initially arrives and a new component needs to be created. - -////GroveStreams groveStreams(gsApiKey, &lcd); -extern GroveStreams groveStreams; - -extern const char* myMac; -int displayOn = 0; // ------------------------------------------------------------ int initDatasGuiJPA() { ////lcd.clear(); @@ -135,8 +126,7 @@ //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"); @@ -161,12 +151,11 @@ if ((displayOn & 0x02) > 0) {touchButtonJPA1(1);} if ((displayOn & 0x04) > 0) {touchButtonJPA1(2);} if ((displayOn & 0x08) > 0) {touchButtonJPA1(3);} - if ((displayOn & 0x10) > 0) {touchButtonJPA1(4);} - + if ((displayOn & 0x10) > 0) {touchButtonJPA1(4);} } else { - sendResult = groveStreams.sendInitDatasJPA(myMac, samples, gsCompName, gsCompTmplId, resultBuffer, sizeof resultBuffer); + /////////// sendResult = groveStreams.sendInitDatasJPA(myMac, samples, gsCompName, gsCompTmplId, resultBuffer, sizeof resultBuffer); if (sendResult == 0) { ////lcd.printf("Send Successful"); printf("Send Successful\n"); @@ -289,8 +278,7 @@ } } // fin test send result } // fin test ethernet actif - if ((displayOn & 0x01) > 0) {setDisplayTemp();} - + if ((displayOn & 0x01) > 0) {setDisplayTemp();} return 1; }