mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 16:25:22 +03:00
Merge pull request #2460 from haslinghuis/filter_cli_output
Filter MSP Output while opening CLI
This commit is contained in:
commit
57666a9d7a
1 changed files with 34 additions and 28 deletions
|
@ -5,6 +5,7 @@ TABS.cli = {
|
|||
profileSwitchDelayMs: 100,
|
||||
outputHistory: "",
|
||||
cliBuffer: "",
|
||||
startProcessing: false,
|
||||
GUI: {
|
||||
snippetPreviewWindow: null,
|
||||
copyButton: null,
|
||||
|
@ -83,6 +84,7 @@ TABS.cli.initialize = function (callback) {
|
|||
|
||||
self.outputHistory = "";
|
||||
self.cliBuffer = "";
|
||||
self.startProcessing = false;
|
||||
|
||||
const enterKeyCode = 13;
|
||||
|
||||
|
@ -108,7 +110,7 @@ TABS.cli.initialize = function (callback) {
|
|||
}, delay);
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
$('#content').load("./tabs/cli.html", function () {
|
||||
// translate to user-selected language
|
||||
|
@ -400,9 +402,11 @@ TABS.cli.read = function (readInfo) {
|
|||
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const currentChar = String.fromCharCode(data[i]);
|
||||
const isCRLF = currentChar.charCodeAt() === lineFeedCode || currentChar.charCodeAt() === carriageReturnCode;
|
||||
|
||||
if (!CONFIGURATOR.cliValid) {
|
||||
// try to catch part of valid CLI enter message
|
||||
if (!CONFIGURATOR.cliValid && (isCRLF || this.startProcessing)) {
|
||||
// try to catch part of valid CLI enter message (firmware message starts with CRLF)
|
||||
this.startProcessing = true;
|
||||
validateText += currentChar;
|
||||
writeToOutput(currentChar);
|
||||
continue;
|
||||
|
@ -419,6 +423,7 @@ TABS.cli.read = function (readInfo) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (CONFIGURATOR.cliValid) {
|
||||
switch (data[i]) {
|
||||
case lineFeedCode:
|
||||
if (GUI.operating_system === "Windows") {
|
||||
|
@ -446,6 +451,7 @@ TABS.cli.read = function (readInfo) {
|
|||
default:
|
||||
this.cliBuffer += currentChar;
|
||||
}
|
||||
}
|
||||
|
||||
if (!CliAutoComplete.isBuilding()) {
|
||||
// do not include the building dialog into the history
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue