mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-16 12:55:14 +03:00
Add Vbat Sag Compensation to UI
Remove empty white line Improve ff and vbatSag functions change events Tooltip reviewing
This commit is contained in:
parent
ea880840a8
commit
18e84746e5
5 changed files with 41 additions and 3 deletions
|
@ -3638,6 +3638,15 @@
|
|||
"pidTuningVbatPidCompensationHelp": {
|
||||
"message": "Increases the PID values to compensate when Vbat gets lower. This will give more constant flight characteristics throughout the flight. The amount of compensation that is applied is calculated from the $t(powerBatteryMaximum.message) set in the $t(tabPower.message) page, so make sure that is set to something appropriate."
|
||||
},
|
||||
"pidTuningVbatSagCompensation": {
|
||||
"message": "Vbat Sag Compensation"
|
||||
},
|
||||
"pidTuningVbatSagCompensationHelp": {
|
||||
"message": "Gives consistent throttle and PID performance over the usable battery voltage range by compensating for battery sag. The amount of compensation can be varied between 0 and 100%. Full compensation (100%) is recommended.<br><br>Visit <a href=\"https://github.com/betaflight/betaflight/wiki/4.2-Tuning-Notes#dynamic-battery-sag-compensation\"target=\"_blank\" rel=\"noopener noreferrer\">this wiki entry</a> for more info."
|
||||
},
|
||||
"pidTuningVbatSagValue": {
|
||||
"message": "%"
|
||||
},
|
||||
"pidTuningItermRotation": {
|
||||
"message": "I Term Rotation"
|
||||
},
|
||||
|
|
|
@ -461,6 +461,7 @@ var FC = {
|
|||
ff_interpolate_sp: 0,
|
||||
ff_smooth_factor: 0,
|
||||
ff_boost: 0,
|
||||
vbat_sag_compensation: 0,
|
||||
};
|
||||
ADVANCED_TUNING_ACTIVE = { ...ADVANCED_TUNING };
|
||||
|
||||
|
|
|
@ -1157,6 +1157,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
ADVANCED_TUNING.ff_interpolate_sp = data.readU8();
|
||||
ADVANCED_TUNING.ff_smooth_factor = data.readU8();
|
||||
ADVANCED_TUNING.ff_boost = data.readU8();
|
||||
ADVANCED_TUNING.vbat_sag_compensation = data.readU8();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2096,7 +2097,8 @@ MspHelper.prototype.crunch = function(code) {
|
|||
if(semver.gte(CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||
buffer.push8(ADVANCED_TUNING.ff_interpolate_sp)
|
||||
.push8(ADVANCED_TUNING.ff_smooth_factor)
|
||||
.push8(ADVANCED_TUNING.ff_boost);
|
||||
.push8(ADVANCED_TUNING.ff_boost)
|
||||
.push8(ADVANCED_TUNING.vbat_sag_compensation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -448,11 +448,21 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
ffInterpolateCheck.change(function() {
|
||||
const checked = $(this).is(':checked');
|
||||
$('.ffInterpolateSp .suboption').toggle(checked);
|
||||
});
|
||||
ffInterpolateCheck.change();
|
||||
}).change();
|
||||
|
||||
// Vbat Sag Compensation
|
||||
const vbatSagCompensationCheck = $('input[id="vbatSagCompensation"]');
|
||||
|
||||
vbatSagCompensationCheck.prop('checked', ADVANCED_TUNING.vbat_sag_compensation !== 0);
|
||||
$('input[name="vbatSagValue"]').val(ADVANCED_TUNING.vbat_sag_compensation > 0 ? ADVANCED_TUNING.vbat_sag_compensation : 100);
|
||||
|
||||
vbatSagCompensationCheck.change(function() {
|
||||
const checked = $(this).is(':checked');
|
||||
$('.vbatSagCompensation .suboption').toggle(checked);
|
||||
}).change();
|
||||
} else {
|
||||
$('.ffInterpolateSp').hide();
|
||||
$('.vbatSagCompensation').hide();
|
||||
}
|
||||
|
||||
$('input[id="useIntegratedYaw"]').change(function() {
|
||||
|
@ -921,6 +931,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
ADVANCED_TUNING.ff_smooth_factor = parseInt($('input[name="ffSmoothFactor"]').val());
|
||||
ADVANCED_TUNING.ff_boost = parseInt($('input[name="ffBoost"]').val());
|
||||
FILTER_CONFIG.dyn_lpf_curve_expo = parseInt($('.pid_filter input[name="dtermLowpassDynExpo"]').val());
|
||||
ADVANCED_TUNING.vbat_sag_compensation = $('input[id="vbatSagCompensation"]').is(':checked') ? parseInt($('input[name="vbatSagValue"]').val()) : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -573,6 +573,21 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="vbatSagCompensation">
|
||||
<td><input type="checkbox" id="vbatSagCompensation" class="toggle" /></td>
|
||||
<td colspan="2">
|
||||
<span i18n="pidTuningVbatSagCompensation"></span>
|
||||
<div class="helpicon cf_tip" i18n_title="pidTuningVbatSagCompensationHelp"></div>
|
||||
|
||||
<span class="vbatSagValue suboption">
|
||||
<input type="number" name="vbatSagValue" step="1" min="1" max="150" />
|
||||
<label for="vbatSagValue">
|
||||
<span i18n="pidTuningVbatSagValue"></span>
|
||||
</label>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="smartfeedforward">
|
||||
<td><input type="checkbox" id="smartfeedforward" class="toggle" /></td>
|
||||
<td colspan="2">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue