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
GuiJPA.cpp@17:f3c5ec9ca00f, 2021-01-13 (annotated)
- Committer:
- 38domo
- Date:
- Wed Jan 13 19:52:35 2021 +0000
- Branch:
- jpa
- Revision:
- 17:f3c5ec9ca00f
- Parent:
- 12:15ae35cfb03f
version 12/01 without ethernet, only tasmota wifi and can
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
38domo | 17:f3c5ec9ca00f | 1 | /* |
38domo | 12:15ae35cfb03f | 2 | var LCD_COLOR_BLUE = "0xFF0000FF"; |
38domo | 12:15ae35cfb03f | 3 | var LCD_COLOR_GREEN = "0xFF00FF00"; |
38domo | 12:15ae35cfb03f | 4 | var LCD_COLOR_RED = "0xFFFF0000"; |
38domo | 12:15ae35cfb03f | 5 | var LCD_COLOR_CYAN = "0xFF00FFFF"; |
38domo | 12:15ae35cfb03f | 6 | var LCD_COLOR_MAGENTA = "0xFFFF00FF"; |
38domo | 12:15ae35cfb03f | 7 | var LCD_COLOR_YELLOW = "0xFFFFFF00"; |
38domo | 12:15ae35cfb03f | 8 | var LCD_COLOR_LIGHTBLUE = "0xFF8080FF"; |
38domo | 12:15ae35cfb03f | 9 | var LCD_COLOR_LIGHTGREEN = "0xFF80FF80"; |
38domo | 12:15ae35cfb03f | 10 | var LCD_COLOR_LIGHTRED = "0xFFFF8080"; |
38domo | 12:15ae35cfb03f | 11 | var LCD_COLOR_LIGHTCYAN = "0xFF80FFFF"; |
38domo | 12:15ae35cfb03f | 12 | var LCD_COLOR_LIGHTMAGENTA = "0xFFFF80FF"; |
38domo | 12:15ae35cfb03f | 13 | var LCD_COLOR_LIGHTYELLOW = "0xFFFFFF80"; |
38domo | 12:15ae35cfb03f | 14 | var LCD_COLOR_DARKBLUE = "0xFF000080"; |
38domo | 12:15ae35cfb03f | 15 | var LCD_COLOR_DARKGREEN = "0xFF008000"; |
38domo | 12:15ae35cfb03f | 16 | var LCD_COLOR_DARKRED = "0xFF800000"; |
38domo | 12:15ae35cfb03f | 17 | var LCD_COLOR_DARKCYAN = "0xFF008080"; |
38domo | 12:15ae35cfb03f | 18 | var LCD_COLOR_DARKMAGENTA = "0xFF800080"; |
38domo | 12:15ae35cfb03f | 19 | var LCD_COLOR_DARKYELLOW = "0xFF808000"; |
38domo | 12:15ae35cfb03f | 20 | var LCD_COLOR_WHITE = "0xFFFFFFFF"; |
38domo | 12:15ae35cfb03f | 21 | var LCD_COLOR_LIGHTGRAY = "0xFFD3D3D3"; |
38domo | 12:15ae35cfb03f | 22 | var LCD_COLOR_GRAY = "0xFF808080"; |
38domo | 12:15ae35cfb03f | 23 | var LCD_COLOR_DARKGRAY = "0xFF404040"; |
38domo | 12:15ae35cfb03f | 24 | var LCD_COLOR_BLACK = "0xFF000000"; |
38domo | 12:15ae35cfb03f | 25 | var LCD_COLOR_BROWN = "0xFFA52A2A"; |
38domo | 12:15ae35cfb03f | 26 | var LCD_COLOR_ORANGE = "0xFFFFA500"; |
38domo | 12:15ae35cfb03f | 27 | var LCD_COLOR_TRANSPARENT = "0xFF000000"; |
38domo | 12:15ae35cfb03f | 28 | */ |
38domo | 12:15ae35cfb03f | 29 | |
38domo | 0:48863a0964f5 | 30 | #include "stm32746g_discovery_lcd.h" |
38domo | 0:48863a0964f5 | 31 | #include "stm32746g_discovery_ts.h" |
38domo | 0:48863a0964f5 | 32 | #include "MbedJSONValue.h" |
38domo | 0:48863a0964f5 | 33 | #include "GroveStreams.h" |
38domo | 17:f3c5ec9ca00f | 34 | //#include <string> |
38domo | 0:48863a0964f5 | 35 | |
38domo | 0:48863a0964f5 | 36 | int touchButtonJPA1(int numButton); |
38domo | 0:48863a0964f5 | 37 | extern uint32_t backColorButton[5]; |
38domo | 0:48863a0964f5 | 38 | extern uint32_t txtColorButton[5]; |
38domo | 10:41aff2b7acc6 | 39 | char textButton[5][30]; |
38domo | 17:f3c5ec9ca00f | 40 | char text1Button[5][30]; |
38domo | 0:48863a0964f5 | 41 | extern char statusButton[5][30]; |
38domo | 10:41aff2b7acc6 | 42 | |
38domo | 10:41aff2b7acc6 | 43 | extern int ethernet_actif ; // use ethernet connection |
38domo | 10:41aff2b7acc6 | 44 | extern int wifi_actif ; // use wifi connection |
38domo | 10:41aff2b7acc6 | 45 | |
38domo | 0:48863a0964f5 | 46 | uint32_t backColorTemp1=LCD_COLOR_BLACK, txtColorTemp1=LCD_COLOR_GREEN; |
38domo | 0:48863a0964f5 | 47 | uint32_t backColorTemp2=LCD_COLOR_BLACK, txtColorTemp2=LCD_COLOR_GREEN; |
38domo | 17:f3c5ec9ca00f | 48 | int xTempTitle[3],yTempTitle[3],dxTempTitle[3],dyTempTitle[3],xTxtTempTitle[3],yTxtTempTitle[3]; |
38domo | 17:f3c5ec9ca00f | 49 | uint32_t backColorTempTitle[3], txtColorTempTitle[3]; |
38domo | 17:f3c5ec9ca00f | 50 | char textTempTitle[3][30]; |
38domo | 17:f3c5ec9ca00f | 51 | // GroveStreams Settings |
38domo | 17:f3c5ec9ca00f | 52 | extern const char gsApiKey[] = "YOUR_SECRET_API_KEY_HERE"; //Change This!!! |
38domo | 17:f3c5ec9ca00f | 53 | 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. |
38domo | 17:f3c5ec9ca00f | 54 | extern const char gsCompTmplId[]= ""; //Optional. Tells GS what template to use when the feed initially arrives and a new component needs to be created. |
38domo | 17:f3c5ec9ca00f | 55 | ////GroveStreams groveStreams(gsApiKey, &lcd); |
38domo | 17:f3c5ec9ca00f | 56 | //extern GroveStreams groveStreams; |
38domo | 17:f3c5ec9ca00f | 57 | extern const char* myMac; |
38domo | 17:f3c5ec9ca00f | 58 | int displayOn = 0; |
38domo | 0:48863a0964f5 | 59 | |
38domo | 10:41aff2b7acc6 | 60 | // ---------------------------------------------------- |
38domo | 0:48863a0964f5 | 61 | int setTemp1(std::string temp1) |
38domo | 17:f3c5ec9ca00f | 62 | { printf("\nTemp1 : %s\n", temp1.c_str()); |
38domo | 0:48863a0964f5 | 63 | BSP_LCD_SetBackColor(backColorTemp1); |
38domo | 0:48863a0964f5 | 64 | BSP_LCD_SetTextColor(txtColorTemp1); |
38domo | 0:48863a0964f5 | 65 | BSP_LCD_SetFont(&FontFreeMono64); |
38domo | 0:48863a0964f5 | 66 | BSP_LCD_DisplayStringAt(10, 60, (uint8_t *)temp1.c_str(), LEFT_MODE); |
38domo | 0:48863a0964f5 | 67 | BSP_LCD_SetFont(&Font12); |
38domo | 0:48863a0964f5 | 68 | return 1; |
38domo | 0:48863a0964f5 | 69 | } |
38domo | 10:41aff2b7acc6 | 70 | // ------------------------------------------------ |
38domo | 0:48863a0964f5 | 71 | int setTemp2(std::string temp2) |
38domo | 17:f3c5ec9ca00f | 72 | { printf("\nTemp2 : %s\n", temp2.c_str()); |
38domo | 0:48863a0964f5 | 73 | BSP_LCD_SetBackColor(backColorTemp2); |
38domo | 0:48863a0964f5 | 74 | BSP_LCD_SetTextColor(txtColorTemp2); |
38domo | 0:48863a0964f5 | 75 | BSP_LCD_SetFont(&FontFreeMono64); |
38domo | 0:48863a0964f5 | 76 | BSP_LCD_DisplayStringAt(260, 60, (uint8_t *)temp2.c_str(), LEFT_MODE); |
38domo | 0:48863a0964f5 | 77 | BSP_LCD_SetFont(&Font12); |
38domo | 0:48863a0964f5 | 78 | return 1; |
38domo | 0:48863a0964f5 | 79 | } |
38domo | 0:48863a0964f5 | 80 | |
38domo | 10:41aff2b7acc6 | 81 | // ------------------------------------------------------------ |
38domo | 0:48863a0964f5 | 82 | int setDisplayTemp() |
38domo | 17:f3c5ec9ca00f | 83 | { int numTemp=0; |
38domo | 17:f3c5ec9ca00f | 84 | for (numTemp=1;numTemp<3;numTemp=numTemp+1) |
38domo | 17:f3c5ec9ca00f | 85 | { BSP_LCD_SetFont(&Font16); |
38domo | 0:48863a0964f5 | 86 | BSP_LCD_SetBackColor(backColorTempTitle[numTemp]); |
38domo | 0:48863a0964f5 | 87 | BSP_LCD_SetTextColor(backColorTempTitle[numTemp]); |
38domo | 0:48863a0964f5 | 88 | BSP_LCD_FillRect(xTempTitle[numTemp], yTempTitle[numTemp], dxTempTitle[numTemp], dyTempTitle[numTemp]); |
38domo | 0:48863a0964f5 | 89 | BSP_LCD_SetTextColor(txtColorTempTitle[numTemp]); |
38domo | 0:48863a0964f5 | 90 | BSP_LCD_DrawRect(xTempTitle[numTemp], yTempTitle[numTemp], dxTempTitle[numTemp], dyTempTitle[numTemp]); |
38domo | 0:48863a0964f5 | 91 | BSP_LCD_DisplayStringAt(xTxtTempTitle[numTemp], yTxtTempTitle[numTemp], (uint8_t *)textTempTitle[numTemp], LEFT_MODE); |
38domo | 0:48863a0964f5 | 92 | } |
38domo | 0:48863a0964f5 | 93 | BSP_LCD_SetFont(&Font8); |
38domo | 0:48863a0964f5 | 94 | return 1; |
38domo | 0:48863a0964f5 | 95 | } |
38domo | 0:48863a0964f5 | 96 | |
38domo | 10:41aff2b7acc6 | 97 | // ------------------------------------------------------- |
38domo | 0:48863a0964f5 | 98 | int initDisplayTemp() |
38domo | 0:48863a0964f5 | 99 | { printf("\nInit DisplayTemp \n"); |
38domo | 0:48863a0964f5 | 100 | xTempTitle[1]=14;yTempTitle[1]=30; |
38domo | 0:48863a0964f5 | 101 | dxTempTitle[1]=200;dyTempTitle[1]=23; |
38domo | 0:48863a0964f5 | 102 | xTxtTempTitle[1]=15;yTxtTempTitle[1]=34; |
38domo | 0:48863a0964f5 | 103 | backColorTempTitle[1]=LCD_COLOR_BLACK;txtColorTempTitle[1]=LCD_COLOR_GREEN; |
38domo | 17:f3c5ec9ca00f | 104 | //sprintf(textTempTitle[1]," temp Salon "); |
38domo | 0:48863a0964f5 | 105 | xTempTitle[2]=264;yTempTitle[2]=30;dxTempTitle[2]=200;dyTempTitle[2]=23;xTxtTempTitle[2]=265;yTxtTempTitle[2]=34; |
38domo | 0:48863a0964f5 | 106 | backColorTempTitle[2]=LCD_COLOR_BLACK;txtColorTempTitle[2]=LCD_COLOR_GREEN; |
38domo | 17:f3c5ec9ca00f | 107 | // sprintf(textTempTitle[2]," temp Ext "); |
38domo | 0:48863a0964f5 | 108 | int xx=setDisplayTemp(); |
38domo | 0:48863a0964f5 | 109 | return 1; |
38domo | 0:48863a0964f5 | 110 | } |
38domo | 0:48863a0964f5 | 111 | |
38domo | 10:41aff2b7acc6 | 112 | // ------------------------------------------------------------ |
38domo | 0:48863a0964f5 | 113 | int initDatasGuiJPA() |
38domo | 0:48863a0964f5 | 114 | { ////lcd.clear(); |
38domo | 0:48863a0964f5 | 115 | ////lcd.printf("Getting Samples..."); |
38domo | 0:48863a0964f5 | 116 | printf("Getting Samples...\n"); |
38domo | 0:48863a0964f5 | 117 | //Assemble the samples into URL parameters which are seperated with the "&" character |
38domo | 0:48863a0964f5 | 118 | // Example: &s1=6.2&s2=78.231 |
38domo | 0:48863a0964f5 | 119 | char samples[64] = {0}; |
38domo | 0:48863a0964f5 | 120 | sprintf(samples, "&datas=init"); |
38domo | 0:48863a0964f5 | 121 | //Append on command requests (request stream values) |
38domo | 0:48863a0964f5 | 122 | //This will indicate to GroveStreams to return the last value |
38domo | 0:48863a0964f5 | 123 | // of each request stream during the sample upload |
38domo | 0:48863a0964f5 | 124 | //strcat(samples, "&rsid=freq&rsid=led"); |
38domo | 0:48863a0964f5 | 125 | char resultBuffer[2000]= {0}; |
38domo | 0:48863a0964f5 | 126 | //Sending Samples (and returning current command stream values) |
38domo | 0:48863a0964f5 | 127 | int sendResult=1; |
38domo | 10:41aff2b7acc6 | 128 | printf("InitDataGuiJPA - Ethernet actif %i \n", ethernet_actif); |
38domo | 17:f3c5ec9ca00f | 129 | |
38domo | 11:b198b2f2676f | 130 | if (ethernet_actif == 0) // ethernet inactif ------------------------------------- |
38domo | 10:41aff2b7acc6 | 131 | { // on n'utilise pas ethernet. lecture valeurs from sdcard |
38domo | 10:41aff2b7acc6 | 132 | printf("Use local graphic datas\n"); |
38domo | 10:41aff2b7acc6 | 133 | // display temp1 window |
38domo | 10:41aff2b7acc6 | 134 | // display temp2 |
38domo | 10:41aff2b7acc6 | 135 | // add wifi test. |
38domo | 10:41aff2b7acc6 | 136 | // if wifi actif send request tasmota to retrieve values text box & buttons status |
38domo | 10:41aff2b7acc6 | 137 | if (wifi_actif == 0) |
38domo | 10:41aff2b7acc6 | 138 | { // si wifi actif launch tasmota request |
38domo | 10:41aff2b7acc6 | 139 | |
38domo | 10:41aff2b7acc6 | 140 | // reteive tasmota results to display |
38domo | 11:b198b2f2676f | 141 | } |
38domo | 11:b198b2f2676f | 142 | backColorTemp1 = (uint32_t)strtoul("0xFF808080", NULL,16); //gray |
38domo | 11:b198b2f2676f | 143 | txtColorTemp1 = (uint32_t)strtoul("0xFFFFFF00", NULL,16) ; |
38domo | 11:b198b2f2676f | 144 | backColorTemp2 = (uint32_t)strtoul("0xFF808080", NULL,16); |
38domo | 11:b198b2f2676f | 145 | txtColorTemp2 = (uint32_t)strtoul("0xFFFFFF00", NULL,16) ; |
38domo | 12:15ae35cfb03f | 146 | displayOn = (0x01 | displayOn);// display temp1 & temp2 box |
38domo | 12:15ae35cfb03f | 147 | displayOn = (0x02 | displayOn); // touche 1 |
38domo | 12:15ae35cfb03f | 148 | displayOn = (0x04 | displayOn); // touche 2 |
38domo | 12:15ae35cfb03f | 149 | displayOn = (0x08 | displayOn); // touche 3 |
38domo | 12:15ae35cfb03f | 150 | displayOn = (0x10 | displayOn); //touche 4 |
38domo | 12:15ae35cfb03f | 151 | if ((displayOn & 0x02) > 0) {touchButtonJPA1(1);} |
38domo | 12:15ae35cfb03f | 152 | if ((displayOn & 0x04) > 0) {touchButtonJPA1(2);} |
38domo | 12:15ae35cfb03f | 153 | if ((displayOn & 0x08) > 0) {touchButtonJPA1(3);} |
38domo | 17:f3c5ec9ca00f | 154 | if ((displayOn & 0x10) > 0) {touchButtonJPA1(4);} |
38domo | 10:41aff2b7acc6 | 155 | } |
38domo | 10:41aff2b7acc6 | 156 | else |
38domo | 10:41aff2b7acc6 | 157 | { |
38domo | 17:f3c5ec9ca00f | 158 | /////////// sendResult = groveStreams.sendInitDatasJPA(myMac, samples, gsCompName, gsCompTmplId, resultBuffer, sizeof resultBuffer); |
38domo | 10:41aff2b7acc6 | 159 | if (sendResult == 0) |
38domo | 10:41aff2b7acc6 | 160 | { ////lcd.printf("Send Successful"); |
38domo | 0:48863a0964f5 | 161 | printf("Send Successful\n"); |
38domo | 0:48863a0964f5 | 162 | //Handle command streams |
38domo | 10:41aff2b7acc6 | 163 | if (strlen(resultBuffer) > 0 && resultBuffer[0] == '{') |
38domo | 10:41aff2b7acc6 | 164 | { printf("Datas : %s\n",resultBuffer); |
38domo | 0:48863a0964f5 | 165 | MbedJSONValue mbedJson; |
38domo | 0:48863a0964f5 | 166 | parse(mbedJson, resultBuffer); |
38domo | 0:48863a0964f5 | 167 | //sprintf((char*)text, "HTTP string : %s\n", resultBuffer); |
38domo | 0:48863a0964f5 | 168 | //BSP_LCD_DisplayStringAt(0, LINE(10), (uint8_t *)&text, LEFT_MODE); |
38domo | 10:41aff2b7acc6 | 169 | //int displayOn = 0; |
38domo | 0:48863a0964f5 | 170 | string s; |
38domo | 10:41aff2b7acc6 | 171 | if (mbedJson.hasMember("Temp1")) |
38domo | 10:41aff2b7acc6 | 172 | { s = mbedJson["Temp1"]["backColorTemp"].get<std::string>(); |
38domo | 0:48863a0964f5 | 173 | backColorTemp1 = (uint32_t)strtoul(s.c_str(), NULL,16); |
38domo | 0:48863a0964f5 | 174 | //printf("Temp1 backColorTemp1 : %s %X\n",s.c_str(),(uint32_t)strtoul(s.c_str(), NULL,0)); |
38domo | 0:48863a0964f5 | 175 | s = mbedJson["Temp1"]["txtColorTemp"].get<std::string>(); |
38domo | 0:48863a0964f5 | 176 | txtColorTemp1 = (uint32_t)strtoul(s.c_str(), NULL,16) ; |
38domo | 0:48863a0964f5 | 177 | //printf("Temp1 txtColorTemp1 : %s %X\n",s.c_str(),(uint32_t)strtoul(s.c_str(), NULL,0)); |
38domo | 0:48863a0964f5 | 178 | s = mbedJson["Temp1"]["text"].get<std::string>(); |
38domo | 0:48863a0964f5 | 179 | sprintf(textTempTitle[1],s.c_str()); |
38domo | 0:48863a0964f5 | 180 | printf("Temp1 text : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 181 | displayOn = (0x01 | displayOn); |
38domo | 10:41aff2b7acc6 | 182 | } |
38domo | 10:41aff2b7acc6 | 183 | if (mbedJson.hasMember("Temp2")) |
38domo | 10:41aff2b7acc6 | 184 | { s = mbedJson["Temp2"]["backColorTemp"].get<std::string>(); |
38domo | 0:48863a0964f5 | 185 | backColorTemp2 = (uint32_t)strtoul(s.c_str(), NULL,16); |
38domo | 0:48863a0964f5 | 186 | //printf("Temp2 text : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 187 | s = mbedJson["Temp2"]["txtColorTemp"].get<std::string>(); |
38domo | 0:48863a0964f5 | 188 | txtColorTemp2 = (uint32_t)strtoul(s.c_str(), NULL,16) ; |
38domo | 0:48863a0964f5 | 189 | //printf("Temp2 backColorTemp2 : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 190 | s = mbedJson["Temp2"]["text"].get<std::string>(); |
38domo | 0:48863a0964f5 | 191 | sprintf(textTempTitle[2],s.c_str()); |
38domo | 0:48863a0964f5 | 192 | printf("Temp2 text : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 193 | displayOn = (0x01 | displayOn); |
38domo | 10:41aff2b7acc6 | 194 | } |
38domo | 10:41aff2b7acc6 | 195 | if (mbedJson.hasMember("Touche1")) |
38domo | 10:41aff2b7acc6 | 196 | { s = mbedJson["Touche1"]["Status"].get<std::string>(); |
38domo | 0:48863a0964f5 | 197 | sprintf(statusButton[1],s.c_str()); |
38domo | 0:48863a0964f5 | 198 | printf("Touche1 Status : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 199 | s = mbedJson["Touche1"]["BackColor"].get<std::string>(); |
38domo | 0:48863a0964f5 | 200 | backColorButton[1] = (uint32_t)strtoul(s.c_str(), NULL,16); |
38domo | 0:48863a0964f5 | 201 | printf("Touche1 BackColor : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 202 | s = mbedJson["Touche1"]["TextColor"].get<std::string>(); |
38domo | 0:48863a0964f5 | 203 | txtColorButton[1] = (uint32_t)strtoul(s.c_str(), NULL,16); |
38domo | 0:48863a0964f5 | 204 | printf("Touche1 TextColor : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 205 | s = mbedJson["Touche1"]["text"].get<std::string>(); |
38domo | 0:48863a0964f5 | 206 | sprintf(textButton[1],s.c_str()); |
38domo | 0:48863a0964f5 | 207 | printf("Touche1 text : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 208 | s = mbedJson["Touche1"]["text1"].get<std::string>(); |
38domo | 0:48863a0964f5 | 209 | sprintf(text1Button[1],s.c_str()); |
38domo | 0:48863a0964f5 | 210 | printf("Touche1 text1 : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 211 | displayOn = (0x02 | displayOn); |
38domo | 10:41aff2b7acc6 | 212 | } |
38domo | 10:41aff2b7acc6 | 213 | if (mbedJson.hasMember("Touche2")) |
38domo | 10:41aff2b7acc6 | 214 | { s = mbedJson["Touche2"]["Status"].get<std::string>(); |
38domo | 0:48863a0964f5 | 215 | sprintf(statusButton[2],s.c_str()); |
38domo | 0:48863a0964f5 | 216 | printf("Touche2 Status : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 217 | s = mbedJson["Touche2"]["BackColor"].get<std::string>(); |
38domo | 0:48863a0964f5 | 218 | backColorButton[2] = (uint32_t)strtoul(s.c_str(), NULL,16); |
38domo | 0:48863a0964f5 | 219 | printf("Touche1 BackColor : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 220 | s = mbedJson["Touche2"]["TextColor"].get<std::string>(); |
38domo | 0:48863a0964f5 | 221 | txtColorButton[2] = (uint32_t)strtoul(s.c_str(), NULL,16); |
38domo | 0:48863a0964f5 | 222 | printf("Touche2 TextColor : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 223 | s = mbedJson["Touche2"]["text"].get<std::string>(); |
38domo | 0:48863a0964f5 | 224 | sprintf(textButton[2],s.c_str()); |
38domo | 0:48863a0964f5 | 225 | printf("Touche2 text : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 226 | s = mbedJson["Touche2"]["text1"].get<std::string>(); |
38domo | 0:48863a0964f5 | 227 | sprintf(text1Button[2],s.c_str()); |
38domo | 0:48863a0964f5 | 228 | printf("Touche2 text1 : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 229 | displayOn = (0x04 | displayOn); |
38domo | 10:41aff2b7acc6 | 230 | } |
38domo | 10:41aff2b7acc6 | 231 | if (mbedJson.hasMember("Touche3")) |
38domo | 10:41aff2b7acc6 | 232 | { s = mbedJson["Touche3"]["Status"].get<std::string>(); |
38domo | 0:48863a0964f5 | 233 | sprintf(statusButton[3],s.c_str()); |
38domo | 0:48863a0964f5 | 234 | printf("Touche3 Status : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 235 | s = mbedJson["Touche3"]["BackColor"].get<std::string>(); |
38domo | 0:48863a0964f5 | 236 | backColorButton[3] = (uint32_t)strtoul(s.c_str(), NULL,16); |
38domo | 0:48863a0964f5 | 237 | printf("Touche3 BackColor : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 238 | s = mbedJson["Touche3"]["TextColor"].get<std::string>(); |
38domo | 0:48863a0964f5 | 239 | txtColorButton[3] = (uint32_t)strtoul(s.c_str(), NULL,16); |
38domo | 0:48863a0964f5 | 240 | printf("Touche3 TextColor : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 241 | s = mbedJson["Touche3"]["text"].get<std::string>(); |
38domo | 0:48863a0964f5 | 242 | sprintf(textButton[3],s.c_str()); |
38domo | 0:48863a0964f5 | 243 | printf("Touche3 text : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 244 | s = mbedJson["Touche3"]["text1"].get<std::string>(); |
38domo | 0:48863a0964f5 | 245 | sprintf(text1Button[3],s.c_str()); |
38domo | 0:48863a0964f5 | 246 | printf("Touche3 text1 : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 247 | displayOn = (0x08 | displayOn); |
38domo | 10:41aff2b7acc6 | 248 | } |
38domo | 10:41aff2b7acc6 | 249 | if (mbedJson.hasMember("Touche4")) |
38domo | 10:41aff2b7acc6 | 250 | { s = mbedJson["Touche4"]["Status"].get<std::string>(); |
38domo | 0:48863a0964f5 | 251 | sprintf(statusButton[4],s.c_str()); |
38domo | 0:48863a0964f5 | 252 | printf("Touche4 Status : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 253 | s = mbedJson["Touche4"]["BackColor"].get<std::string>(); |
38domo | 0:48863a0964f5 | 254 | backColorButton[4] = (uint32_t)strtoul(s.c_str(), NULL,16); |
38domo | 0:48863a0964f5 | 255 | printf("Touche4 BackColor : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 256 | s = mbedJson["Touche4"]["TextColor"].get<std::string>(); |
38domo | 0:48863a0964f5 | 257 | txtColorButton[4] = (uint32_t)strtoul(s.c_str(), NULL,16); |
38domo | 0:48863a0964f5 | 258 | printf("Touche4 TextColor : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 259 | s = mbedJson["Touche4"]["text"].get<std::string>(); |
38domo | 0:48863a0964f5 | 260 | sprintf(textButton[4],s.c_str()); |
38domo | 0:48863a0964f5 | 261 | printf("Touche4 text : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 262 | s = mbedJson["Touche4"]["text1"].get<std::string>(); |
38domo | 0:48863a0964f5 | 263 | sprintf(text1Button[4],s.c_str()); |
38domo | 0:48863a0964f5 | 264 | printf("Touche4 text1 : %s\n",s.c_str()); |
38domo | 0:48863a0964f5 | 265 | displayOn = (0x10 | displayOn); |
38domo | 10:41aff2b7acc6 | 266 | } |
38domo | 10:41aff2b7acc6 | 267 | if (mbedJson.hasMember("Temp1")) |
38domo | 10:41aff2b7acc6 | 268 | { //int pp=setTemp1(mbedJson["Temp1"].get<std::string>()); |
38domo | 10:41aff2b7acc6 | 269 | } |
38domo | 10:41aff2b7acc6 | 270 | if (mbedJson.hasMember("Temp2")) |
38domo | 10:41aff2b7acc6 | 271 | { //int pp=setTemp1(mbedJson["Temp2"].get<std::string>()); |
38domo | 10:41aff2b7acc6 | 272 | } |
38domo | 10:41aff2b7acc6 | 273 | |
38domo | 0:48863a0964f5 | 274 | if ((displayOn & 0x02) > 0) {touchButtonJPA1(1);} |
38domo | 0:48863a0964f5 | 275 | if ((displayOn & 0x04) > 0) {touchButtonJPA1(2);} |
38domo | 0:48863a0964f5 | 276 | if ((displayOn & 0x08) > 0) {touchButtonJPA1(3);} |
38domo | 0:48863a0964f5 | 277 | if ((displayOn & 0x10) > 0) {touchButtonJPA1(4);} |
38domo | 0:48863a0964f5 | 278 | } |
38domo | 10:41aff2b7acc6 | 279 | } // fin test send result |
38domo | 10:41aff2b7acc6 | 280 | } // fin test ethernet actif |
38domo | 17:f3c5ec9ca00f | 281 | if ((displayOn & 0x01) > 0) {setDisplayTemp();} |
38domo | 0:48863a0964f5 | 282 | return 1; |
38domo | 0:48863a0964f5 | 283 | } |
38domo | 0:48863a0964f5 | 284 |