Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8028f14387 | ||
|
|
daba5340f7 | ||
|
|
a82e14961c | ||
|
|
6c9ae7e126 | ||
|
|
a3c84f9a8f | ||
|
|
7aa3cd7f75 | ||
|
|
58ed6098c4 | ||
|
|
16a36a3d26 | ||
|
|
9d1cefeaab | ||
|
|
357600de8f |
+2
-1
@@ -141,7 +141,7 @@ set(SOURCE_FILES
|
|||||||
user/apars_osc.c
|
user/apars_osc.c
|
||||||
user/apars_osc.h
|
user/apars_osc.h
|
||||||
user/apars_dcs.c
|
user/apars_dcs.c
|
||||||
user/apars_dcs.h user/uart_buffer.c user/uart_buffer.h)
|
user/apars_dcs.h user/uart_buffer.c user/uart_buffer.h user/jstring.c user/jstring.h)
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
include_directories(user)
|
include_directories(user)
|
||||||
@@ -163,6 +163,7 @@ add_definitions(
|
|||||||
-DADMIN_PASSWORD="asdf"
|
-DADMIN_PASSWORD="asdf"
|
||||||
-DGIT_HASH="blabla"
|
-DGIT_HASH="blabla"
|
||||||
-DDEBUG_HEAP=1
|
-DDEBUG_HEAP=1
|
||||||
|
-DDEBUG_MALLOC=1
|
||||||
-DESPFS_HEATSHRINK)
|
-DESPFS_HEATSHRINK)
|
||||||
|
|
||||||
add_executable(ESPTerm ${SOURCE_FILES})
|
add_executable(ESPTerm ${SOURCE_FILES})
|
||||||
|
|||||||
+4
-1
@@ -50,5 +50,8 @@ GLOBAL_CFLAGS = \
|
|||||||
-DDEBUG_ANSI=1 \
|
-DDEBUG_ANSI=1 \
|
||||||
-DDEBUG_ANSI_NOIMPL=1 \
|
-DDEBUG_ANSI_NOIMPL=1 \
|
||||||
-DHTTPD_MAX_BACKLOG_SIZE=8192 \
|
-DHTTPD_MAX_BACKLOG_SIZE=8192 \
|
||||||
|
-DHTTPD_MAX_HEAD_LEN=1024 \
|
||||||
|
-DHTTPD_MAX_POST_LEN=512 \
|
||||||
-DDEBUG_INPUT=0 \
|
-DDEBUG_INPUT=0 \
|
||||||
-DDEBUG_HEAP=1
|
-DDEBUG_HEAP=1 \
|
||||||
|
-DDEBUG_MALLOC=0
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ function process_html($s) {
|
|||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$no_tpl_files = ['help', 'cfg_wifi_conn'];
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
foreach($_pages as $_k => $p) {
|
foreach($_pages as $_k => $p) {
|
||||||
if ($p->bodyclass == 'api') continue;
|
if ($p->bodyclass == 'api') continue;
|
||||||
@@ -30,7 +32,7 @@ foreach($_pages as $_k => $p) {
|
|||||||
// $s = process_html($s);
|
// $s = process_html($s);
|
||||||
|
|
||||||
ob_clean(); // clean up
|
ob_clean(); // clean up
|
||||||
$of = __DIR__ . '/../html/' . $_k . '.tpl';
|
$of = __DIR__ . '/../html/' . $_k . (in_array($_k, $no_tpl_files) ? '.html' : '.tpl');
|
||||||
file_put_contents($of, $s); // write to a file
|
file_put_contents($of, $s); // write to a file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+141
-23
@@ -770,6 +770,14 @@
|
|||||||
for(k in _mods) _mods[k] = event[modifierMap[k]];
|
for(k in _mods) _mods[k] = event[modifierMap[k]];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function isModifierPressed(mod) {
|
||||||
|
if (mod=='control'||mod=='ctrl') return _mods[17];
|
||||||
|
if (mod=='shift') return _mods[16];
|
||||||
|
if (mod=='meta') return _mods[91];
|
||||||
|
if (mod=='alt') return _mods[18];
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// handle keydown event
|
// handle keydown event
|
||||||
function dispatch(event) {
|
function dispatch(event) {
|
||||||
var key, handler, k, i, modifiersMatch, scope;
|
var key, handler, k, i, modifiersMatch, scope;
|
||||||
@@ -995,6 +1003,7 @@
|
|||||||
global.key.deleteScope = deleteScope;
|
global.key.deleteScope = deleteScope;
|
||||||
global.key.filter = filter;
|
global.key.filter = filter;
|
||||||
global.key.isPressed = isPressed;
|
global.key.isPressed = isPressed;
|
||||||
|
global.key.isModifier = isModifierPressed;
|
||||||
global.key.getPressedKeyCodes = getPressedKeyCodes;
|
global.key.getPressedKeyCodes = getPressedKeyCodes;
|
||||||
global.key.noConflict = noConflict;
|
global.key.noConflict = noConflict;
|
||||||
global.key.unbind = unbindKey;
|
global.key.unbind = unbindKey;
|
||||||
@@ -1555,6 +1564,41 @@ function tr(key) { return _tr[key] || '?'+key+'?'; }
|
|||||||
w.init = wifiInit;
|
w.init = wifiInit;
|
||||||
w.startScanning = startScanning;
|
w.startScanning = startScanning;
|
||||||
})(window.WiFi = {});
|
})(window.WiFi = {});
|
||||||
|
/** Decode two-byte number */
|
||||||
|
function parse2B(s, i) {
|
||||||
|
return (s.charCodeAt(i++) - 1) + (s.charCodeAt(i) - 1) * 127;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Decode three-byte number */
|
||||||
|
function parse3B(s, i) {
|
||||||
|
return (s.charCodeAt(i) - 1) + (s.charCodeAt(i+1) - 1) * 127 + (s.charCodeAt(i+2) - 1) * 127 * 127;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Chr(n) {
|
||||||
|
return String.fromCharCode(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
function encode2B(n) {
|
||||||
|
var lsb, msb;
|
||||||
|
lsb = (n % 127);
|
||||||
|
n = ((n - lsb) / 127);
|
||||||
|
lsb += 1;
|
||||||
|
msb = (n + 1);
|
||||||
|
return Chr(lsb) + Chr(msb);
|
||||||
|
}
|
||||||
|
|
||||||
|
function encode3B(n) {
|
||||||
|
var lsb, msb, xsb;
|
||||||
|
lsb = (n % 127);
|
||||||
|
n = (n - lsb) / 127;
|
||||||
|
lsb += 1;
|
||||||
|
msb = (n % 127);
|
||||||
|
n = (n - msb) / 127;
|
||||||
|
msb += 1;
|
||||||
|
xsb = (n + 1);
|
||||||
|
return Chr(lsb) + Chr(msb) + Chr(xsb);
|
||||||
|
}
|
||||||
|
|
||||||
var Screen = (function () {
|
var Screen = (function () {
|
||||||
var W = 0, H = 0; // dimensions
|
var W = 0, H = 0; // dimensions
|
||||||
var inited = false;
|
var inited = false;
|
||||||
@@ -1681,8 +1725,21 @@ var Screen = (function () {
|
|||||||
(function() {
|
(function() {
|
||||||
var x = i % W;
|
var x = i % W;
|
||||||
var y = Math.floor(i / W);
|
var y = Math.floor(i / W);
|
||||||
e.addEventListener('click', function () {
|
e.addEventListener('mouseenter', function (evt) {
|
||||||
Input.onTap(y, x);
|
Input.onMouseMove(x, y);
|
||||||
|
});
|
||||||
|
e.addEventListener('mousedown', function (evt) {
|
||||||
|
Input.onMouseDown(x, y, evt.button+1);
|
||||||
|
});
|
||||||
|
e.addEventListener('mouseup', function (evt) {
|
||||||
|
Input.onMouseUp(x, y, evt.button+1);
|
||||||
|
});
|
||||||
|
e.addEventListener('contextmenu', function (evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
});
|
||||||
|
e.addEventListener('mousewheel', function (evt) {
|
||||||
|
Input.onMouseWheel(x, y, evt.deltaY>0?1:-1);
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@@ -1734,16 +1791,6 @@ var Screen = (function () {
|
|||||||
inited = true;
|
inited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Decode two-byte number */
|
|
||||||
function parse2B(s, i) {
|
|
||||||
return (s.charCodeAt(i++) - 1) + (s.charCodeAt(i) - 1) * 127;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Decode three-byte number */
|
|
||||||
function parse3B(s, i) {
|
|
||||||
return (s.charCodeAt(i) - 1) + (s.charCodeAt(i+1) - 1) * 127 + (s.charCodeAt(i+2) - 1) * 127 * 127;
|
|
||||||
}
|
|
||||||
|
|
||||||
var SEQ_SET_COLOR_ATTR = 1;
|
var SEQ_SET_COLOR_ATTR = 1;
|
||||||
var SEQ_REPEAT = 2;
|
var SEQ_REPEAT = 2;
|
||||||
var SEQ_SET_COLOR = 3;
|
var SEQ_SET_COLOR = 3;
|
||||||
@@ -1911,6 +1958,7 @@ var Screen = (function () {
|
|||||||
var Conn = (function() {
|
var Conn = (function() {
|
||||||
var ws;
|
var ws;
|
||||||
var heartbeatTout;
|
var heartbeatTout;
|
||||||
|
var pingIv;
|
||||||
|
|
||||||
function onOpen(evt) {
|
function onOpen(evt) {
|
||||||
console.log("CONNECTED");
|
console.log("CONNECTED");
|
||||||
@@ -1976,12 +2024,23 @@ var Conn = (function() {
|
|||||||
|
|
||||||
function heartbeat() {
|
function heartbeat() {
|
||||||
clearTimeout(heartbeatTout);
|
clearTimeout(heartbeatTout);
|
||||||
heartbeatTout = setTimeout(heartbeatFail, 3000);
|
heartbeatTout = setTimeout(heartbeatFail, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function heartbeatFail() {
|
function heartbeatFail() {
|
||||||
console.error("Heartbeat lost, reloading...");
|
console.error("Heartbeat lost, probing server...");
|
||||||
location.reload();
|
pingIv = setInterval(function() {
|
||||||
|
console.log("> ping");
|
||||||
|
$.get('http://'+_root+'/system/ping', function(resp, status) {
|
||||||
|
if (status == 200) {
|
||||||
|
clearInterval(pingIv);
|
||||||
|
console.info("Server ready, reloading page...");
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
timeout: 100,
|
||||||
|
});
|
||||||
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -1991,7 +2050,22 @@ var Conn = (function() {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/** User input */
|
/**
|
||||||
|
* User input
|
||||||
|
*
|
||||||
|
* --- Rx messages: ---
|
||||||
|
* S - screen content (binary encoding of the entire screen with simple compression)
|
||||||
|
* T - text labels - Title and buttons, \0x01-separated
|
||||||
|
* B - beep
|
||||||
|
* . - heartbeat
|
||||||
|
*
|
||||||
|
* --- Tx messages ---
|
||||||
|
* s - string
|
||||||
|
* b - action button
|
||||||
|
* p - mb press
|
||||||
|
* r - mb release
|
||||||
|
* m - mouse move
|
||||||
|
*/
|
||||||
var Input = (function() {
|
var Input = (function() {
|
||||||
var opts = {
|
var opts = {
|
||||||
np_alt: false,
|
np_alt: false,
|
||||||
@@ -2000,15 +2074,11 @@ var Input = (function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function sendStrMsg(str) {
|
function sendStrMsg(str) {
|
||||||
Conn.send("STR:"+str);
|
Conn.send("s"+str);
|
||||||
}
|
|
||||||
|
|
||||||
function sendPosMsg(y, x) {
|
|
||||||
Conn.send("TAP:"+y+','+x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendBtnMsg(n) {
|
function sendBtnMsg(n) {
|
||||||
Conn.send("BTN:"+n);
|
Conn.send("b"+Chr(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
function fa(alt, normal) {
|
function fa(alt, normal) {
|
||||||
@@ -2129,6 +2199,10 @@ var Input = (function() {
|
|||||||
_bindFnKeys();
|
_bindFnKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var mb1 = 0;
|
||||||
|
var mb2 = 0;
|
||||||
|
var mb3 = 0;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
_initKeys();
|
_initKeys();
|
||||||
|
|
||||||
@@ -2138,11 +2212,30 @@ var Input = (function() {
|
|||||||
sendBtnMsg(+this.dataset['n']);
|
sendBtnMsg(+this.dataset['n']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.addEventListener('mousedown', function(evt) {
|
||||||
|
if (evt.button == 0) mb1 = 1;
|
||||||
|
if (evt.button == 1) mb2 = 1;
|
||||||
|
if (evt.button == 2) mb3 = 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('mouseup', function(evt) {
|
||||||
|
if (evt.button == 0) mb1 = 0;
|
||||||
|
if (evt.button == 1) mb2 = 0;
|
||||||
|
if (evt.button == 2) mb3 = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function packModifiersForMouse() {
|
||||||
|
return (key.isModifier('ctrl')?1:0) |
|
||||||
|
(key.isModifier('shift')?2:0) |
|
||||||
|
(key.isModifier('alt')?4:0) |
|
||||||
|
(key.isModifier('meta')?8:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
init: init,
|
init: init,
|
||||||
onTap: sendPosMsg,
|
// onTap: sendPosMsg,
|
||||||
sendString: sendStrMsg,
|
sendString: sendStrMsg,
|
||||||
setAlts: function(cu, np, fn) {
|
setAlts: function(cu, np, fn) {
|
||||||
if (opts.cu_alt != cu || opts.np_alt != np || opts.fn_alt != fn) {
|
if (opts.cu_alt != cu || opts.np_alt != np || opts.fn_alt != fn) {
|
||||||
@@ -2154,6 +2247,31 @@ var Input = (function() {
|
|||||||
_bindFnKeys();
|
_bindFnKeys();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onMouseMove: function (x, y) {
|
||||||
|
var b = mb1 ? 1 : mb2 ? 2 : mb3 ? 3 : 0;
|
||||||
|
var m = packModifiersForMouse();
|
||||||
|
Conn.send("m" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
||||||
|
},
|
||||||
|
onMouseDown: function (x, y, b) {
|
||||||
|
if (b > 3 || b < 1) return;
|
||||||
|
var m = packModifiersForMouse();
|
||||||
|
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
||||||
|
console.log("B ",b," M ",m);
|
||||||
|
},
|
||||||
|
onMouseUp: function (x, y, b) {
|
||||||
|
if (b > 3 || b < 1) return;
|
||||||
|
var m = packModifiersForMouse();
|
||||||
|
Conn.send("r" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
||||||
|
console.log("B ",b," M ",m);
|
||||||
|
},
|
||||||
|
onMouseWheel: function (x, y, dir) {
|
||||||
|
// -1 ... btn 4 (away from user)
|
||||||
|
// +1 ... btn 5 (towards user)
|
||||||
|
var m = packModifiersForMouse();
|
||||||
|
var b = (dir < 0 ? 4 : 5);
|
||||||
|
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
||||||
|
console.log("B ",b," M ",m);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,14 @@
|
|||||||
for(k in _mods) _mods[k] = event[modifierMap[k]];
|
for(k in _mods) _mods[k] = event[modifierMap[k]];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function isModifierPressed(mod) {
|
||||||
|
if (mod=='control'||mod=='ctrl') return _mods[17];
|
||||||
|
if (mod=='shift') return _mods[16];
|
||||||
|
if (mod=='meta') return _mods[91];
|
||||||
|
if (mod=='alt') return _mods[18];
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// handle keydown event
|
// handle keydown event
|
||||||
function dispatch(event) {
|
function dispatch(event) {
|
||||||
var key, handler, k, i, modifiersMatch, scope;
|
var key, handler, k, i, modifiersMatch, scope;
|
||||||
@@ -292,6 +300,7 @@
|
|||||||
global.key.deleteScope = deleteScope;
|
global.key.deleteScope = deleteScope;
|
||||||
global.key.filter = filter;
|
global.key.filter = filter;
|
||||||
global.key.isPressed = isPressed;
|
global.key.isPressed = isPressed;
|
||||||
|
global.key.isModifier = isModifierPressed;
|
||||||
global.key.getPressedKeyCodes = getPressedKeyCodes;
|
global.key.getPressedKeyCodes = getPressedKeyCodes;
|
||||||
global.key.noConflict = noConflict;
|
global.key.noConflict = noConflict;
|
||||||
global.key.unbind = unbindKey;
|
global.key.unbind = unbindKey;
|
||||||
|
|||||||
+132
-23
@@ -1,3 +1,38 @@
|
|||||||
|
/** Decode two-byte number */
|
||||||
|
function parse2B(s, i) {
|
||||||
|
return (s.charCodeAt(i++) - 1) + (s.charCodeAt(i) - 1) * 127;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Decode three-byte number */
|
||||||
|
function parse3B(s, i) {
|
||||||
|
return (s.charCodeAt(i) - 1) + (s.charCodeAt(i+1) - 1) * 127 + (s.charCodeAt(i+2) - 1) * 127 * 127;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Chr(n) {
|
||||||
|
return String.fromCharCode(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
function encode2B(n) {
|
||||||
|
var lsb, msb;
|
||||||
|
lsb = (n % 127);
|
||||||
|
n = ((n - lsb) / 127);
|
||||||
|
lsb += 1;
|
||||||
|
msb = (n + 1);
|
||||||
|
return Chr(lsb) + Chr(msb);
|
||||||
|
}
|
||||||
|
|
||||||
|
function encode3B(n) {
|
||||||
|
var lsb, msb, xsb;
|
||||||
|
lsb = (n % 127);
|
||||||
|
n = (n - lsb) / 127;
|
||||||
|
lsb += 1;
|
||||||
|
msb = (n % 127);
|
||||||
|
n = (n - msb) / 127;
|
||||||
|
msb += 1;
|
||||||
|
xsb = (n + 1);
|
||||||
|
return Chr(lsb) + Chr(msb) + Chr(xsb);
|
||||||
|
}
|
||||||
|
|
||||||
var Screen = (function () {
|
var Screen = (function () {
|
||||||
var W = 0, H = 0; // dimensions
|
var W = 0, H = 0; // dimensions
|
||||||
var inited = false;
|
var inited = false;
|
||||||
@@ -124,8 +159,21 @@ var Screen = (function () {
|
|||||||
(function() {
|
(function() {
|
||||||
var x = i % W;
|
var x = i % W;
|
||||||
var y = Math.floor(i / W);
|
var y = Math.floor(i / W);
|
||||||
e.addEventListener('click', function () {
|
e.addEventListener('mouseenter', function (evt) {
|
||||||
Input.onTap(y, x);
|
Input.onMouseMove(x, y);
|
||||||
|
});
|
||||||
|
e.addEventListener('mousedown', function (evt) {
|
||||||
|
Input.onMouseDown(x, y, evt.button+1);
|
||||||
|
});
|
||||||
|
e.addEventListener('mouseup', function (evt) {
|
||||||
|
Input.onMouseUp(x, y, evt.button+1);
|
||||||
|
});
|
||||||
|
e.addEventListener('contextmenu', function (evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
});
|
||||||
|
e.addEventListener('mousewheel', function (evt) {
|
||||||
|
Input.onMouseWheel(x, y, evt.deltaY>0?1:-1);
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@@ -177,16 +225,6 @@ var Screen = (function () {
|
|||||||
inited = true;
|
inited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Decode two-byte number */
|
|
||||||
function parse2B(s, i) {
|
|
||||||
return (s.charCodeAt(i++) - 1) + (s.charCodeAt(i) - 1) * 127;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Decode three-byte number */
|
|
||||||
function parse3B(s, i) {
|
|
||||||
return (s.charCodeAt(i) - 1) + (s.charCodeAt(i+1) - 1) * 127 + (s.charCodeAt(i+2) - 1) * 127 * 127;
|
|
||||||
}
|
|
||||||
|
|
||||||
var SEQ_SET_COLOR_ATTR = 1;
|
var SEQ_SET_COLOR_ATTR = 1;
|
||||||
var SEQ_REPEAT = 2;
|
var SEQ_REPEAT = 2;
|
||||||
var SEQ_SET_COLOR = 3;
|
var SEQ_SET_COLOR = 3;
|
||||||
@@ -354,6 +392,7 @@ var Screen = (function () {
|
|||||||
var Conn = (function() {
|
var Conn = (function() {
|
||||||
var ws;
|
var ws;
|
||||||
var heartbeatTout;
|
var heartbeatTout;
|
||||||
|
var pingIv;
|
||||||
|
|
||||||
function onOpen(evt) {
|
function onOpen(evt) {
|
||||||
console.log("CONNECTED");
|
console.log("CONNECTED");
|
||||||
@@ -419,12 +458,23 @@ var Conn = (function() {
|
|||||||
|
|
||||||
function heartbeat() {
|
function heartbeat() {
|
||||||
clearTimeout(heartbeatTout);
|
clearTimeout(heartbeatTout);
|
||||||
heartbeatTout = setTimeout(heartbeatFail, 3000);
|
heartbeatTout = setTimeout(heartbeatFail, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function heartbeatFail() {
|
function heartbeatFail() {
|
||||||
console.error("Heartbeat lost, reloading...");
|
console.error("Heartbeat lost, probing server...");
|
||||||
location.reload();
|
pingIv = setInterval(function() {
|
||||||
|
console.log("> ping");
|
||||||
|
$.get('http://'+_root+'/system/ping', function(resp, status) {
|
||||||
|
if (status == 200) {
|
||||||
|
clearInterval(pingIv);
|
||||||
|
console.info("Server ready, reloading page...");
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
timeout: 100,
|
||||||
|
});
|
||||||
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -434,7 +484,22 @@ var Conn = (function() {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/** User input */
|
/**
|
||||||
|
* User input
|
||||||
|
*
|
||||||
|
* --- Rx messages: ---
|
||||||
|
* S - screen content (binary encoding of the entire screen with simple compression)
|
||||||
|
* T - text labels - Title and buttons, \0x01-separated
|
||||||
|
* B - beep
|
||||||
|
* . - heartbeat
|
||||||
|
*
|
||||||
|
* --- Tx messages ---
|
||||||
|
* s - string
|
||||||
|
* b - action button
|
||||||
|
* p - mb press
|
||||||
|
* r - mb release
|
||||||
|
* m - mouse move
|
||||||
|
*/
|
||||||
var Input = (function() {
|
var Input = (function() {
|
||||||
var opts = {
|
var opts = {
|
||||||
np_alt: false,
|
np_alt: false,
|
||||||
@@ -443,15 +508,11 @@ var Input = (function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function sendStrMsg(str) {
|
function sendStrMsg(str) {
|
||||||
Conn.send("STR:"+str);
|
Conn.send("s"+str);
|
||||||
}
|
|
||||||
|
|
||||||
function sendPosMsg(y, x) {
|
|
||||||
Conn.send("TAP:"+y+','+x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendBtnMsg(n) {
|
function sendBtnMsg(n) {
|
||||||
Conn.send("BTN:"+n);
|
Conn.send("b"+Chr(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
function fa(alt, normal) {
|
function fa(alt, normal) {
|
||||||
@@ -572,6 +633,10 @@ var Input = (function() {
|
|||||||
_bindFnKeys();
|
_bindFnKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var mb1 = 0;
|
||||||
|
var mb2 = 0;
|
||||||
|
var mb3 = 0;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
_initKeys();
|
_initKeys();
|
||||||
|
|
||||||
@@ -581,11 +646,30 @@ var Input = (function() {
|
|||||||
sendBtnMsg(+this.dataset['n']);
|
sendBtnMsg(+this.dataset['n']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.addEventListener('mousedown', function(evt) {
|
||||||
|
if (evt.button == 0) mb1 = 1;
|
||||||
|
if (evt.button == 1) mb2 = 1;
|
||||||
|
if (evt.button == 2) mb3 = 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('mouseup', function(evt) {
|
||||||
|
if (evt.button == 0) mb1 = 0;
|
||||||
|
if (evt.button == 1) mb2 = 0;
|
||||||
|
if (evt.button == 2) mb3 = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function packModifiersForMouse() {
|
||||||
|
return (key.isModifier('ctrl')?1:0) |
|
||||||
|
(key.isModifier('shift')?2:0) |
|
||||||
|
(key.isModifier('alt')?4:0) |
|
||||||
|
(key.isModifier('meta')?8:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
init: init,
|
init: init,
|
||||||
onTap: sendPosMsg,
|
// onTap: sendPosMsg,
|
||||||
sendString: sendStrMsg,
|
sendString: sendStrMsg,
|
||||||
setAlts: function(cu, np, fn) {
|
setAlts: function(cu, np, fn) {
|
||||||
if (opts.cu_alt != cu || opts.np_alt != np || opts.fn_alt != fn) {
|
if (opts.cu_alt != cu || opts.np_alt != np || opts.fn_alt != fn) {
|
||||||
@@ -597,6 +681,31 @@ var Input = (function() {
|
|||||||
_bindFnKeys();
|
_bindFnKeys();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onMouseMove: function (x, y) {
|
||||||
|
var b = mb1 ? 1 : mb2 ? 2 : mb3 ? 3 : 0;
|
||||||
|
var m = packModifiersForMouse();
|
||||||
|
Conn.send("m" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
||||||
|
},
|
||||||
|
onMouseDown: function (x, y, b) {
|
||||||
|
if (b > 3 || b < 1) return;
|
||||||
|
var m = packModifiersForMouse();
|
||||||
|
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
||||||
|
console.log("B ",b," M ",m);
|
||||||
|
},
|
||||||
|
onMouseUp: function (x, y, b) {
|
||||||
|
if (b > 3 || b < 1) return;
|
||||||
|
var m = packModifiersForMouse();
|
||||||
|
Conn.send("r" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
||||||
|
console.log("B ",b," M ",m);
|
||||||
|
},
|
||||||
|
onMouseWheel: function (x, y, dir) {
|
||||||
|
// -1 ... btn 4 (away from user)
|
||||||
|
// +1 ... btn 5 (towards user)
|
||||||
|
var m = packModifiersForMouse();
|
||||||
|
var b = (dir < 0 ? 4 : 5);
|
||||||
|
Conn.send("p" + encode2B(y) + encode2B(x) + encode2B(b) + encode2B(m));
|
||||||
|
console.log("B ",b," M ",m);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
+31
-29
@@ -176,7 +176,17 @@
|
|||||||
<p>
|
<p>
|
||||||
The user can input text using their keyboard, or on Android, using the on-screen keyboard which is open using
|
The user can input text using their keyboard, or on Android, using the on-screen keyboard which is open using
|
||||||
a button beneath the screen. Supported are all printable characters, as well as many control keys, such as arrows, Ctrl+letters
|
a button beneath the screen. Supported are all printable characters, as well as many control keys, such as arrows, Ctrl+letters
|
||||||
and function keys. Sequences sent by function keys are based on VT102 and xterm. Here are some examples:
|
and function keys. Sequences sent by function keys are based on VT102 and xterm.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The codes sent by Home, End, F1-F4 and cursor keys are affected by various keyboard modes (Application Cursor Keys,
|
||||||
|
Application Numpad Mode, SS3 Fn Keys Mode).
|
||||||
|
Some can be set in the <a href="<?= url('cfg_term') ?>">Terminal Settings</a>, others via commands.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Here are some examples of control key codes:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
@@ -532,7 +542,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="Box fold">
|
<div class="Box fold">
|
||||||
<h2>Title and Button Labels</h2>
|
<h2>System Commands</h2>
|
||||||
|
|
||||||
<div class="Row v">
|
<div class="Row v">
|
||||||
<p>
|
<p>
|
||||||
@@ -541,33 +551,6 @@
|
|||||||
Those changes are not retained after restart.
|
Those changes are not retained after restart.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<table class="ansiref w100">
|
|
||||||
<thead><tr><th>Code</th><th>Meaning</th></tr></thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>\e]0;<i>title</i>\a</td>
|
|
||||||
<td>Set screen title (this is a standard OSC command)</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
\e]<i>81</i>;<i>btn1</i>\a<br>
|
|
||||||
\e]<i>82</i>;<i>btn2</i>\a<br>
|
|
||||||
\e]<i>83</i>;<i>btn3</i>\a<br>
|
|
||||||
\e]<i>84</i>;<i>btn4</i>\a<br>
|
|
||||||
\e]<i>85</i>;<i>btn5</i>\a<br>
|
|
||||||
</td>
|
|
||||||
<td>Set button 1-5 label - eg. <code>\e]81;Yes\a</code>
|
|
||||||
sets the first button text to "Yes".</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="Box fold">
|
|
||||||
<h2>System Commands</h2>
|
|
||||||
|
|
||||||
<div class="Row v">
|
|
||||||
<table class="ansiref w100">
|
<table class="ansiref w100">
|
||||||
<thead><tr><th>Code</th><th>Meaning</th></tr></thead>
|
<thead><tr><th>Code</th><th>Meaning</th></tr></thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -592,6 +575,25 @@
|
|||||||
spontaneous restarts which require a full screen repaint.
|
spontaneous restarts which require a full screen repaint.
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>\e]0;<i>title</i>\a</td>
|
||||||
|
<td>Set screen title (this is a standard OSC command)</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
\e]<i>81</i>;<i>btn1</i>\a<br>
|
||||||
|
\e]<i>82</i>;<i>btn2</i>\a<br>
|
||||||
|
\e]<i>83</i>;<i>btn3</i>\a<br>
|
||||||
|
\e]<i>84</i>;<i>btn4</i>\a<br>
|
||||||
|
\e]<i>85</i>;<i>btn5</i>\a<br>
|
||||||
|
</td>
|
||||||
|
<td>Set button 1-5 label - eg. <code>\e]81;Yes\a</code>
|
||||||
|
sets the first button text to "Yes".</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>\e[8;<i>r</i>;<i>c</i>t</td>
|
||||||
|
<td>Set screen size (this is a command borrowed from xterm)</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+1
-1
Submodule libesphttpd updated: 566e95af0c...13fa224963
+14
-6
@@ -451,16 +451,24 @@ static void ICACHE_FLASH_ATTR do_csi_privattr(CSI_Data *opts)
|
|||||||
// - discard repeated keypress events between keydown and keyup.
|
// - discard repeated keypress events between keydown and keyup.
|
||||||
ansi_noimpl("Auto-repeat toggle");
|
ansi_noimpl("Auto-repeat toggle");
|
||||||
}
|
}
|
||||||
else if (n == 9 || (n >= 1000 && n <= 1006)) {
|
else if (n == 9 || (n >= 1000 && n <= 1006) || n == 1015) {
|
||||||
// TODO mouse
|
// 9 - X10 tracking
|
||||||
// 1000 - C11 mouse - Send Mouse X & Y on button press and release.
|
// 1000 - X11 mouse - Send Mouse X & Y on button press and release.
|
||||||
// 1001 - Hilite mouse tracking
|
// 1001 - Hilite mouse tracking - not impl
|
||||||
// 1002 - Cell Motion Mouse Tracking
|
// 1002 - Cell Motion Mouse Tracking
|
||||||
// 1003 - All Motion Mouse Tracking
|
// 1003 - All Motion Mouse Tracking
|
||||||
// 1004 - Send FocusIn/FocusOut events
|
// 1004 - Send FocusIn/FocusOut events
|
||||||
// 1005 - Enable UTF-8 Mouse Mode
|
// 1005 - Enable UTF-8 Mouse Mode - we implement this as an alias to X10 mode
|
||||||
// 1006 - SGR mouse mode
|
// 1006 - SGR mouse mode
|
||||||
ansi_noimpl("Mouse tracking");
|
|
||||||
|
if (n == 9) mouse_tracking.mode = yn ? MTM_X10 : MTM_NONE;
|
||||||
|
else if (n == 1000) mouse_tracking.mode = yn ? MTM_NORMAL : MTM_NONE;
|
||||||
|
else if (n == 1002) mouse_tracking.mode = yn ? MTM_BUTTON_MOTION : MTM_NONE;
|
||||||
|
else if (n == 1003) mouse_tracking.mode = yn ? MTM_ANY_MOTION : MTM_NONE;
|
||||||
|
else if (n == 1004) mouse_tracking.focus_tracking = yn;
|
||||||
|
else if (n == 1005) mouse_tracking.encoding = yn ? MTE_UTF8 : MTE_SIMPLE;
|
||||||
|
else if (n == 1006) mouse_tracking.encoding = yn ? MTE_SGR : MTE_SIMPLE;
|
||||||
|
else if (n == 1015) mouse_tracking.encoding = yn ? MTE_URXVT : MTE_SIMPLE;
|
||||||
}
|
}
|
||||||
else if (n == 12) {
|
else if (n == 12) {
|
||||||
// TODO Cursor blink on/off
|
// TODO Cursor blink on/off
|
||||||
|
|||||||
+1
-13
@@ -15,18 +15,6 @@
|
|||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "ansi_parser.h"
|
#include "ansi_parser.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function to set terminal button label
|
|
||||||
* @param num - button number 1-5
|
|
||||||
* @param str - button text
|
|
||||||
*/
|
|
||||||
static void ICACHE_FLASH_ATTR
|
|
||||||
set_button_text(int num, const char *str)
|
|
||||||
{
|
|
||||||
strncpy(termconf_scratch.btn[num-1], str, TERM_BTN_LEN);
|
|
||||||
screen_notifyChange(CHANGE_LABELS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to parse incoming OSC (Operating System Control)
|
* Helper function to parse incoming OSC (Operating System Control)
|
||||||
* @param buffer - the OSC body (after OSC and before ST)
|
* @param buffer - the OSC body (after OSC and before ST)
|
||||||
@@ -52,7 +40,7 @@ apars_handle_osc(const char *buffer)
|
|||||||
screen_set_title(buffer);
|
screen_set_title(buffer);
|
||||||
}
|
}
|
||||||
else if (n >= 81 && n <= 85) { // numbers chosen to not collide with any xterm supported codes
|
else if (n >= 81 && n <= 85) { // numbers chosen to not collide with any xterm supported codes
|
||||||
set_button_text(n - 80, buffer);
|
screen_set_button_text(n - 80, buffer);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ansi_noimpl("OSC %d ; %s ST", n, buffer);
|
ansi_noimpl("OSC %d ; %s ST", n, buffer);
|
||||||
|
|||||||
+106
-48
@@ -7,11 +7,13 @@
|
|||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "uart_buffer.h"
|
#include "uart_buffer.h"
|
||||||
#include "ansi_parser.h"
|
#include "ansi_parser.h"
|
||||||
|
#include "jstring.h"
|
||||||
|
|
||||||
#define LOOPBACK 0
|
#define LOOPBACK 0
|
||||||
|
|
||||||
#define SOCK_BUF_LEN 1024
|
#define HB_TIME 1000
|
||||||
static char sock_buff[SOCK_BUF_LEN];
|
|
||||||
|
#define SOCK_BUF_LEN 2000
|
||||||
|
|
||||||
volatile bool notify_available = true;
|
volatile bool notify_available = true;
|
||||||
volatile bool notify_cooldown = false;
|
volatile bool notify_cooldown = false;
|
||||||
@@ -40,6 +42,8 @@ notifyContentTimCb(void *arg)
|
|||||||
{
|
{
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
int max_bl, total_bl;
|
int max_bl, total_bl;
|
||||||
|
char sock_buff[SOCK_BUF_LEN];
|
||||||
|
|
||||||
cgiWebsockMeasureBacklog(URL_WS_UPDATE, &max_bl, &total_bl);
|
cgiWebsockMeasureBacklog(URL_WS_UPDATE, &max_bl, &total_bl);
|
||||||
|
|
||||||
if (!notify_available || notify_cooldown || (max_bl > 2048)) { // do not send if we have anything significant backlogged
|
if (!notify_available || notify_cooldown || (max_bl > 2048)) { // do not send if we have anything significant backlogged
|
||||||
@@ -70,6 +74,8 @@ notifyContentTimCb(void *arg)
|
|||||||
static void ICACHE_FLASH_ATTR
|
static void ICACHE_FLASH_ATTR
|
||||||
notifyLabelsTimCb(void *arg)
|
notifyLabelsTimCb(void *arg)
|
||||||
{
|
{
|
||||||
|
char sock_buff[SOCK_BUF_LEN];
|
||||||
|
|
||||||
if (!notify_available || notify_cooldown) {
|
if (!notify_available || notify_cooldown) {
|
||||||
// postpone a little
|
// postpone a little
|
||||||
TIMER_START(¬ifyLabelsTim, notifyLabelsTimCb, 1, 0);
|
TIMER_START(¬ifyLabelsTim, notifyLabelsTimCb, 1, 0);
|
||||||
@@ -118,75 +124,127 @@ void ICACHE_FLASH_ATTR screen_notifyChange(ScreenNotifyChangeTopic topic)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ICACHE_FLASH_ATTR sendMouseAction(char evt, int y, int x, int button, u8 mods)
|
||||||
|
{
|
||||||
|
// one-based
|
||||||
|
x++;
|
||||||
|
y++;
|
||||||
|
|
||||||
|
bool ctrl = (mods & 1) > 0;
|
||||||
|
bool shift = (mods & 2) > 0;
|
||||||
|
bool alt = (mods & 4) > 0;
|
||||||
|
bool meta = (mods & 8) > 0;
|
||||||
|
enum MTM mtm = mouse_tracking.mode;
|
||||||
|
enum MTE mte = mouse_tracking.encoding;
|
||||||
|
|
||||||
|
// No message on release in X10 mode
|
||||||
|
if (mtm == MTM_X10 && (button == 0 || evt == 'r')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evt == 'm' && mtm != MTM_BUTTON_MOTION && mtm != MTM_ANY_MOTION) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evt == 'm' && mtm == MTM_BUTTON_MOTION && button == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int eventcode = 0;
|
||||||
|
|
||||||
|
if (mtm == MTM_X10) {
|
||||||
|
eventcode = button-1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (button == 0 || (evt == 'r' && mte != MTE_SGR)) eventcode = 3; // release
|
||||||
|
else if (button == 1) eventcode = 0;
|
||||||
|
else if (button == 2) eventcode = 1;
|
||||||
|
else if (button == 3) eventcode = 2;
|
||||||
|
else if (button == 4) eventcode = 64;
|
||||||
|
else if (button == 5) eventcode = 65;
|
||||||
|
|
||||||
|
if (shift) eventcode |= 4;
|
||||||
|
if (alt || meta) eventcode |= 8;
|
||||||
|
if (ctrl) eventcode |= 16;
|
||||||
|
|
||||||
|
if (mtm == MTM_BUTTON_MOTION || mtm == MTM_ANY_MOTION) {
|
||||||
|
if (evt == 'm') {
|
||||||
|
eventcode |= 32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encode
|
||||||
|
char buf[20];
|
||||||
|
buf[0] = 0;
|
||||||
|
if (mte == MTE_SIMPLE || mte == MTE_UTF8) {
|
||||||
|
// strictly, for UTF8 this will break if any coord is over 127,
|
||||||
|
// but that is unlikely due to screen size limitations in ESPTerm
|
||||||
|
sprintf(buf, "\x1b[M%c%c%c", (u8)(32+eventcode), (u8)(32+x), (u8)(32+y));
|
||||||
|
}
|
||||||
|
else if (mte == MTE_SGR) {
|
||||||
|
sprintf(buf, "\x1b[<%d;%d;%d%c", eventcode, x, y, evt == 'p' ? 'M' : 'm');
|
||||||
|
}
|
||||||
|
else if (mte == MTE_URXVT) {
|
||||||
|
sprintf(buf, "\x1b[%d;%d;%dM", (u8)(32+eventcode), (u8)(32+x), (u8)(32+y));
|
||||||
|
}
|
||||||
|
|
||||||
|
UART_SendAsync(buf, -1);
|
||||||
|
}
|
||||||
|
|
||||||
/** Socket received a message */
|
/** Socket received a message */
|
||||||
void ICACHE_FLASH_ATTR updateSockRx(Websock *ws, char *data, int len, int flags)
|
void ICACHE_FLASH_ATTR updateSockRx(Websock *ws, char *data, int len, int flags)
|
||||||
{
|
{
|
||||||
char buf[20];
|
|
||||||
// Add terminator if missing (seems to randomly happen)
|
// Add terminator if missing (seems to randomly happen)
|
||||||
data[len] = 0;
|
data[len] = 0;
|
||||||
|
|
||||||
// TODO re-implement those, use single byte markers and B2 encoding
|
|
||||||
|
|
||||||
ws_dbg("Sock RX str: %s, len %d", data, len);
|
ws_dbg("Sock RX str: %s, len %d", data, len);
|
||||||
|
|
||||||
if (strstarts(data, "STR:")) {
|
int y, x, m, b;
|
||||||
|
u8 btnNum;
|
||||||
|
|
||||||
|
char c = data[0];
|
||||||
|
switch (c) {
|
||||||
|
case 's':
|
||||||
// pass string verbatim
|
// pass string verbatim
|
||||||
#if LOOPBACK
|
#if LOOPBACK
|
||||||
for(int i=4;i<strlen(data); i++) {
|
for(int i=4;i<strlen(data); i++) {
|
||||||
ansi_parser(data[i]);
|
ansi_parser(data[i]);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
UART_SendAsync(data+4, -1);
|
UART_SendAsync(data+1, -1);
|
||||||
#endif
|
#endif
|
||||||
}
|
break;
|
||||||
else if (strstarts(data, "BTN:")) {
|
case 'b':
|
||||||
// send button as low ASCII value 1-9
|
// action button press
|
||||||
u8 btnNum = (u8) (data[4] - '0');
|
btnNum = (u8) (data[1]);
|
||||||
if (btnNum > 0 && btnNum < 10) {
|
if (btnNum > 0 && btnNum < 10) {
|
||||||
UART_SendAsync((const char *) &btnNum, 1);
|
UART_SendAsync((const char *) &btnNum, 1); // TODO this is where we use user-configured codes
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (strstarts(data, "TAP:")) {
|
|
||||||
// this comes in as 0-based
|
|
||||||
|
|
||||||
int y=0, x=0;
|
|
||||||
|
|
||||||
char *pc=data+4;
|
|
||||||
char c;
|
|
||||||
int phase=0;
|
|
||||||
|
|
||||||
while((c=*pc++) != '\0') {
|
|
||||||
if (c==','||c==';') {
|
|
||||||
phase++;
|
|
||||||
}
|
}
|
||||||
else if (c>='0' && c<='9') {
|
break;
|
||||||
if (phase==0) {
|
case 'm':
|
||||||
y=y*10+(c-'0');
|
case 'p':
|
||||||
} else {
|
case 'r':
|
||||||
x=x*10+(c-'0');
|
if (mouse_tracking.mode == MTM_NONE) break; // no need to parse, not enabled
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!screen_isCoordValid(y, x)) {
|
// mouse move
|
||||||
ws_warn("Mouse input at invalid coordinates");
|
y = parse2B(data+1); // row, 0-based
|
||||||
return;
|
x = parse2B(data+3); // column, 0-based
|
||||||
}
|
b = parse2B(data+5); // mouse button, 0 = none, 1-5 = button number
|
||||||
|
m = parse2B(data+7); // modifier keys held
|
||||||
|
|
||||||
ws_dbg("Screen clicked at row %d, col %d", y+1, x+1);
|
sendMouseAction(c,y,x,b,m);
|
||||||
|
break;
|
||||||
// Send as 1-based to user
|
default:
|
||||||
sprintf(buf, "\033[%d;%dM", y+1, x+1);
|
ws_warn("Bad command.");
|
||||||
UART_SendAsync(buf, -1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ws_warn("Bad command.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ICACHE_FLASH_ATTR heartbeatTimCb(void *unused)
|
void ICACHE_FLASH_ATTR heartbeatTimCb(void *unused)
|
||||||
{
|
{
|
||||||
if (notify_available) {
|
if (notify_available) {
|
||||||
|
// Heartbeat packet - indicate we're still connected
|
||||||
|
// JS reloads the page if heartbeat is lost for a couple seconds
|
||||||
cgiWebsockBroadcast(URL_WS_UPDATE, ".", 1, 0);
|
cgiWebsockBroadcast(URL_WS_UPDATE, ".", 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,5 +255,5 @@ void ICACHE_FLASH_ATTR updateSockConnect(Websock *ws)
|
|||||||
ws_info("Socket connected to "URL_WS_UPDATE);
|
ws_info("Socket connected to "URL_WS_UPDATE);
|
||||||
ws->recvCb = updateSockRx;
|
ws->recvCb = updateSockRx;
|
||||||
|
|
||||||
TIMER_START(&heartbeatTim, heartbeatTimCb, 1000, 1);
|
TIMER_START(&heartbeatTim, heartbeatTimCb, HB_TIME, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
//
|
||||||
|
// Created by MightyPork on 2017/09/04.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "jstring.h"
|
||||||
|
|
||||||
|
void ICACHE_FLASH_ATTR
|
||||||
|
encode2B(u16 number, WordB2 *stru)
|
||||||
|
{
|
||||||
|
stru->lsb = (u8) (number % 127);
|
||||||
|
number = (u16) ((number - stru->lsb) / 127);
|
||||||
|
stru->lsb += 1;
|
||||||
|
|
||||||
|
stru->msb = (u8) (number + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ICACHE_FLASH_ATTR
|
||||||
|
encode3B(u32 number, WordB3 *stru)
|
||||||
|
{
|
||||||
|
stru->lsb = (u8) (number % 127);
|
||||||
|
number = (number - stru->lsb) / 127;
|
||||||
|
stru->lsb += 1;
|
||||||
|
|
||||||
|
stru->msb = (u8) (number % 127);
|
||||||
|
number = (number - stru->msb) / 127;
|
||||||
|
stru->msb += 1;
|
||||||
|
|
||||||
|
stru->xsb = (u8) (number + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
u16 ICACHE_FLASH_ATTR
|
||||||
|
parse2B(const char *str)
|
||||||
|
{
|
||||||
|
return (u16) ((str[0] - 1) + (str[1] - 1) * 127);
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 ICACHE_FLASH_ATTR
|
||||||
|
parse3B(const char *str)
|
||||||
|
{
|
||||||
|
return (u32) ((str[0] - 1) + (str[1] - 1) * 127 + (str[2] - 1) * 127 * 127);
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
//
|
||||||
|
// Created by MightyPork on 2017/09/04.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ESPTERM_JSTRING_H
|
||||||
|
#define ESPTERM_JSTRING_H
|
||||||
|
|
||||||
|
#include <esp8266.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u8 lsb;
|
||||||
|
u8 msb;
|
||||||
|
} WordB2;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u8 lsb;
|
||||||
|
u8 msb;
|
||||||
|
u8 xsb;
|
||||||
|
} WordB3;
|
||||||
|
|
||||||
|
void encode2B(u16 number, WordB2 *stru);
|
||||||
|
|
||||||
|
void encode3B(u32 number, WordB3 *stru);
|
||||||
|
|
||||||
|
u16 parse2B(const char *str);
|
||||||
|
|
||||||
|
u32 parse3B(const char *str);
|
||||||
|
|
||||||
|
#endif //ESPTERM_JSTRING_H
|
||||||
+2
-2
@@ -29,7 +29,7 @@ HttpdBuiltInUrl routes[] = {
|
|||||||
// --- Web pages ---
|
// --- Web pages ---
|
||||||
ROUTE_TPL_FILE("/", tplScreen, "/term.tpl"),
|
ROUTE_TPL_FILE("/", tplScreen, "/term.tpl"),
|
||||||
ROUTE_TPL_FILE("/about/?", tplAbout, "/about.tpl"),
|
ROUTE_TPL_FILE("/about/?", tplAbout, "/about.tpl"),
|
||||||
ROUTE_FILE("/help/?", "/help.tpl"),
|
ROUTE_FILE("/help/?", "/help.html"),
|
||||||
|
|
||||||
// --- Sockets ---
|
// --- Sockets ---
|
||||||
ROUTE_CGI("/term/init", cgiTermInitialImage),
|
ROUTE_CGI("/term/init", cgiTermInitialImage),
|
||||||
@@ -46,7 +46,7 @@ HttpdBuiltInUrl routes[] = {
|
|||||||
ROUTE_REDIRECT("/cfg/?", "/cfg/wifi"),
|
ROUTE_REDIRECT("/cfg/?", "/cfg/wifi"),
|
||||||
|
|
||||||
ROUTE_TPL_FILE("/cfg/wifi/?", tplWlan, "/cfg_wifi.tpl"),
|
ROUTE_TPL_FILE("/cfg/wifi/?", tplWlan, "/cfg_wifi.tpl"),
|
||||||
ROUTE_FILE("/cfg/wifi/connecting/?", "/cfg_wifi_conn.tpl"),
|
ROUTE_FILE("/cfg/wifi/connecting/?", "/cfg_wifi_conn.html"),
|
||||||
ROUTE_CGI("/cfg/wifi/scan", cgiWiFiScan),
|
ROUTE_CGI("/cfg/wifi/scan", cgiWiFiScan),
|
||||||
ROUTE_CGI("/cfg/wifi/connstatus", cgiWiFiConnStatus),
|
ROUTE_CGI("/cfg/wifi/connstatus", cgiWiFiConnStatus),
|
||||||
ROUTE_CGI("/cfg/wifi/set", cgiWiFiSetParams),
|
ROUTE_CGI("/cfg/wifi/set", cgiWiFiSetParams),
|
||||||
|
|||||||
+21
-24
@@ -5,10 +5,13 @@
|
|||||||
#include "sgr.h"
|
#include "sgr.h"
|
||||||
#include "ascii.h"
|
#include "ascii.h"
|
||||||
#include "apars_logging.h"
|
#include "apars_logging.h"
|
||||||
|
#include "jstring.h"
|
||||||
|
|
||||||
TerminalConfigBundle * const termconf = &persist.current.termconf;
|
TerminalConfigBundle * const termconf = &persist.current.termconf;
|
||||||
TerminalConfigBundle termconf_scratch;
|
TerminalConfigBundle termconf_scratch;
|
||||||
|
|
||||||
|
MouseTrackingConfig mouse_tracking;
|
||||||
|
|
||||||
// forward declare
|
// forward declare
|
||||||
static void utf8_remap(char* out, char g, char charset);
|
static void utf8_remap(char* out, char g, char charset);
|
||||||
|
|
||||||
@@ -198,6 +201,8 @@ terminal_apply_settings_noclear(void)
|
|||||||
void ICACHE_FLASH_ATTR
|
void ICACHE_FLASH_ATTR
|
||||||
screen_init(void)
|
screen_init(void)
|
||||||
{
|
{
|
||||||
|
dbg("Screen buffer size = %d bytes", sizeof(screen));
|
||||||
|
|
||||||
NOTIFY_LOCK();
|
NOTIFY_LOCK();
|
||||||
screen_reset();
|
screen_reset();
|
||||||
NOTIFY_DONE();
|
NOTIFY_DONE();
|
||||||
@@ -255,6 +260,10 @@ screen_reset(void)
|
|||||||
scr.vm0 = 0;
|
scr.vm0 = 0;
|
||||||
scr.vm1 = H-1;
|
scr.vm1 = H-1;
|
||||||
|
|
||||||
|
mouse_tracking.encoding = MTE_SIMPLE;
|
||||||
|
mouse_tracking.focus_tracking = false;
|
||||||
|
mouse_tracking.mode = MTM_NONE;
|
||||||
|
|
||||||
// size is left unchanged
|
// size is left unchanged
|
||||||
screen_clear(CLEAR_ALL);
|
screen_clear(CLEAR_ALL);
|
||||||
|
|
||||||
@@ -627,6 +636,18 @@ screen_set_title(const char *title)
|
|||||||
screen_notifyChange(CHANGE_LABELS);
|
screen_notifyChange(CHANGE_LABELS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to set terminal button label
|
||||||
|
* @param num - button number 1-5
|
||||||
|
* @param str - button text
|
||||||
|
*/
|
||||||
|
void ICACHE_FLASH_ATTR
|
||||||
|
screen_set_button_text(int num, const char *text)
|
||||||
|
{
|
||||||
|
strncpy(termconf_scratch.btn[num-1], text, TERM_BTN_LEN);
|
||||||
|
screen_notifyChange(CHANGE_LABELS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shift screen upwards
|
* Shift screen upwards
|
||||||
*/
|
*/
|
||||||
@@ -1307,30 +1328,6 @@ struct ScreenSerializeState {
|
|||||||
int index;
|
int index;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ICACHE_FLASH_ATTR
|
|
||||||
encode2B(u16 number, WordB2 *stru)
|
|
||||||
{
|
|
||||||
stru->lsb = (u8) (number % 127);
|
|
||||||
number = (u16) ((number - stru->lsb) / 127);
|
|
||||||
stru->lsb += 1;
|
|
||||||
|
|
||||||
stru->msb = (u8) (number + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ICACHE_FLASH_ATTR
|
|
||||||
encode3B(u32 number, WordB3 *stru)
|
|
||||||
{
|
|
||||||
stru->lsb = (u8) (number % 127);
|
|
||||||
number = (number - stru->lsb) / 127;
|
|
||||||
stru->lsb += 1;
|
|
||||||
|
|
||||||
stru->msb = (u8) (number % 127);
|
|
||||||
number = (number - stru->msb) / 127;
|
|
||||||
stru->msb += 1;
|
|
||||||
|
|
||||||
stru->xsb = (u8) (number + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* buffer should be at least 64+5*10+6 long (title + buttons + 6), ie. 120
|
* buffer should be at least 64+5*10+6 long (title + buttons + 6), ie. 120
|
||||||
* @param buffer
|
* @param buffer
|
||||||
|
|||||||
+24
-15
@@ -50,7 +50,7 @@
|
|||||||
#define SCR_DEF_TITLE "ESPTerm"
|
#define SCR_DEF_TITLE "ESPTerm"
|
||||||
|
|
||||||
/** Maximum screen size (determines size of the static data array) */
|
/** Maximum screen size (determines size of the static data array) */
|
||||||
#define MAX_SCREEN_SIZE (80*26)
|
#define MAX_SCREEN_SIZE (80*25)
|
||||||
|
|
||||||
#define TERMCONF_VERSION 1
|
#define TERMCONF_VERSION 1
|
||||||
|
|
||||||
@@ -80,6 +80,29 @@ extern TerminalConfigBundle * const termconf;
|
|||||||
*/
|
*/
|
||||||
extern TerminalConfigBundle termconf_scratch;
|
extern TerminalConfigBundle termconf_scratch;
|
||||||
|
|
||||||
|
enum MTM {
|
||||||
|
MTM_NONE = 0,
|
||||||
|
MTM_X10 = 1,
|
||||||
|
MTM_NORMAL = 2,
|
||||||
|
MTM_BUTTON_MOTION = 3,
|
||||||
|
MTM_ANY_MOTION = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum MTE {
|
||||||
|
MTE_SIMPLE = 0,
|
||||||
|
MTE_UTF8 = 1,
|
||||||
|
MTE_SGR = 2,
|
||||||
|
MTE_URXVT = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
enum MTM mode;
|
||||||
|
bool focus_tracking;
|
||||||
|
enum MTE encoding;
|
||||||
|
} MouseTrackingConfig;
|
||||||
|
|
||||||
|
extern MouseTrackingConfig mouse_tracking;
|
||||||
|
|
||||||
/** Restore default settings to termconf. Does not apply or copy to scratch. */
|
/** Restore default settings to termconf. Does not apply or copy to scratch. */
|
||||||
void terminal_restore_defaults(void);
|
void terminal_restore_defaults(void);
|
||||||
/** Apply settings, redraw (clears the screen) */
|
/** Apply settings, redraw (clears the screen) */
|
||||||
@@ -97,17 +120,6 @@ void screen_set_button_text(int num, const char *text);
|
|||||||
|
|
||||||
// --- Encoding ---
|
// --- Encoding ---
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
u8 lsb;
|
|
||||||
u8 msb;
|
|
||||||
} WordB2;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
u8 lsb;
|
|
||||||
u8 msb;
|
|
||||||
u8 xsb;
|
|
||||||
} WordB3;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CS_USASCII = 'B',
|
CS_USASCII = 'B',
|
||||||
CS_UKASCII = 'A',
|
CS_UKASCII = 'A',
|
||||||
@@ -115,9 +127,6 @@ typedef enum {
|
|||||||
CS_DOS_437 = '1',
|
CS_DOS_437 = '1',
|
||||||
} CHARSET;
|
} CHARSET;
|
||||||
|
|
||||||
/** Encode number to two nice ASCII bytes */
|
|
||||||
void encode2B(u16 number, WordB2 *stru);
|
|
||||||
|
|
||||||
httpd_cgi_state screenSerializeToBuffer(char *buffer, size_t buf_len, void **data);
|
httpd_cgi_state screenSerializeToBuffer(char *buffer, size_t buf_len, void **data);
|
||||||
|
|
||||||
void screenSerializeLabelsToBuffer(char *buffer, size_t buf_len);
|
void screenSerializeLabelsToBuffer(char *buffer, size_t buf_len);
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
#include "ansi_parser.h"
|
#include "ansi_parser.h"
|
||||||
#include "syscfg.h"
|
#include "syscfg.h"
|
||||||
|
|
||||||
#define LOGBUF_SIZE 1500
|
#define LOGBUF_SIZE 2048
|
||||||
static char logbuf[LOGBUF_SIZE];
|
static char logbuf[LOGBUF_SIZE];
|
||||||
static u32 lb_nw = 1;
|
static u32 lb_nw = 1;
|
||||||
static u32 lb_ls = 0;
|
static u32 lb_ls = 0;
|
||||||
|
|||||||
+11
-11
@@ -45,9 +45,9 @@ UART_AsyncBufferInit(uint32 buf_size)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
struct UartBuffer *pBuff = (struct UartBuffer *) os_malloc(sizeof(struct UartBuffer));
|
struct UartBuffer *pBuff = (struct UartBuffer *) malloc(sizeof(struct UartBuffer));
|
||||||
pBuff->UartBuffSize = buf_size;
|
pBuff->UartBuffSize = buf_size;
|
||||||
pBuff->pUartBuff = (uint8 *) os_malloc(pBuff->UartBuffSize);
|
pBuff->pUartBuff = (uint8 *) malloc(pBuff->UartBuffSize);
|
||||||
pBuff->pInPos = pBuff->pUartBuff;
|
pBuff->pInPos = pBuff->pUartBuff;
|
||||||
pBuff->pOutPos = pBuff->pUartBuff;
|
pBuff->pOutPos = pBuff->pUartBuff;
|
||||||
pBuff->Space = (uint16) pBuff->UartBuffSize;
|
pBuff->Space = (uint16) pBuff->UartBuffSize;
|
||||||
@@ -68,17 +68,17 @@ static void UART_WriteToAsyncBuffer(struct UartBuffer *pCur, const char *pdata,
|
|||||||
|
|
||||||
uint16 tail_len = (uint16) (pCur->pUartBuff + pCur->UartBuffSize - pCur->pInPos);
|
uint16 tail_len = (uint16) (pCur->pUartBuff + pCur->UartBuffSize - pCur->pInPos);
|
||||||
if (tail_len >= data_len) { //do not need to loop back the queue
|
if (tail_len >= data_len) { //do not need to loop back the queue
|
||||||
os_memcpy(pCur->pInPos, pdata, data_len);
|
memcpy(pCur->pInPos, pdata, data_len);
|
||||||
pCur->pInPos += (data_len);
|
pCur->pInPos += (data_len);
|
||||||
pCur->pInPos = (pCur->pUartBuff + (pCur->pInPos - pCur->pUartBuff) % pCur->UartBuffSize);
|
pCur->pInPos = (pCur->pUartBuff + (pCur->pInPos - pCur->pUartBuff) % pCur->UartBuffSize);
|
||||||
pCur->Space -= data_len;
|
pCur->Space -= data_len;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
os_memcpy(pCur->pInPos, pdata, tail_len);
|
memcpy(pCur->pInPos, pdata, tail_len);
|
||||||
pCur->pInPos += (tail_len);
|
pCur->pInPos += (tail_len);
|
||||||
pCur->pInPos = (pCur->pUartBuff + (pCur->pInPos - pCur->pUartBuff) % pCur->UartBuffSize);
|
pCur->pInPos = (pCur->pUartBuff + (pCur->pInPos - pCur->pUartBuff) % pCur->UartBuffSize);
|
||||||
pCur->Space -= tail_len;
|
pCur->Space -= tail_len;
|
||||||
os_memcpy(pCur->pInPos, pdata + tail_len, data_len - tail_len);
|
memcpy(pCur->pInPos, pdata + tail_len, data_len - tail_len);
|
||||||
pCur->pInPos += (data_len - tail_len);
|
pCur->pInPos += (data_len - tail_len);
|
||||||
pCur->pInPos = (pCur->pUartBuff + (pCur->pInPos - pCur->pUartBuff) % pCur->UartBuffSize);
|
pCur->pInPos = (pCur->pUartBuff + (pCur->pInPos - pCur->pUartBuff) % pCur->UartBuffSize);
|
||||||
pCur->Space -= (data_len - tail_len);
|
pCur->Space -= (data_len - tail_len);
|
||||||
@@ -93,8 +93,8 @@ static void UART_WriteToAsyncBuffer(struct UartBuffer *pCur, const char *pdata,
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ICACHE_FLASH_ATTR UART_FreeAsyncBuffer(struct UartBuffer *pBuff)
|
void ICACHE_FLASH_ATTR UART_FreeAsyncBuffer(struct UartBuffer *pBuff)
|
||||||
{
|
{
|
||||||
os_free(pBuff->pUartBuff);
|
free(pBuff->pUartBuff);
|
||||||
os_free(pBuff);
|
free(pBuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 ICACHE_FLASH_ATTR UART_AsyncRxCount(void)
|
u16 ICACHE_FLASH_ATTR UART_AsyncRxCount(void)
|
||||||
@@ -116,19 +116,19 @@ UART_ReadAsync(char *pdata, uint16 data_len)
|
|||||||
uint16 len_tmp = 0;
|
uint16 len_tmp = 0;
|
||||||
len_tmp = ((data_len > buf_len) ? buf_len : data_len);
|
len_tmp = ((data_len > buf_len) ? buf_len : data_len);
|
||||||
if (pRxBuffer->pOutPos <= pRxBuffer->pInPos) {
|
if (pRxBuffer->pOutPos <= pRxBuffer->pInPos) {
|
||||||
os_memcpy(pdata, pRxBuffer->pOutPos, len_tmp);
|
memcpy(pdata, pRxBuffer->pOutPos, len_tmp);
|
||||||
pRxBuffer->pOutPos += len_tmp;
|
pRxBuffer->pOutPos += len_tmp;
|
||||||
pRxBuffer->Space += len_tmp;
|
pRxBuffer->Space += len_tmp;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (len_tmp > tail_len) {
|
if (len_tmp > tail_len) {
|
||||||
os_memcpy(pdata, pRxBuffer->pOutPos, tail_len);
|
memcpy(pdata, pRxBuffer->pOutPos, tail_len);
|
||||||
pRxBuffer->pOutPos += tail_len;
|
pRxBuffer->pOutPos += tail_len;
|
||||||
pRxBuffer->pOutPos = (pRxBuffer->pUartBuff +
|
pRxBuffer->pOutPos = (pRxBuffer->pUartBuff +
|
||||||
(pRxBuffer->pOutPos - pRxBuffer->pUartBuff) % pRxBuffer->UartBuffSize);
|
(pRxBuffer->pOutPos - pRxBuffer->pUartBuff) % pRxBuffer->UartBuffSize);
|
||||||
pRxBuffer->Space += tail_len;
|
pRxBuffer->Space += tail_len;
|
||||||
|
|
||||||
os_memcpy(pdata + tail_len, pRxBuffer->pOutPos, len_tmp - tail_len);
|
memcpy(pdata + tail_len, pRxBuffer->pOutPos, len_tmp - tail_len);
|
||||||
pRxBuffer->pOutPos += (len_tmp - tail_len);
|
pRxBuffer->pOutPos += (len_tmp - tail_len);
|
||||||
pRxBuffer->pOutPos = (pRxBuffer->pUartBuff +
|
pRxBuffer->pOutPos = (pRxBuffer->pUartBuff +
|
||||||
(pRxBuffer->pOutPos - pRxBuffer->pUartBuff) % pRxBuffer->UartBuffSize);
|
(pRxBuffer->pOutPos - pRxBuffer->pUartBuff) % pRxBuffer->UartBuffSize);
|
||||||
@@ -136,7 +136,7 @@ UART_ReadAsync(char *pdata, uint16 data_len)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//os_printf("case 3 in rx deq\n\r");
|
//os_printf("case 3 in rx deq\n\r");
|
||||||
os_memcpy(pdata, pRxBuffer->pOutPos, len_tmp);
|
memcpy(pdata, pRxBuffer->pOutPos, len_tmp);
|
||||||
pRxBuffer->pOutPos += len_tmp;
|
pRxBuffer->pOutPos += len_tmp;
|
||||||
pRxBuffer->pOutPos = (pRxBuffer->pUartBuff +
|
pRxBuffer->pOutPos = (pRxBuffer->pUartBuff +
|
||||||
(pRxBuffer->pOutPos - pRxBuffer->pUartBuff) % pRxBuffer->UartBuffSize);
|
(pRxBuffer->pOutPos - pRxBuffer->pUartBuff) % pRxBuffer->UartBuffSize);
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#define FW_V_MAJOR 0
|
#define FW_V_MAJOR 0
|
||||||
#define FW_V_MINOR 7
|
#define FW_V_MINOR 7
|
||||||
#define FW_V_PATCH 0
|
#define FW_V_PATCH 1
|
||||||
|
|
||||||
#define FIRMWARE_VERSION STR(FW_V_MAJOR) "." STR(FW_V_MINOR) "." STR(FW_V_PATCH) "+" GIT_HASH
|
#define FIRMWARE_VERSION STR(FW_V_MAJOR) "." STR(FW_V_MINOR) "." STR(FW_V_PATCH) "+" GIT_HASH
|
||||||
#define FIRMWARE_VERSION_NUM (FW_V_MAJOR*10000 + FW_V_MINOR*100 + FW_V_PATCH) // this is used in ID queries
|
#define FIRMWARE_VERSION_NUM (FW_V_MAJOR*10000 + FW_V_MINOR*100 + FW_V_PATCH) // this is used in ID queries
|
||||||
|
|||||||
Reference in New Issue
Block a user