1
0
Fork 0
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:
Ivan Efimov 2021-06-10 21:10:44 -05:00 committed by GitHub
commit 57666a9d7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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