mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
CLI bugfixes
This commit is contained in:
parent
12d205a6a4
commit
88e7bc8a9f
3 changed files with 27 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
|||
// OS detection
|
||||
var OS = "Unknown";
|
||||
if (navigator.appVersion.indexOf("Win") != -1) OS = "Windows";
|
||||
if (navigator.appVersion.indexOf("Mac") != -1) OS = "MacOS";
|
||||
if (navigator.appVersion.indexOf("X11") != -1) OS = "UNIX";
|
||||
if (navigator.appVersion.indexOf("Linux") != -1) OS = "Linux";
|
||||
|
||||
var timers = new Array();
|
||||
|
||||
$(document).ready(function() {
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
send "<strong>exit</strong>" to the board, which will make the controller save all the changes and <span style="color: red">restart</span>.
|
||||
</p>
|
||||
<div class="window">
|
||||
<div class="wrapper">
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" name="commands" value="" />
|
||||
</div>
|
21
tabs/cli.js
21
tabs/cli.js
|
@ -54,15 +54,30 @@ function leave_CLI(callback) {
|
|||
CLI_active = false;
|
||||
}
|
||||
|
||||
|
||||
/* Some info about handling line feeds and carriage return
|
||||
|
||||
line feed = LF = \n = 0x0A = 10
|
||||
carriage return = CR = \r = 0x0D = 13
|
||||
|
||||
MAC only understands CR
|
||||
Linux and Unix only understand LF
|
||||
Windows understands (both) CRLF
|
||||
*/
|
||||
function handle_CLI(data) {
|
||||
switch (data) {
|
||||
case 10: // line feed
|
||||
if (OS == "Windows" || OS == "Linux" || OS == "UNIX") {
|
||||
$('.tab-cli .window .wrapper').append("<br />");
|
||||
}
|
||||
break;
|
||||
case 13: // carriage return
|
||||
$('.tab-cli .window').append("<br />");
|
||||
if (OS == "MacOS") {
|
||||
$('.tab-cli .window .wrapper').append("<br />");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$('.tab-cli .window').append(String.fromCharCode(data));
|
||||
$('.tab-cli .window').scrollTop($('.tab-cli .window').height());
|
||||
$('.tab-cli .window .wrapper').append(String.fromCharCode(data));
|
||||
$('.tab-cli .window').scrollTop($('.tab-cli .window .wrapper').height());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue