-
-
Notifications
You must be signed in to change notification settings - Fork 917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Presets: ignore CLI error messages caused by resetting defaults #3635
Presets: ignore CLI error messages caused by resetting defaults #3635
Conversation
This comment has been minimized.
This comment has been minimized.
SonarCloud Quality Gate failed. 0 Bugs No Coverage information Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
Do you want to test this code? Here you have an automated build: |
AUTOMERGE: (FAIL)
|
|
@@ -72,7 +73,7 @@ export default class CliEngine | |||
} | |||
|
|||
close(callback) { | |||
this.send(this.getCliCommand('exit\r', ""), function () { //this.cliBuffer | |||
this.send(this.getCliCommand('exit\r', ""), function () { //this._cliBuffer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems unused.
this.send(this.getCliCommand('exit\r', ""), function () { //this._cliBuffer | |
this.send(this.getCliCommand('exit\r', ""), function () { |
if (text.startsWith("###ERROR")) { | ||
this.writeToOutput(`<span class="error_message">${text}</span><br>`); | ||
this._cliErrorsCount++; | ||
if (this._lastCommandIsDefaults) { | ||
this.writeToOutput(`<span class="warning_message">${text}</span><br>`); | ||
} else { | ||
this.writeToOutput(`<span class="error_message">${text}</span><br>`); | ||
this._cliErrorsCount++; | ||
} | ||
} else { | ||
this._lastCommandIsDefaults = text.toLowerCase().includes(CliEngine.s_outputResetting); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is plain text used for logging and the actual logic here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't get the question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So instead of sending something like this
{
type: 'error',
message: '###ERROR some error message',
}
we have plain string which is used for display and hope that this value is formatted correctly when we do the logic. Like the meaning of the message is not separate from display.
Like, if for example this would be localised at some point, wouldn't ###ERROR
become ###BŁAD
in polish
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see yeah, it could be improved. This part is straight copy-paste from CLI tab.
I've also now found some errors in presets for 4.5 - so I don't think it's a good idea to mask them.
@haslinghuis it's not masking all errors, just the ones coming right after "defaults nosave". If presets got errors, they still be shown. |
@limonspb we should rather fix the underlying problem in firmware and look at each error (as we still can see the errors in cli). |
I wish it was possible for 4.4 But 4.4 had this problem since the beginning. I think it's because default config might have some commands like camera control, that might not be included in the actual firmware build. |
this PR is mainly for BF 4.4 where resetting to defaults causes CLI errors.
This problem makes the CLI dialog to show up every time the user hit "save" on the presets tab, or loads a backup.
The solution is to ignore errors that's popping right after resetting to defaults.
While working, i also noticed a bug that presets CLI messages timeout are being ignored.