0.5.3 - added auto reconnect fn to javascript to fix broken page loads in some cases

pull/30/head 0.5.3
Ondřej Hruška 8 years ago
parent b074eb4f2c
commit 8eb01a725b
  1. 20
      html_orig/js/app.js
  2. 10
      html_orig/jssrc/term.js
  3. 2
      html_orig/packjs.sh
  4. 18
      html_orig/term.html
  5. 2
      user/user_main.h

@ -896,7 +896,8 @@ $._loader = function(vis) {
var screen = [];
var blinkIval;
/** Clear screen */
/*
/!** Clear screen *!/
function cls() {
screen.forEach(function(cell, i) {
cell.t = ' ';
@ -905,6 +906,7 @@ $._loader = function(vis) {
blit(cell);
});
}
*/
/** Set text and color at XY */
function cellAt(y, x) {
@ -916,14 +918,15 @@ $._loader = function(vis) {
return cellAt(cursor.y, cursor.x);
}
/** Enable or disable cursor visibility */
/*
/!** Enable or disable cursor visibility *!/
function cursorEnable(enable) {
cursor.hidden = !enable;
cursor.a &= enable;
blit(cursorCell(), cursor.a);
}
/** Safely move cursor */
/!** Safely move cursor *!/
function cursorSet(y, x) {
// Hide and prevent from showing up during the move
cursor.suppress = true;
@ -936,6 +939,7 @@ $._loader = function(vis) {
cursor.suppress = false;
blit(cursorCell(), cursor.a);
}
*/
/** Update cell on display. inv = invert (for cursor) */
function blit(cell, inv) {
@ -1081,7 +1085,10 @@ $._loader = function(vis) {
}
function onClose(evt) {
console.error("SOCKET CLOSED");
console.warn("SOCKET CLOSED, code "+evt.code+". Reconnecting...");
setTimeout(function() {
init();
}, 2000);
}
function onMessage(evt) {
@ -1094,10 +1101,6 @@ $._loader = function(vis) {
}
}
function onError(evt) {
console.error(evt.data);
}
function doSend(message) {
console.log("TX: ", message);
if (ws.readyState != 1) {
@ -1115,7 +1118,6 @@ $._loader = function(vis) {
ws.onopen = onOpen;
ws.onclose = onClose;
ws.onmessage = onMessage;
ws.onerror = onError;
console.log("Opening socket.");
}

@ -197,7 +197,10 @@
}
function onClose(evt) {
console.error("SOCKET CLOSED");
console.warn("SOCKET CLOSED, code "+evt.code+". Reconnecting...");
setTimeout(function() {
init();
}, 1000);
}
function onMessage(evt) {
@ -210,10 +213,6 @@
}
}
function onError(evt) {
console.error(evt.data);
}
function doSend(message) {
console.log("TX: ", message);
if (ws.readyState != 1) {
@ -231,7 +230,6 @@
ws.onopen = onOpen;
ws.onclose = onClose;
ws.onmessage = onMessage;
ws.onerror = onError;
console.log("Opening socket.");
}

@ -1,5 +1,7 @@
#!/bin/bash
echo "Packing js..."
cat jssrc/chibi.js \
jssrc/utils.js \
jssrc/modal.js \

@ -5,6 +5,15 @@
<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">
<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">
<script src="/js/app.js"></script>
</head>
@ -31,8 +40,13 @@
</nav>
<script>
_root = window.location.host;
termInit(%screenData%);
try {
_root = window.location.host;
termInit(%screenData%);
} catch(e) {
console.error("Fail, reloading...");
location.reload(true);
}
</script>
</body>

@ -1,7 +1,7 @@
#ifndef 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"
#endif //USER_MAIN_H_H

Loading…
Cancel
Save