-
-
Couldn't load subscription status.
- Fork 1k
New PID sliders and changed defaults #2572
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
Conversation
ac61cc5 to
59bc56b
Compare
9a11a7d to
94bc133
Compare
|
Sorry @haslinghuis but we loose all backward compatibility here, we loose one of the sliders for old versions and just stick response slider works. |
732d994 to
0a1cefb
Compare
0a1cefb to
346b4ed
Compare
src/js/TuningSliders.js
Outdated
| this.sliderMasterMultiplier = 1; | ||
| this.sliderPDRatio = 1; | ||
| this.sliderPDGain = 1; | ||
| this.sliderFeedforwardGain = 1; |
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 parametre can go outside this Api version condition because is aplied to all versions.
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.
Fixed
| if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) { | ||
| $('output[name="sliderDGain-number"]').val(this.sliderDGain); | ||
| $('output[name="sliderPIGain-number"]').val(this.sliderPIGain); | ||
| $('output[name="sliderFeedforwardGain-number"]').val(this.sliderFeedforwardGain); |
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.
Same here, is aplied to all versions and can go outside.
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.
Fixed.
022e109 to
eb72725
Compare
b0890c4 to
61533db
Compare
1578d8c to
a7343fb
Compare
src/js/tabs/pid_tuning.js
Outdated
|
|
||
| MSP.promise(MSPCodes.MSP_SET_RESET_CURR_PID).then(() => { | ||
| if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) { | ||
| MSP.promise(MSPCodes.MSP_EEPROM_WRITE).then(() => { |
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.
What is the reason that we are executing an immediate save operation after this?
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.
Now changing a slider go to another tab and come back to pidtuning it's as from the start (unsaved changes are lost).
Saving values here because as long settings are not saved configurator thinks (see next paragraph) they are changed - until the FC reboots (unsaved changes are retained until reboot and then lost - which could lead to surprises in the field).
Doing the refresh resets variables holding user changes to reset the state without saving. So perhaps I could store and retrieve those variables instead but I need to know if the board has the same unique identifier as the user could switch board instead.
With firmware sliders we are writing new sliders values to firmware and retrieve the calculated pids. Also have thought about having a temp profile in firmware instead which will be copied to the active profile at the moment user updates (save) configuration.
Observation: MSP_SET_RESET_CURR_PID is not resetting the Gyro Filter.
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.
The problems that I can see with this are:
- it is unexpected to the user that we save settings outside of clicking 'Save';
- the proposed behaviour is inconsistent for different firmware versions;
- this is even more confusing if a TX is connected at the same time and the user is switching profiles through the TX, triggering saves in configurator.
So I think a better way would be to revert to the old behaviour of just discarding the changes (now probably requiring a restoreInitialSettings` on PID profile changes).
Also, the gyro filter is not part of the PID profile, so there is no reason it should be linked in any way to the PID profile functionality.
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.
Found a way ;-)
Have removed the tooltip for the button as it's no longer needed. Now it behaves as before.
initialSettings were overwritten on tab reload, but now have added another flag to workaround.
Thanks for letting me solve this puzzle.
3767fc8 to
8e3cfd7
Compare
439dfa3 to
f3a1c51
Compare
f3a1c51 to
48659bd
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
|
Finished debugging |
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.
MSP_SET_RESET_CURR_PID looks much better now - thanks.
I think the direct access to document. should be replaced with JQuery to retain consistency - no reason to mix approaches here. And condition should be getting a better name. But these can be done after mergeing, so that we can get wider testing of this.
| $('.tab-pid_tuning .MasterSlider').toggle(this.expertMode); | ||
| $('.tab-pid_tuning .DMinRatioSlider').toggle(this.expertMode && dMinShow); | ||
| $('.tab-pid_tuning .advancedSlider').toggle(this.expertMode); | ||
| document.getElementById('sliderDMaxGain').disabled = !this.expertMode; |
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.
Why are we doing direct DOM manipulation here? We are using JQuery everywhere else in the legacy code, so we should be doing this here as well.
| const WARNING_DMAX_GAIN = 60; | ||
| const WARNING_DMIN_GAIN = 40; | ||
| let WARNING_DMIN_GAIN = 40; | ||
| let condition; |
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.
A more descriptive name of what the condition means will make this easier to understand.








Changes:
🏷️ Depends on: betaflight/betaflight#10919
Credits to @spatzengr and @ctzsnooze for providing text for the tooltips and slider labels.
I have worked together with @ctzsnooze at some point.