0.5.3 - added auto reconnect fn to javascript to fix broken page loads in some cases
This commit is contained in:
+11
-9
@@ -896,7 +896,8 @@ $._loader = function(vis) {
|
|||||||
var screen = [];
|
var screen = [];
|
||||||
var blinkIval;
|
var blinkIval;
|
||||||
|
|
||||||
/** Clear screen */
|
/*
|
||||||
|
/!** Clear screen *!/
|
||||||
function cls() {
|
function cls() {
|
||||||
screen.forEach(function(cell, i) {
|
screen.forEach(function(cell, i) {
|
||||||
cell.t = ' ';
|
cell.t = ' ';
|
||||||
@@ -905,6 +906,7 @@ $._loader = function(vis) {
|
|||||||
blit(cell);
|
blit(cell);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/** Set text and color at XY */
|
/** Set text and color at XY */
|
||||||
function cellAt(y, x) {
|
function cellAt(y, x) {
|
||||||
@@ -916,14 +918,15 @@ $._loader = function(vis) {
|
|||||||
return cellAt(cursor.y, cursor.x);
|
return cellAt(cursor.y, cursor.x);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Enable or disable cursor visibility */
|
/*
|
||||||
|
/!** Enable or disable cursor visibility *!/
|
||||||
function cursorEnable(enable) {
|
function cursorEnable(enable) {
|
||||||
cursor.hidden = !enable;
|
cursor.hidden = !enable;
|
||||||
cursor.a &= enable;
|
cursor.a &= enable;
|
||||||
blit(cursorCell(), cursor.a);
|
blit(cursorCell(), cursor.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Safely move cursor */
|
/!** Safely move cursor *!/
|
||||||
function cursorSet(y, x) {
|
function cursorSet(y, x) {
|
||||||
// Hide and prevent from showing up during the move
|
// Hide and prevent from showing up during the move
|
||||||
cursor.suppress = true;
|
cursor.suppress = true;
|
||||||
@@ -936,6 +939,7 @@ $._loader = function(vis) {
|
|||||||
cursor.suppress = false;
|
cursor.suppress = false;
|
||||||
blit(cursorCell(), cursor.a);
|
blit(cursorCell(), cursor.a);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/** Update cell on display. inv = invert (for cursor) */
|
/** Update cell on display. inv = invert (for cursor) */
|
||||||
function blit(cell, inv) {
|
function blit(cell, inv) {
|
||||||
@@ -1081,7 +1085,10 @@ $._loader = function(vis) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onClose(evt) {
|
function onClose(evt) {
|
||||||
console.error("SOCKET CLOSED");
|
console.warn("SOCKET CLOSED, code "+evt.code+". Reconnecting...");
|
||||||
|
setTimeout(function() {
|
||||||
|
init();
|
||||||
|
}, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMessage(evt) {
|
function onMessage(evt) {
|
||||||
@@ -1094,10 +1101,6 @@ $._loader = function(vis) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onError(evt) {
|
|
||||||
console.error(evt.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
function doSend(message) {
|
function doSend(message) {
|
||||||
console.log("TX: ", message);
|
console.log("TX: ", message);
|
||||||
if (ws.readyState != 1) {
|
if (ws.readyState != 1) {
|
||||||
@@ -1115,7 +1118,6 @@ $._loader = function(vis) {
|
|||||||
ws.onopen = onOpen;
|
ws.onopen = onOpen;
|
||||||
ws.onclose = onClose;
|
ws.onclose = onClose;
|
||||||
ws.onmessage = onMessage;
|
ws.onmessage = onMessage;
|
||||||
ws.onerror = onError;
|
|
||||||
|
|
||||||
console.log("Opening socket.");
|
console.log("Opening socket.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,7 +197,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onClose(evt) {
|
function onClose(evt) {
|
||||||
console.error("SOCKET CLOSED");
|
console.warn("SOCKET CLOSED, code "+evt.code+". Reconnecting...");
|
||||||
|
setTimeout(function() {
|
||||||
|
init();
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMessage(evt) {
|
function onMessage(evt) {
|
||||||
@@ -210,10 +213,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onError(evt) {
|
|
||||||
console.error(evt.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
function doSend(message) {
|
function doSend(message) {
|
||||||
console.log("TX: ", message);
|
console.log("TX: ", message);
|
||||||
if (ws.readyState != 1) {
|
if (ws.readyState != 1) {
|
||||||
@@ -231,7 +230,6 @@
|
|||||||
ws.onopen = onOpen;
|
ws.onopen = onOpen;
|
||||||
ws.onclose = onClose;
|
ws.onclose = onClose;
|
||||||
ws.onmessage = onMessage;
|
ws.onmessage = onMessage;
|
||||||
ws.onerror = onError;
|
|
||||||
|
|
||||||
console.log("Opening socket.");
|
console.log("Opening socket.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Packing js..."
|
||||||
|
|
||||||
cat jssrc/chibi.js \
|
cat jssrc/chibi.js \
|
||||||
jssrc/utils.js \
|
jssrc/utils.js \
|
||||||
jssrc/modal.js \
|
jssrc/modal.js \
|
||||||
|
|||||||
+16
-2
@@ -5,6 +5,15 @@
|
|||||||
<title>ESP8266 Remote Terminal</title>
|
<title>ESP8266 Remote Terminal</title>
|
||||||
<meta name="viewport" content="width=device-width,shrink-to-fit=no,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
|
<meta name="viewport" content="width=device-width,shrink-to-fit=no,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Workaround for badly loaded page
|
||||||
|
setTimeout(function() {
|
||||||
|
if (typeof termInit == 'undefined' || typeof $ == 'undefined') {
|
||||||
|
location.reload(true);
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
</script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="/css/app.css">
|
<link rel="stylesheet" href="/css/app.css">
|
||||||
<script src="/js/app.js"></script>
|
<script src="/js/app.js"></script>
|
||||||
</head>
|
</head>
|
||||||
@@ -31,8 +40,13 @@
|
|||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
_root = window.location.host;
|
try {
|
||||||
termInit(%screenData%);
|
_root = window.location.host;
|
||||||
|
termInit(%screenData%);
|
||||||
|
} catch(e) {
|
||||||
|
console.error("Fail, reloading...");
|
||||||
|
location.reload(true);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#ifndef USER_MAIN_H_H
|
#ifndef USER_MAIN_H_H
|
||||||
#define USER_MAIN_H_H
|
#define USER_MAIN_H_H
|
||||||
|
|
||||||
#define FIRMWARE_VERSION "0.5.2"
|
#define FIRMWARE_VERSION "0.5.3"
|
||||||
#define TERMINAL_GITHUB_REPO "https://github.com/MightyPork/esp-vt100-firmware"
|
#define TERMINAL_GITHUB_REPO "https://github.com/MightyPork/esp-vt100-firmware"
|
||||||
|
|
||||||
#endif //USER_MAIN_H_H
|
#endif //USER_MAIN_H_H
|
||||||
|
|||||||
Reference in New Issue
Block a user