Skip to content

Commit bc65f1a

Browse files
committed
webmenu websocket reconnect
1 parent afb31ff commit bc65f1a

File tree

8 files changed

+19
-20
lines changed

8 files changed

+19
-20
lines changed

examples/SDCard/SDCard/SDCard.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ result filePick(eventMask event, navNode& nav, prompt &item) {
4343
return proceed;
4444
}
4545

46-
//this limit also the folders depth we can nav
47-
#define MAX_DEPTH 15
46+
#define MAX_DEPTH 2
4847

4948
MENU(mainMenu,"Main menu",doNothing,noEvent,wrapStyle
5049
,SUBMENU(filePickMenu)

examples/esp8266/EscControl/EscControl/EscControl.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ menuOut& operator<<(menuOut& o,endlObj) {
5151
return o;
5252
}
5353

54-
//this version numbers MUST be the same as data/1.2
55-
#define CUR_VERSION "1.4"
54+
//this version number MUST be the same as data/*
55+
#define CUR_VERSION "1.5"
5656
#define APName "EscControl"
5757

5858
#define ESCPIN 2
@@ -72,7 +72,7 @@ Servo myservo;
7272

7373
const char* ssid = MENU_SSID;
7474
const char* password = MENU_PASS;
75-
const char* serverName="192.168.1.79";
75+
// const char* serverName="192.168.1.79";
7676

7777
#define HTTP_PORT 80
7878
#define WS_PORT 81

examples/esp8266/EscControl/EscControl/data/1.4/bootstrap.xslt renamed to examples/esp8266/EscControl/EscControl/data/1.5/bootstrap.xslt

File renamed without changes.

examples/esp8266/EscControl/EscControl/data/1.4/device.xslt renamed to examples/esp8266/EscControl/EscControl/data/1.5/device.xslt

File renamed without changes.

examples/esp8266/EscControl/EscControl/data/1.4/index.html renamed to examples/esp8266/EscControl/EscControl/data/1.5/index.html

File renamed without changes.

examples/esp8266/EscControl/EscControl/data/1.4/menu.css renamed to examples/esp8266/EscControl/EscControl/data/1.5/menu.css

File renamed without changes.

examples/esp8266/EscControl/EscControl/data/1.4/menu.xslt renamed to examples/esp8266/EscControl/EscControl/data/1.5/menu.xslt

File renamed without changes.

examples/esp8266/EscControl/EscControl/data/1.4/r-site.js renamed to examples/esp8266/EscControl/EscControl/data/1.5/r-site.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,21 @@ function mkPath(m) {
103103
}
104104

105105
function menu(o,cnt) {
106-
// if(connection.readyState!=1) {//not connected (yet)?
107-
// console.log("not connected yet...")
108-
// if (connection.readyState==3) {//disconnected?
109-
// console.log("connecting websocket");
110-
// connectWS();
111-
// }
112-
// setTimeout(function() {//check latter...
113-
// console.log("checking websocket connetion");
114-
// if (connection.readyState!=1&&cnt>5) {//give up?
115-
// alert("websocket disconnected, please refresh page");//TODO: put mutilang here
116-
// return;
117-
// } else menu(o,cnt?cnt+1:0);
118-
// },500);
119-
// return;
120-
// }
106+
if(connection.readyState!=1) {//not connected (yet)?
107+
console.log("not connected yet...")
108+
if (connection.readyState==3) {//disconnected?
109+
console.log("connecting websocket");
110+
connectWS();
111+
}
112+
setTimeout(function() {//check latter...
113+
console.log("checking websocket connetion");
114+
if (connection.readyState!=1&&cnt>5) {//give up?
115+
alert("websocket disconnected, please refresh page");//TODO: put mutilang here
116+
return;
117+
} else menu(o,cnt?cnt+1:0);
118+
},500);
119+
return;
120+
}
121121
console.log("send ws",o);
122122
return connection.send(o);
123123
}

0 commit comments

Comments
 (0)