From 0e65fefcab12f88181c4ccc66a6104909e95bb0a Mon Sep 17 00:00:00 2001 From: nerdCopter <56646290+nerdCopter@users.noreply.github.com> Date: Tue, 23 Jun 2026 13:20:47 -0500 Subject: [PATCH] fix(cli): suppress MSP garbage before CLI welcome message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the CLI tab opens, buffered MSP response frames (e.g. repeated MSP_BOXNAMES polls from the previous tab) were displayed as binary garbage because every incoming byte was written to the output display while CONFIGURATOR.cliValid was false. Fix: accumulate bytes silently until 'CLI' is found in the welcome message, then display only from 'Entering CLI Mode' onwards. MSP frames queued before the welcome message are discarded from the display without affecting serial communication. More visible after recent firmware PRs because more enabled features → more/larger MSP responses buffered during initial connection. Co-Authored-By: Claude Sonnet 4.6 --- src/js/tabs/cli.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/js/tabs/cli.js b/src/js/tabs/cli.js index 55f1cff88..edea9c595 100644 --- a/src/js/tabs/cli.js +++ b/src/js/tabs/cli.js @@ -404,9 +404,8 @@ TABS.cli.read = function (readInfo) { const currentChar = String.fromCharCode(data[i]); if (!CONFIGURATOR.cliValid) { - // try to catch part of valid CLI enter message + // Accumulate silently; MSP garbage before welcome message is not shown validateText += currentChar; - writeToOutput(currentChar); continue; } @@ -466,6 +465,19 @@ TABS.cli.read = function (readInfo) { if (!CONFIGURATOR.cliValid && validateText.indexOf('CLI') !== -1) { GUI.log(i18n.getMessage('cliEnter')); CONFIGURATOR.cliValid = true; + // Display only from 'Entering CLI Mode' onwards; MSP garbage before it is discarded + const cliMsgStart = validateText.indexOf('Entering CLI'); + if (cliMsgStart >= 0) { + const welcomeText = validateText.substring(cliMsgStart); + const lines = welcomeText.split(/\r?\n|\r/); + for (let j = 0; j < lines.length; j++) { + if (j < lines.length - 1) { + writeLineToOutput(lines[j]); + } else if (lines[j].length > 0) { + writeToOutput(lines[j]); // prompt line — no trailing
+ } + } + } // begin output history with the prompt (last line of welcome message) // this is to match the content of the history with what the user sees on this tab const lastLine = validateText.split("\n").pop();