Skip to content

Commit bd438c0

Browse files
committed
plugin JSON head
1 parent bdb9112 commit bd438c0

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

examples/esp8266/WebMenu/WebMenu/WebMenu.ino

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,22 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length
238238
webSocket.sendTXT(num, "console.log('ArduinoMenu Connected')");
239239
}
240240
break;
241-
case WStype_TEXT:
242-
//USE_SERIAL.printf("[%u] get Text: %s\n", num, payload);
243-
nav.async((const char*)payload);//this is slow!!!!!!!!
244-
break;
241+
case WStype_TEXT: {
242+
//USE_SERIAL.printf("[%u] get Text: %s\n", num, payload);
243+
// nav.async((const char*)payload);//this is slow!!!!!!!!
244+
__trace(Serial.printf("[%u] get Text: %s\n", num, payload));
245+
char*s=(char*)payload;
246+
_trace(Serial<<"serve websocket menu"<<endl);
247+
wsOut.response.remove(0);
248+
wsOut<<"{\"output\":\"";
249+
wsNav.async((const char*)payload);
250+
wsOut<<"\",\n\"menu\":";
251+
wsNav.doOutput();
252+
wsOut<<"\n}";
253+
webSocket.sendTXT(num,wsOut.response);
254+
// wsOut.response.remove(0);
255+
// jsonEnd();
256+
} break;
245257
case WStype_BIN: {
246258
USE_SERIAL<<"[WSc] get binary length:"<<length<<"[";
247259
for(int c=0;c<length;c++) {

examples/esp8266/WebMenu/platformio.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ build_flags =
3939
-DMENU_ASYNC
4040
-DMENU_FMT_WRAPS
4141
-DMENU_IDLE_BKGND
42-
-DMENU_DEBUG
43-
-DWEB_DEBUG
42+
-DNO_MENU_DEBUG
43+
-DNO_WEB_DEBUG
4444
-DMENU_SSID="\"r-site.net\"" -DMENU_PASS="\"rsite.2011\""
4545
src_build_flags = !echo "-Wno-write-strings -Wno-reorder -Wno-strict-aliasing -Wno-sign-compare -DLOC="$PLATFORMIO_LOC

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ArduinoMenu library
2-
version=4.15.4
2+
version=4.15.5
33
author=Rui Azevedo, [email protected]
44
maintainer=neu-rah, [email protected]
55
sentence=Generic menu/interactivity system

0 commit comments

Comments
 (0)