1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 00:05:33 +03:00

polishing

This commit is contained in:
cTn 2013-11-01 15:04:55 +01:00
parent a6ba32263c
commit 8e7897ed9c

View file

@ -1,21 +1,21 @@
var CliHistory = function () { var CliHistory = function () {
this.history = []; this.history = [];
this.index = 0; this.index = 0;
}; };
CliHistory.prototype = { CliHistory.prototype = {
add: function (str) { add: function (str) {
this.history.push(str); this.history.push(str);
this.index = this.history.length; this.index = this.history.length;
}, },
prev: function () { prev: function () {
if (this.index > 0) this.index -= 1; if (this.index > 0) this.index -= 1;
return this.history[this.index]; return this.history[this.index];
}, },
next: function () { next: function () {
if (this.index < this.history.length) this.index += 1; if (this.index < this.history.length) this.index += 1;
return this.history[this.index - 1]; return this.history[this.index - 1];
} }
} }
cli_history = new CliHistory(); cli_history = new CliHistory();
@ -32,8 +32,7 @@ function tab_initialize_cli() {
bufView[0] = 0x23; // # bufView[0] = 0x23; // #
chrome.serial.write(connectionId, bufferOut, function(writeInfo) { chrome.serial.write(connectionId, bufferOut, function(writeInfo) {});
});
var textarea = $('.tab-cli textarea'); var textarea = $('.tab-cli textarea');
textarea.keypress(function(event) { textarea.keypress(function(event) {
@ -109,7 +108,7 @@ function leave_CLI(callback) {
bufView[4] = 0x0D; // enter bufView[4] = 0x0D; // enter
chrome.serial.write(connectionId, bufferOut, function(writeInfo) { chrome.serial.write(connectionId, bufferOut, function(writeInfo) {
if (typeof callback !== 'undefined') { if (callback) {
callback(); callback();
} }
}); });
@ -146,6 +145,7 @@ function handle_CLI(data) {
sequence_elements = 0; sequence_elements = 0;
} }
} }
if (sequence_elements == 0) { if (sequence_elements == 0) {
switch (data) { switch (data) {
case 10: // line feed case 10: // line feed