-
-
Notifications
You must be signed in to change notification settings - Fork 935
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
Fix reset options #3932
Fix reset options #3932
Conversation
✅ Deploy Preview for origin-betaflight-app ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
This comment has been minimized.
This comment has been minimized.
src/js/msp/MSPHelper.js
Outdated
@@ -796,6 +796,7 @@ MspHelper.prototype.process_data = function(dataHandler) { | |||
console.log("Fw git rev:", FC.CONFIG.gitRevision); | |||
|
|||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) { | |||
FC.CONFIG.buildOptions = []; |
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.
We have an INITIAL_CONFIG that I think does preciselly that:
betaflight-configurator/src/js/fc.js
Lines 5 to 52 in 4d46da2
const INITIAL_CONFIG = { | |
apiVersion: "0.0.0", | |
flightControllerIdentifier: '', | |
flightControllerVersion: '', | |
version: 0, | |
buildInfo: '', | |
buildKey: '', | |
buildOptions: [], | |
gitRevision: '', | |
multiType: 0, | |
msp_version: 0, // not specified using semantic versioning | |
capability: 0, | |
cycleTime: 0, | |
i2cError: 0, | |
cpuload: 0, | |
cpuTemp: 0, | |
activeSensors: 0, | |
mode: 0, | |
profile: 0, | |
uid: [0, 0, 0], | |
accelerometerTrims: [0, 0], | |
name: '', // present for backwards compatibility before MSP v1.45 | |
craftName: '', | |
displayName: '', // present for backwards compatibility before MSP v1.45 | |
pilotName: '', | |
pidProfileNames: ["", "", "", ""], | |
rateProfileNames: ["", "", "", ""], | |
numProfiles: 3, | |
rateProfile: 0, | |
boardType: 0, | |
armingDisableCount: 0, | |
armingDisableFlags: 0, | |
armingDisabled: false, | |
runawayTakeoffPreventionDisabled: false, | |
boardIdentifier: "", | |
boardVersion: 0, | |
targetCapabilities: 0, | |
targetName: "", | |
boardName: "", | |
manufacturerId: "", | |
signature: [], | |
mcuTypeId: 255, | |
configurationState: 0, | |
configStateFlag: 0, | |
sampleRateHz: 0, | |
configurationProblems: 0, | |
hardwareName: '', | |
}; |
It contains the buildOptions
. Why it does not work?
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.
betaflight-configurator/src/js/fc.js
Lines 226 to 229 in 71dad13
resetState () { | |
// Using `Object.assign` instead of reassigning to | |
// trigger the updates on the Vue side | |
Object.assign(this.CONFIG, INITIAL_CONFIG); |
buildOptions is not being reset here. This looks like the root cause. Need further investigation.
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.
this.CONFIG.buildOptions
is even retained when destroying the object and reassign with INITIAL_CONFIG
instead of line 229. With this code this.CONFIG.buildOptions
is not retaining previous values when switching FC.
this.CONFIG = null;
this.CONFIG = INITIAL_CONFIG;
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.
@McGiverGim doing a deep copy solves the issue.
|
Do you want to test this code? Here you have an automated build: |
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.
Not tested, but looks good to me 👌
* Fix reset options * Use deep copy
* Fix reset options * Use deep copy
FC.resetState()
two times a second in portHandler