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