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

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?

UserRevisionLine numberNew contents of line
38domo 0:48863a0964f5 1
38domo 0:48863a0964f5 2 #include "stm32746g_discovery_lcd.h"
38domo 0:48863a0964f5 3 #include "stm32746g_discovery_ts.h"
38domo 0:48863a0964f5 4 #include "mbed.h"
38domo 17:f3c5ec9ca00f 5 //#include "GroveStreams.h"
38domo 0:48863a0964f5 6 #include "MbedJSONValue.h"
jeanpierreaulas 5:ceefd0cfa233 7 Timer timer_touch[16];
38domo 17:f3c5ec9ca00f 8 Timer timer_lcd;
38domo 0:48863a0964f5 9
38domo 12:15ae35cfb03f 10 void sendSerial2(char * str);
38domo 12:15ae35cfb03f 11 void sendSerial7(char * str);
38domo 12:15ae35cfb03f 12
38domo 0:48863a0964f5 13 int initDisplayTemp();
38domo 0:48863a0964f5 14 // GroveStreams Settings
38domo 0:48863a0964f5 15 //extern const char gsApiKey[];// = "YOUR_SECRET_API_KEY_HERE"; //Change This!!!
38domo 0:48863a0964f5 16 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 17 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 18 ////GroveStreams groveStreams(gsApiKey, &lcd);
38domo 17:f3c5ec9ca00f 19 //extern GroveStreams groveStreams;
38domo 0:48863a0964f5 20 extern const char* myMac;
38domo 0:48863a0964f5 21 extern time_t seconds;
38domo 0:48863a0964f5 22 time_t seconds_touches = 0;
38domo 0:48863a0964f5 23 extern time_t lastToucheTime;
38domo 10:41aff2b7acc6 24 // char touch1_text1;
38domo 12:15ae35cfb03f 25 extern int ethernet_actif ; // use ethernet connection
38domo 12:15ae35cfb03f 26 extern int wifi_actif ; // use wifi connection
38domo 0:48863a0964f5 27
38domo 10:41aff2b7acc6 28 // -----------------------------------------------------------------
38domo 0:48863a0964f5 29 int touchInitJPA1()
38domo 0:48863a0964f5 30 { //touch screen init
38domo 0:48863a0964f5 31 //touch screen
38domo 0:48863a0964f5 32 uint8_t status;
38domo 0:48863a0964f5 33 BSP_LCD_Init();
38domo 0:48863a0964f5 34 BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS);
38domo 0:48863a0964f5 35 BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER);
38domo 0:48863a0964f5 36 BSP_LCD_SetFont(&Font12);
38domo 0:48863a0964f5 37 status = BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize());
38domo 10:41aff2b7acc6 38 if (status != TS_OK)
38domo 10:41aff2b7acc6 39 { BSP_LCD_Clear(LCD_COLOR_RED);
38domo 0:48863a0964f5 40 BSP_LCD_SetBackColor(LCD_COLOR_RED);
38domo 0:48863a0964f5 41 BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
38domo 0:48863a0964f5 42 BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT FAIL", CENTER_MODE);
38domo 10:41aff2b7acc6 43 }
38domo 10:41aff2b7acc6 44 else
38domo 17:f3c5ec9ca00f 45 { BSP_LCD_Clear(LCD_COLOR_DARKBLUE);
38domo 0:48863a0964f5 46 BSP_LCD_SetBackColor(LCD_COLOR_BLACK);
38domo 0:48863a0964f5 47 BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
38domo 0:48863a0964f5 48 //BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT OK", CENTER_MODE);
38domo 10:41aff2b7acc6 49 }
jeanpierreaulas 5:ceefd0cfa233 50 int tt = 0;
jeanpierreaulas 5:ceefd0cfa233 51 for (tt=0;tt<16;tt++)
38domo 10:41aff2b7acc6 52 { if(timer_touch[tt].read_ms() > 500)
38domo 10:41aff2b7acc6 53 { timer_touch[tt].stop();timer_touch[tt].reset();
38domo 10:41aff2b7acc6 54 }
38domo 10:41aff2b7acc6 55 }
38domo 0:48863a0964f5 56 return 0;
38domo 0:48863a0964f5 57 }
38domo 10:41aff2b7acc6 58 // -------------------------------------------------------
38domo 0:48863a0964f5 59 int xButton[5],yButton[5],dxButton[5],dyButton[5],xTxtButton[5],yTxtButton[5];
38domo 0:48863a0964f5 60 uint32_t backColorButton[5], txtColorButton[5];
38domo 10:41aff2b7acc6 61 extern char textButton[5][8];
38domo 10:41aff2b7acc6 62 extern char text1Button[5][8];
38domo 0:48863a0964f5 63 char statusButton[5][30];
38domo 0:48863a0964f5 64
38domo 10:41aff2b7acc6 65 // -----------------------------------------------------------------------------------------
38domo 0:48863a0964f5 66 int touchButtonJPA1(int numButton)
38domo 17:f3c5ec9ca00f 67 { if ((numButton > 0) && (numButton < 5))
38domo 17:f3c5ec9ca00f 68 { BSP_LCD_SetBackColor(backColorButton[numButton]);
38domo 0:48863a0964f5 69 BSP_LCD_SetTextColor(backColorButton[numButton]);
38domo 0:48863a0964f5 70 BSP_LCD_FillRect(xButton[numButton], yButton[numButton], dxButton[numButton], dyButton[numButton]);
38domo 0:48863a0964f5 71 BSP_LCD_SetTextColor(txtColorButton[numButton]);
38domo 0:48863a0964f5 72 BSP_LCD_DrawRect(xButton[numButton], yButton[numButton], dxButton[numButton], dyButton[numButton]);
38domo 0:48863a0964f5 73 BSP_LCD_SetFont(&Font20);
38domo 0:48863a0964f5 74 BSP_LCD_DisplayStringAt(xTxtButton[numButton]+52, yTxtButton[numButton], (uint8_t *)statusButton[numButton], LEFT_MODE);
38domo 0:48863a0964f5 75 BSP_LCD_DisplayStringAt(xTxtButton[numButton], yTxtButton[numButton]+28, (uint8_t *)textButton[numButton], LEFT_MODE);
38domo 0:48863a0964f5 76 BSP_LCD_DisplayStringAt(xTxtButton[numButton], yTxtButton[numButton]+48, (uint8_t *)text1Button[numButton], LEFT_MODE);
38domo 0:48863a0964f5 77 }
38domo 0:48863a0964f5 78 return 0;
38domo 0:48863a0964f5 79 }
38domo 0:48863a0964f5 80
38domo 10:41aff2b7acc6 81 // ----------------------------------------------------------------------------------
38domo 0:48863a0964f5 82 // generation de fonts : http://omz-software.com/pythonista/docs/ios/ImageFont.html
38domo 0:48863a0964f5 83 int touchInitGuiJPA1()
38domo 10:41aff2b7acc6 84 { // button 1 en bas a gauche
38domo 0:48863a0964f5 85 xButton[1]=10;yButton[1]=185;dxButton[1]=100;dyButton[1]=80;xTxtButton[1]=12;yTxtButton[1]=190;
38domo 10:41aff2b7acc6 86 backColorButton[1] = LCD_COLOR_GRAY;
38domo 10:41aff2b7acc6 87 txtColorButton[1] = LCD_COLOR_GREEN;
38domo 10:41aff2b7acc6 88 //sprintf(textButton[1],"Lampe ");
38domo 10:41aff2b7acc6 89 //sprintf(text1Button[1],"Sejour");
38domo 0:48863a0964f5 90 sprintf(statusButton[1],"off");
38domo 10:41aff2b7acc6 91 // bouton 2 a cote bouton 1
38domo 0:48863a0964f5 92 xButton[2]=130;yButton[2]=185;dxButton[2]=100;dyButton[2]=80;xTxtButton[2]=132;yTxtButton[2]=190;
38domo 0:48863a0964f5 93 backColorButton[2] = LCD_COLOR_GRAY; txtColorButton[2] = LCD_COLOR_GREEN;
38domo 10:41aff2b7acc6 94 //sprintf(textButton[2],"Lampe ");
38domo 10:41aff2b7acc6 95 //sprintf(text1Button[2],"Sejours");
38domo 0:48863a0964f5 96 sprintf(statusButton[2],"off");
38domo 10:41aff2b7acc6 97 // bouton 3
38domo 0:48863a0964f5 98 xButton[3]=250;yButton[3]=185;dxButton[3]=100;dyButton[3]=80;xTxtButton[3]=252;yTxtButton[3]=190;
38domo 0:48863a0964f5 99 backColorButton[3] = LCD_COLOR_GRAY; txtColorButton[3] = LCD_COLOR_GREEN;
38domo 10:41aff2b7acc6 100 //sprintf(textButton[3],"Lampe ");
38domo 10:41aff2b7acc6 101 //sprintf(text1Button[3],"Sejour");
38domo 0:48863a0964f5 102 sprintf(statusButton[3],"off");
38domo 10:41aff2b7acc6 103 // bouton 4 en bas a ddroite
38domo 0:48863a0964f5 104 xButton[4]=370;yButton[4]=185;dxButton[4]=100;dyButton[4]=80;xTxtButton[4]=372;yTxtButton[4]=190;
38domo 0:48863a0964f5 105 backColorButton[4] = LCD_COLOR_GRAY; txtColorButton[4] = LCD_COLOR_GREEN;
38domo 10:41aff2b7acc6 106 //sprintf(textButton[4],"Lampe ");
38domo 10:41aff2b7acc6 107 //sprintf(text1Button[4],"Sejour");
38domo 0:48863a0964f5 108 sprintf(statusButton[4],"off");
38domo 0:48863a0964f5 109
38domo 0:48863a0964f5 110 touchButtonJPA1(1);
38domo 0:48863a0964f5 111 touchButtonJPA1(2);
38domo 0:48863a0964f5 112 touchButtonJPA1(3);
38domo 0:48863a0964f5 113 touchButtonJPA1(4);
38domo 0:48863a0964f5 114
38domo 0:48863a0964f5 115 BSP_LCD_SetFont(&FontFreeMono64);
38domo 0:48863a0964f5 116 //BSP_LCD_DisplayStringAt(20, 30, (uint8_t *)"0123456789", LEFT_MODE);
38domo 0:48863a0964f5 117 //BSP_LCD_DisplayCharJPA(20, 90, '8');
38domo 0:48863a0964f5 118 BSP_LCD_SetFont(&Font12);
38domo 0:48863a0964f5 119 return 0;
38domo 0:48863a0964f5 120 }
38domo 10:41aff2b7acc6 121
38domo 10:41aff2b7acc6 122 // --------------------------------------------------------------------------
38domo 0:48863a0964f5 123 int touchJPA1()
38domo 17:f3c5ec9ca00f 124 { //touch screen
38domo 0:48863a0964f5 125 TS_StateTypeDef TS_State;
38domo 0:48863a0964f5 126 uint16_t x, y;
38domo 0:48863a0964f5 127 uint8_t text[30];
38domo 0:48863a0964f5 128 uint8_t status = 0;
38domo 0:48863a0964f5 129 uint8_t idx;
38domo 0:48863a0964f5 130 static uint8_t cleared = 0;
38domo 17:f3c5ec9ca00f 131 uint8_t prev_nb_touches = 0;
jeanpierreaulas 5:ceefd0cfa233 132 int tt = 0;
jeanpierreaulas 5:ceefd0cfa233 133 for (tt=0;tt<16;tt++)
jeanpierreaulas 5:ceefd0cfa233 134 {if(timer_touch[tt].read_ms() > 200)
jeanpierreaulas 5:ceefd0cfa233 135 {timer_touch[tt].stop();timer_touch[tt].reset();}}
38domo 0:48863a0964f5 136 //touch screen
38domo 0:48863a0964f5 137 BSP_TS_GetState(&TS_State);
38domo 0:48863a0964f5 138 if (TS_State.touchDetected) {
38domo 0:48863a0964f5 139 // Clear lines corresponding to old touches coordinates
38domo 0:48863a0964f5 140 if (TS_State.touchDetected < prev_nb_touches) {
38domo 0:48863a0964f5 141 for (idx = (TS_State.touchDetected + 1); idx <= 5; idx++) {
38domo 0:48863a0964f5 142 //BSP_LCD_ClearStringLine(idx);
38domo 0:48863a0964f5 143 }
38domo 0:48863a0964f5 144 }
38domo 17:f3c5ec9ca00f 145 prev_nb_touches = TS_State.touchDetected;
38domo 0:48863a0964f5 146 cleared = 0;
38domo 0:48863a0964f5 147 //sprintf((char*)text, "Touches: %d", TS_State.touchDetected);
38domo 0:48863a0964f5 148 //BSP_LCD_DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE);
38domo 0:48863a0964f5 149 for (idx = 0; idx < TS_State.touchDetected; idx++) {
38domo 0:48863a0964f5 150 x = TS_State.touchX[idx];
38domo 0:48863a0964f5 151 y = TS_State.touchY[idx];
38domo 0:48863a0964f5 152 //sprintf((char*)text, "Touch %d: x=%d y=%d ", idx+1, x, y);
38domo 0:48863a0964f5 153 //BSP_LCD_DisplayStringAt(0, LINE(idx+1), (uint8_t *)&text, LEFT_MODE);
38domo 0:48863a0964f5 154 }
38domo 0:48863a0964f5 155
38domo 17:f3c5ec9ca00f 156 //BSP_LCD_DrawPixel(TS_State.touchX[0], TS_State.touchY[0], LCD_COLOR_ORANGE);
38domo 0:48863a0964f5 157 if ((TS_State.touchY[0] > 160) && (TS_State.touchY[0] < (160+80)))
38domo 17:f3c5ec9ca00f 158 { int numTouche = 0;
jeanpierreaulas 5:ceefd0cfa233 159 if ((TS_State.touchX[0] > 10) && (TS_State.touchX[0] < (10+100)))
jeanpierreaulas 5:ceefd0cfa233 160 {if(timer_touch[0].read_ms() == 0) {numTouche = 1;timer_touch[0].start();}}
jeanpierreaulas 5:ceefd0cfa233 161 if ((TS_State.touchX[0] > 130) && (TS_State.touchX[0] < (130+100)))
jeanpierreaulas 5:ceefd0cfa233 162 {if(timer_touch[1].read_ms() == 0) {numTouche = 2;timer_touch[1].start();}}
jeanpierreaulas 5:ceefd0cfa233 163 if ((TS_State.touchX[0] > 250) && (TS_State.touchX[0] < (250+100)))
jeanpierreaulas 5:ceefd0cfa233 164 {if(timer_touch[2].read_ms() == 0) {numTouche = 3;timer_touch[2].start();}}
jeanpierreaulas 5:ceefd0cfa233 165 if ((TS_State.touchX[0] > 370) && (TS_State.touchX[0] < (370+100)))
jeanpierreaulas 5:ceefd0cfa233 166 {if(timer_touch[3].read_ms() == 0) {numTouche = 4;timer_touch[3].start();}}
38domo 0:48863a0964f5 167 if (numTouche >0)
38domo 17:f3c5ec9ca00f 168 { printf("Touche : %d", numTouche);
38domo 0:48863a0964f5 169 sprintf((char*)text, "Touche : %d", numTouche);
38domo 0:48863a0964f5 170 //BSP_LCD_DisplayStringAt(200,0, (uint8_t *)&text, LEFT_MODE);
38domo 0:48863a0964f5 171 status = numTouche;
38domo 0:48863a0964f5 172 }
38domo 17:f3c5ec9ca00f 173 else
38domo 17:f3c5ec9ca00f 174 {lastToucheTime = 0;
38domo 17:f3c5ec9ca00f 175 }
38domo 0:48863a0964f5 176 }
38domo 17:f3c5ec9ca00f 177 else
38domo 17:f3c5ec9ca00f 178 {
38domo 17:f3c5ec9ca00f 179 int numTouche = 9;
38domo 17:f3c5ec9ca00f 180 printf("Touche : %d", numTouche);
38domo 17:f3c5ec9ca00f 181 timer_lcd.stop(); // stop the timer
38domo 17:f3c5ec9ca00f 182 timer_lcd.reset(); // reset the timer
38domo 17:f3c5ec9ca00f 183 BSP_LCD_DisplayOn();
38domo 17:f3c5ec9ca00f 184 }
38domo 0:48863a0964f5 185 } else {
38domo 0:48863a0964f5 186 lastToucheTime = 0;
38domo 0:48863a0964f5 187 if (!cleared) {
38domo 0:48863a0964f5 188 //BSP_LCD_Clear(LCD_COLOR_DARKBLUE);
38domo 0:48863a0964f5 189 //sprintf((char*)text, "Touches: 0");
38domo 0:48863a0964f5 190 //BSP_LCD_DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE);
38domo 0:48863a0964f5 191 //cleared = 1;
38domo 0:48863a0964f5 192 //int ss = touchInitGuiJPA1();
38domo 0:48863a0964f5 193 //ss=initDisplayTemp();
38domo 0:48863a0964f5 194 }
38domo 0:48863a0964f5 195 }
38domo 0:48863a0964f5 196 //touch screen
38domo 0:48863a0964f5 197 return status;
38domo 0:48863a0964f5 198 }
38domo 10:41aff2b7acc6 199
38domo 10:41aff2b7acc6 200 // -----------------------------------------------------------------------
38domo 0:48863a0964f5 201 int sendTouchJPA(int xx)
38domo 12:15ae35cfb03f 202 { uint8_t status = 0;
38domo 12:15ae35cfb03f 203 seconds = time(NULL);
38domo 12:15ae35cfb03f 204 if((seconds - lastToucheTime) > 1)
38domo 12:15ae35cfb03f 205 { char samples[64] = {0};char resultBuffer[2000]= {0};
38domo 12:15ae35cfb03f 206 sprintf(samples,"&Touche=%i",xx);
38domo 12:15ae35cfb03f 207 printf("\nSend Touche=%i\n",xx);
38domo 12:15ae35cfb03f 208 // modifier pour rajouter test ethernet / wifi et action en fonction
38domo 12:15ae35cfb03f 209 if (ethernet_actif == 1 ) // ethernet actif
38domo 12:15ae35cfb03f 210 { printf("\ntraitement Ethernet\n",xx);
38domo 17:f3c5ec9ca00f 211 ///////////// int sendResult = groveStreams.sendJPA(myMac, samples, gsCompName, gsCompTmplId, resultBuffer, sizeof resultBuffer);
38domo 17:f3c5ec9ca00f 212 int sendResult = 0;
38domo 12:15ae35cfb03f 213 if (sendResult == 0)
38domo 12:15ae35cfb03f 214 { ////lcd.printf("Send Successful");
38domo 0:48863a0964f5 215 printf("Send Successful\n");
38domo 12:15ae35cfb03f 216 if (strlen(resultBuffer) > 0)
38domo 12:15ae35cfb03f 217 { //printf("HTTP string : %s\n", resultBuffer);
38domo 0:48863a0964f5 218 MbedJSONValue mbedJson;
38domo 12:15ae35cfb03f 219 parse(mbedJson, resultBuffer);
38domo 0:48863a0964f5 220 int displayOn = 0;
38domo 0:48863a0964f5 221 string s;
38domo 12:15ae35cfb03f 222 if (mbedJson.hasMember("Touche1"))
38domo 12:15ae35cfb03f 223 { s = mbedJson["Touche1"]["BackColor"].get<std::string>();
38domo 0:48863a0964f5 224 backColorButton[1] = (uint32_t)strtoul(s.c_str(), NULL,16);
38domo 0:48863a0964f5 225 s = mbedJson["Touche1"]["TextColor"].get<std::string>();
38domo 0:48863a0964f5 226 txtColorButton[1] = (uint32_t)strtoul(s.c_str(), NULL,16);
38domo 0:48863a0964f5 227 s = mbedJson["Touche1"]["Status"].get<std::string>();
38domo 0:48863a0964f5 228 sprintf(statusButton[1],s.c_str());
38domo 12:15ae35cfb03f 229 displayOn = (0x02 | displayOn);
38domo 12:15ae35cfb03f 230 }
38domo 12:15ae35cfb03f 231 if (mbedJson.hasMember("Touche2"))
38domo 12:15ae35cfb03f 232 { s = mbedJson["Touche2"]["BackColor"].get<std::string>();
38domo 0:48863a0964f5 233 backColorButton[2] = (uint32_t)strtoul(s.c_str(), NULL,16);
38domo 0:48863a0964f5 234 s = mbedJson["Touche2"]["TextColor"].get<std::string>();
38domo 0:48863a0964f5 235 txtColorButton[2] = (uint32_t)strtoul(s.c_str(), NULL,16);
38domo 0:48863a0964f5 236 s = mbedJson["Touche2"]["Status"].get<std::string>();
38domo 0:48863a0964f5 237 sprintf(statusButton[2],s.c_str());
38domo 12:15ae35cfb03f 238 displayOn = (0x04 | displayOn);
38domo 12:15ae35cfb03f 239 }
38domo 12:15ae35cfb03f 240 if (mbedJson.hasMember("Touche3"))
38domo 12:15ae35cfb03f 241 { s = mbedJson["Touche3"]["BackColor"].get<std::string>();
38domo 0:48863a0964f5 242 backColorButton[3] = (uint32_t)strtoul(s.c_str(), NULL,16);
38domo 0:48863a0964f5 243 s = mbedJson["Touche3"]["TextColor"].get<std::string>();
38domo 0:48863a0964f5 244 txtColorButton[3] = (uint32_t)strtoul(s.c_str(), NULL,16);
38domo 0:48863a0964f5 245 s = mbedJson["Touche3"]["Status"].get<std::string>();
38domo 0:48863a0964f5 246 sprintf(statusButton[3],s.c_str());
38domo 12:15ae35cfb03f 247 displayOn = (0x08 | displayOn);
38domo 12:15ae35cfb03f 248 }
38domo 12:15ae35cfb03f 249 if (mbedJson.hasMember("Touche4"))
38domo 12:15ae35cfb03f 250 { s = mbedJson["Touche4"]["BackColor"].get<std::string>();
38domo 0:48863a0964f5 251 backColorButton[4] = (uint32_t)strtoul(s.c_str(), NULL,16);
38domo 0:48863a0964f5 252 s = mbedJson["Touche4"]["TextColor"].get<std::string>();
38domo 0:48863a0964f5 253 txtColorButton[4] = (uint32_t)strtoul(s.c_str(), NULL,16);
38domo 0:48863a0964f5 254 s = mbedJson["Touche4"]["Status"].get<std::string>();
38domo 0:48863a0964f5 255 sprintf(statusButton[4],s.c_str());
38domo 12:15ae35cfb03f 256 displayOn = (0x10 | displayOn);
38domo 12:15ae35cfb03f 257 }
38domo 0:48863a0964f5 258 if ((displayOn & 0x02) > 0) {touchButtonJPA1(1);}
38domo 0:48863a0964f5 259 if ((displayOn & 0x04) > 0) {touchButtonJPA1(2);}
38domo 0:48863a0964f5 260 if ((displayOn & 0x08) > 0) {touchButtonJPA1(3);}
38domo 0:48863a0964f5 261 if ((displayOn & 0x10) > 0) {touchButtonJPA1(4);}
38domo 12:15ae35cfb03f 262 }// fin test result buffer
38domo 12:15ae35cfb03f 263 } // fin test send result
38domo 12:15ae35cfb03f 264 } // fin test ethernet actif
38domo 12:15ae35cfb03f 265 else if (wifi_actif == 1) // wifi actif --------------------------------
38domo 12:15ae35cfb03f 266 { // send trame to wifi to inform touch pressed
38domo 12:15ae35cfb03f 267 printf("\nSend Touche=%i status=%s \n ",xx,statusButton[4] );
38domo 12:15ae35cfb03f 268 // {"Touche":{ "No":"4","Statusl":"Off"}}
38domo 12:15ae35cfb03f 269 sprintf(samples,"{\"Touche\":{\"No\":\"%i\",\"Status\":\"%s\"}}",xx,statusButton[xx]);
38domo 12:15ae35cfb03f 270 printf(samples);
38domo 12:15ae35cfb03f 271 printf ("\n");
38domo 12:15ae35cfb03f 272 sendSerial2(samples);
38domo 12:15ae35cfb03f 273 }
38domo 12:15ae35cfb03f 274 else // traitement en local
38domo 12:15ae35cfb03f 275 { printf("\nTraitement local\n");
38domo 12:15ae35cfb03f 276 }
38domo 12:15ae35cfb03f 277 }
38domo 0:48863a0964f5 278 return status;
38domo 0:48863a0964f5 279 }