mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-16 21:05:30 +03:00
Rename sliders FF to feedforward
This commit is contained in:
parent
5fb3007a17
commit
68dd5dd902
5 changed files with 30 additions and 30 deletions
|
@ -8,7 +8,7 @@ const TuningSliders = {
|
|||
sliderPDRatio: 1,
|
||||
sliderPDGain: 1,
|
||||
sliderDMinRatio: 1,
|
||||
sliderFFGain: 1,
|
||||
sliderFeedforwardGain: 1,
|
||||
pidSlidersUnavailable: false,
|
||||
GyroSliderUnavailable: false,
|
||||
DTermSliderUnavailable: false,
|
||||
|
@ -106,7 +106,7 @@ TuningSliders.initPidSlidersPosition = function() {
|
|||
} else {
|
||||
this.sliderPDGain = Math.round(FC.PIDS[0][0] / this.sliderMasterMultiplier / (this.PID_DEFAULT[2] * (1 / D_MIN_RATIO)) * 10) / 10;
|
||||
}
|
||||
this.sliderFFGain = Math.round(FC.ADVANCED_TUNING.feedforwardRoll / this.sliderMasterMultiplier / this.PID_DEFAULT[4] * 10) / 10;
|
||||
this.sliderFeedforwardGain = Math.round(FC.ADVANCED_TUNING.feedforwardRoll / this.sliderMasterMultiplier / this.PID_DEFAULT[4] * 10) / 10;
|
||||
} else {
|
||||
this.sliderPidsMode = FC.TUNING_SLIDERS.slider_pids_mode;
|
||||
this.sliderMasterMultiplier = FC.TUNING_SLIDERS.slider_master_multiplier / 100;
|
||||
|
@ -115,7 +115,7 @@ TuningSliders.initPidSlidersPosition = function() {
|
|||
this.sliderPDRatio = FC.TUNING_SLIDERS.slider_pd_ratio / 100;
|
||||
this.sliderPDGain = FC.TUNING_SLIDERS.slider_pd_gain / 100;
|
||||
this.sliderDMinRatio = FC.TUNING_SLIDERS.slider_dmin_ratio / 100;
|
||||
this.sliderFFGain = FC.TUNING_SLIDERS.slider_ff_gain / 100;
|
||||
this.sliderFeedforwardGain = FC.TUNING_SLIDERS.slider_feedforward_gain / 100;
|
||||
}
|
||||
|
||||
$('output[name="sliderMasterMultiplier-number"]').val(this.sliderMasterMultiplier);
|
||||
|
@ -124,7 +124,7 @@ TuningSliders.initPidSlidersPosition = function() {
|
|||
$('output[name="sliderPDRatio-number"]').val(this.sliderPDRatio);
|
||||
$('output[name="sliderPDGain-number"]').val(this.sliderPDGain);
|
||||
$('output[name="sliderDMinRatio-number"]').val(this.sliderDMinRatio);
|
||||
$('output[name="sliderFFGain-number"]').val(this.sliderFFGain);
|
||||
$('output[name="sliderFeedforwardGain-number"]').val(this.sliderFeedforwardGain);
|
||||
|
||||
$('#sliderMasterMultiplier').val(this.downscaleSliderValue(this.sliderMasterMultiplier));
|
||||
$('#sliderRollPitchRatio').val(this.downscaleSliderValue(this.sliderRollPitchRatio));
|
||||
|
@ -132,7 +132,7 @@ TuningSliders.initPidSlidersPosition = function() {
|
|||
$('#sliderPDRatio').val(this.downscaleSliderValue(this.sliderPDRatio));
|
||||
$('#sliderPDGain').val(this.downscaleSliderValue(this.sliderPDGain));
|
||||
$('#sliderDMinRatio').val(this.downscaleSliderValue(this.sliderDMinRatio));
|
||||
$('#sliderFFGain').val(this.downscaleSliderValue(this.sliderFFGain));
|
||||
$('#sliderFeedforwardGain').val(this.downscaleSliderValue(this.sliderFeedforwardGain));
|
||||
};
|
||||
|
||||
TuningSliders.initGyroFilterSliderPosition = function() {
|
||||
|
@ -169,14 +169,14 @@ TuningSliders.resetPidSliders = function() {
|
|||
this.sliderPDRatio = 1;
|
||||
this.sliderPDGain = 1;
|
||||
this.sliderDMinRatio = 1;
|
||||
this.sliderFFGain = 1;
|
||||
this.sliderFeedforwardGain = 1;
|
||||
}
|
||||
|
||||
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||
$('#sliderMasterMultiplier').val(this.downscaleSliderValue(this.sliderMasterMultiplier));
|
||||
$('#sliderPDRatio').val(this.downscaleSliderValue(this.sliderPDRatio));
|
||||
$('#sliderPDGain').val(this.downscaleSliderValue(this.sliderPDGain));
|
||||
$('#sliderFFGain').val(this.downscaleSliderValue(this.sliderFFGain));
|
||||
$('#sliderFeedforwardGain').val(this.downscaleSliderValue(this.sliderFeedforwardGain));
|
||||
} else {
|
||||
this.initPidSlidersPosition();
|
||||
}
|
||||
|
@ -393,14 +393,14 @@ TuningSliders.updateFormPids = function(updateSlidersOnly = false) {
|
|||
$('output[name="sliderPDRatio-number"]').val(this.sliderPDRatio);
|
||||
$('output[name="sliderPDGain-number"]').val(this.sliderPDGain);
|
||||
$('output[name="sliderDMinRatio-number"]').val(this.sliderDMinRatio);
|
||||
$('output[name="sliderFFGain-number"]').val(this.sliderFFGain);
|
||||
$('output[name="sliderFeedforwardGain-number"]').val(this.sliderFeedforwardGain);
|
||||
|
||||
};
|
||||
|
||||
TuningSliders.legacyCalculatePids = function(updateSlidersOnly = false) {
|
||||
const MAX_PID_GAIN = 200;
|
||||
const MAX_DMIN_GAIN = 100;
|
||||
const MAX_FF_GAIN = 2000;
|
||||
const MAX_FEEDFORWARD_GAIN = 2000;
|
||||
|
||||
// only used for 4.1 where calculation is not done in firmware
|
||||
if (this.dMinFeatureEnabled) {
|
||||
|
@ -420,10 +420,10 @@ TuningSliders.legacyCalculatePids = function(updateSlidersOnly = false) {
|
|||
FC.PIDS[0][0] = Math.round(this.PID_DEFAULT[0] * this.sliderPDGain);
|
||||
FC.PIDS[1][0] = Math.round(this.PID_DEFAULT[5] * this.sliderPDGain);
|
||||
FC.PIDS[2][0] = Math.round(this.PID_DEFAULT[10] * this.sliderPDGain);
|
||||
// ff
|
||||
FC.ADVANCED_TUNING.feedforwardRoll = Math.round(this.PID_DEFAULT[4] * this.sliderFFGain);
|
||||
FC.ADVANCED_TUNING.feedforwardPitch = Math.round(this.PID_DEFAULT[9] * this.sliderFFGain);
|
||||
FC.ADVANCED_TUNING.feedforwardYaw = Math.round(this.PID_DEFAULT[14] * this.sliderFFGain);
|
||||
// feedforward
|
||||
FC.ADVANCED_TUNING.feedforwardRoll = Math.round(this.PID_DEFAULT[4] * this.sliderFeedforwardGain);
|
||||
FC.ADVANCED_TUNING.feedforwardPitch = Math.round(this.PID_DEFAULT[9] * this.sliderFeedforwardGain);
|
||||
FC.ADVANCED_TUNING.feedforwardYaw = Math.round(this.PID_DEFAULT[14] * this.sliderFeedforwardGain);
|
||||
// master slider part
|
||||
// these are not calculated anywhere other than master slider multiplier therefore set at default before every calculation
|
||||
FC.PIDS[0][1] = this.PID_DEFAULT[1];
|
||||
|
@ -440,9 +440,9 @@ TuningSliders.legacyCalculatePids = function(updateSlidersOnly = false) {
|
|||
}
|
||||
}
|
||||
|
||||
FC.ADVANCED_TUNING.feedforwardRoll = Math.min(Math.round(FC.ADVANCED_TUNING.feedforwardRoll * this.sliderMasterMultiplier), MAX_FF_GAIN);
|
||||
FC.ADVANCED_TUNING.feedforwardPitch = Math.min(Math.round(FC.ADVANCED_TUNING.feedforwardPitch * this.sliderMasterMultiplier), MAX_FF_GAIN);
|
||||
FC.ADVANCED_TUNING.feedforwardYaw = Math.min(Math.round(FC.ADVANCED_TUNING.feedforwardYaw * this.sliderMasterMultiplier), MAX_FF_GAIN);
|
||||
FC.ADVANCED_TUNING.feedforwardRoll = Math.min(Math.round(FC.ADVANCED_TUNING.feedforwardRoll * this.sliderMasterMultiplier), MAX_FEEDFORWARD_GAIN);
|
||||
FC.ADVANCED_TUNING.feedforwardPitch = Math.min(Math.round(FC.ADVANCED_TUNING.feedforwardPitch * this.sliderMasterMultiplier), MAX_FEEDFORWARD_GAIN);
|
||||
FC.ADVANCED_TUNING.feedforwardYaw = Math.min(Math.round(FC.ADVANCED_TUNING.feedforwardYaw * this.sliderMasterMultiplier), MAX_FEEDFORWARD_GAIN);
|
||||
|
||||
if (this.dMinFeatureEnabled) {
|
||||
FC.ADVANCED_TUNING.dMinRoll = Math.min(Math.round(FC.ADVANCED_TUNING.dMinRoll * this.sliderMasterMultiplier), MAX_DMIN_GAIN);
|
||||
|
@ -471,7 +471,7 @@ TuningSliders.calculateNewPids = function(updateSlidersOnly = false) {
|
|||
FC.TUNING_SLIDERS.slider_pd_ratio = Math.round(this.sliderPDRatio * 20) * 5;
|
||||
FC.TUNING_SLIDERS.slider_pd_gain = Math.round(this.sliderPDGain * 20) * 5;
|
||||
FC.TUNING_SLIDERS.slider_dmin_ratio = Math.round(this.sliderDMinRatio * 20) * 5;
|
||||
FC.TUNING_SLIDERS.slider_ff_gain = Math.round(this.sliderFFGain * 20) * 5;
|
||||
FC.TUNING_SLIDERS.slider_feedforward_gain = Math.round(this.sliderFeedforwardGain * 20) * 5;
|
||||
|
||||
MSP.promise(MSPCodes.MSP_SET_TUNING_SLIDERS, mspHelper.crunch(MSPCodes.MSP_SET_TUNING_SLIDERS))
|
||||
.then(() => MSP.promise(MSPCodes.MSP_PID))
|
||||
|
|
|
@ -662,7 +662,7 @@ const FC = {
|
|||
slider_pd_ratio: 0,
|
||||
slider_pd_gain: 0,
|
||||
slider_dmin_ratio: 0,
|
||||
slider_ff_gain: 0,
|
||||
slider_feedforward_gain: 0,
|
||||
slider_dterm_filter: 0,
|
||||
slider_dterm_filter_multiplier: 0,
|
||||
slider_gyro_filter: 0,
|
||||
|
|
|
@ -1491,7 +1491,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
FC.TUNING_SLIDERS.slider_pd_ratio = data.readU8();
|
||||
FC.TUNING_SLIDERS.slider_pd_gain = data.readU8();
|
||||
FC.TUNING_SLIDERS.slider_dmin_ratio = data.readU8();
|
||||
FC.TUNING_SLIDERS.slider_ff_gain = data.readU8();
|
||||
FC.TUNING_SLIDERS.slider_feedforward_gain = data.readU8();
|
||||
FC.TUNING_SLIDERS.slider_dterm_filter = data.readU8();
|
||||
FC.TUNING_SLIDERS.slider_dterm_filter_multiplier = data.readU8();
|
||||
FC.TUNING_SLIDERS.slider_gyro_filter = data.readU8();
|
||||
|
@ -2310,7 +2310,7 @@ MspHelper.prototype.crunch = function(code) {
|
|||
.push8(FC.TUNING_SLIDERS.slider_pd_ratio)
|
||||
.push8(FC.TUNING_SLIDERS.slider_pd_gain)
|
||||
.push8(FC.TUNING_SLIDERS.slider_dmin_ratio)
|
||||
.push8(FC.TUNING_SLIDERS.slider_ff_gain)
|
||||
.push8(FC.TUNING_SLIDERS.slider_feedforward_gain)
|
||||
.push8(FC.TUNING_SLIDERS.slider_dterm_filter)
|
||||
.push8(FC.TUNING_SLIDERS.slider_dterm_filter_multiplier)
|
||||
.push8(FC.TUNING_SLIDERS.slider_gyro_filter)
|
||||
|
|
|
@ -1025,7 +1025,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
FC.TUNING_SLIDERS.slider_pd_ratio = Math.round(TuningSliders.sliderPDRatio * 20) * 5;
|
||||
FC.TUNING_SLIDERS.slider_pd_gain = Math.round(TuningSliders.sliderPDGain * 20) * 5;
|
||||
FC.TUNING_SLIDERS.slider_dmin_ratio = Math.round(TuningSliders.sliderDMinRatio * 20) * 5;
|
||||
FC.TUNING_SLIDERS.slider_ff_gain = Math.round(TuningSliders.sliderFFGain * 20) * 5;
|
||||
FC.TUNING_SLIDERS.slider_feedforward_gain = Math.round(TuningSliders.sliderFeedforwardGain * 20) * 5;
|
||||
|
||||
FC.TUNING_SLIDERS.slider_dterm_filter = TuningSliders.sliderDTermFilter ? 1 : 0;
|
||||
FC.TUNING_SLIDERS.slider_dterm_filter_multiplier = Math.round(TuningSliders.sliderDTermFilterMultiplier * 20) * 5;
|
||||
|
@ -1875,11 +1875,11 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
|
||||
let allPidTuningSliders;
|
||||
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||
allPidTuningSliders = $('#sliderMasterMultiplier, #sliderPDRatio, #sliderPDGain, #sliderFFGain');
|
||||
allPidTuningSliders = $('#sliderMasterMultiplier, #sliderPDRatio, #sliderPDGain, #sliderFeedforwardGain');
|
||||
$('.tab-pid_tuning .advancedSlider').hide();
|
||||
$('.tab-pid_tuning .sliderMode').hide();
|
||||
} else {
|
||||
allPidTuningSliders = $('#sliderMasterMultiplier, #sliderRollPitchRatio, #sliderIGain, #sliderPDRatio, #sliderPDGain, #sliderDMinRatio, #sliderFFGain');
|
||||
allPidTuningSliders = $('#sliderMasterMultiplier, #sliderRollPitchRatio, #sliderIGain, #sliderPDRatio, #sliderPDGain, #sliderDMinRatio, #sliderFeedforwardGain');
|
||||
$('.tab-pid-tuning .baseSlider').show();
|
||||
$('.tab-pid-tuning .MasterSlider').show();
|
||||
}
|
||||
|
@ -1912,8 +1912,8 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
TuningSliders.sliderPDGain = scaledValue;
|
||||
} else if (slider.is('#sliderDMinRatio')) {
|
||||
TuningSliders.sliderDMinRatio = scaledValue;
|
||||
} else if (slider.is('#sliderFFGain')) {
|
||||
TuningSliders.sliderFFGain = scaledValue;
|
||||
} else if (slider.is('#sliderFeedforwardGain')) {
|
||||
TuningSliders.sliderFeedforwardGain = scaledValue;
|
||||
}
|
||||
TuningSliders.calculateNewPids();
|
||||
self.analyticsChanges['PidTuningSliders'] = "On";
|
||||
|
@ -1941,8 +1941,8 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
TuningSliders.sliderPDGain = 1;
|
||||
} else if (slider.is('#sliderDMinRatio')) {
|
||||
TuningSliders.sliderDMinRatio = 1;
|
||||
} else if (slider.is('#sliderFFGain')) {
|
||||
TuningSliders.sliderFFGain = 1;
|
||||
} else if (slider.is('#sliderFeedforwardGain')) {
|
||||
TuningSliders.sliderFeedforwardGain = 1;
|
||||
}
|
||||
TuningSliders.calculateNewPids();
|
||||
TuningSliders.updatePidSlidersDisplay();
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
<th class="feedforward">
|
||||
<div class="name-helpicon-flex">
|
||||
<div i18n="pidTuningFeedforward" class="sm-min"></div>
|
||||
<div class="xs">FF</div>
|
||||
<div class="xs">Feedforward</div>
|
||||
<div class="helpicon cf_tip" i18n_title="pidTuningFeedforwardHelp"></div>
|
||||
</div>
|
||||
</th>
|
||||
|
@ -236,10 +236,10 @@
|
|||
<span i18n="pidTuningResponseSlider"/>
|
||||
</td>
|
||||
<td>
|
||||
<output type="number" name="sliderFFGain-number"></output>
|
||||
<output type="number" name="sliderFeedforwardGain-number"></output>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<input type="range" min="0.5" max="1.5" step="0.025" class="tuningSlider" id="sliderFFGain" />
|
||||
<input type="range" min="0.5" max="1.5" step="0.025" class="tuningSlider" id="sliderFeedforwardGain" />
|
||||
</td>
|
||||
<td>
|
||||
<div class="helpicon cf_tip" i18n_title="pidTuningResponseSliderHelp"></div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue