1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 00:35:26 +03:00

Merge pull request #2218 from klutvott123/add-thrust-linear

Add Thrust Linearization
This commit is contained in:
Michael Keller 2020-10-14 02:06:43 +13:00 committed by GitHub
commit 21429db518
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 1 deletions

View file

@ -466,6 +466,7 @@ const FC = {
ff_smooth_factor: 0,
ff_boost: 0,
vbat_sag_compensation: 0,
thrustLinearization: 0,
};
this.ADVANCED_TUNING_ACTIVE = { ...this.ADVANCED_TUNING };

View file

@ -1166,6 +1166,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
FC.ADVANCED_TUNING.ff_smooth_factor = data.readU8();
FC.ADVANCED_TUNING.ff_boost = data.readU8();
FC.ADVANCED_TUNING.vbat_sag_compensation = data.readU8();
FC.ADVANCED_TUNING.thrustLinearization = data.readU8();
}
}
}
@ -2112,7 +2113,8 @@ MspHelper.prototype.crunch = function(code) {
buffer.push8(FC.ADVANCED_TUNING.ff_interpolate_sp)
.push8(FC.ADVANCED_TUNING.ff_smooth_factor)
.push8(FC.ADVANCED_TUNING.ff_boost)
.push8(FC.ADVANCED_TUNING.vbat_sag_compensation);
.push8(FC.ADVANCED_TUNING.vbat_sag_compensation)
.push8(FC.ADVANCED_TUNING.thrustLinearization);
}
}
}

View file

@ -483,9 +483,21 @@ TABS.pid_tuning.initialize = function (callback) {
const checked = $(this).is(':checked');
$('.vbatSagCompensation .suboption').toggle(checked);
}).change();
// Thrust Linearization
const thrustLinearizationCheck = $('input[id="thrustLinearization"]');
thrustLinearizationCheck.prop('checked', FC.ADVANCED_TUNING.thrustLinearization !== 0);
$('input[name="thrustLinearValue"]').val(FC.ADVANCED_TUNING.thrustLinearization > 0 ? FC.ADVANCED_TUNING.thrustLinearization : 20);
thrustLinearizationCheck.change(function() {
const checked = $(this).is(':checked');
$('.thrustLinearization .suboption').toggle(checked);
}).change();
} else {
$('.ffInterpolateSp').hide();
$('.vbatSagCompensation').hide();
$('.thrustLinearization').hide();
}
$('input[id="useIntegratedYaw"]').change(function() {
@ -955,6 +967,7 @@ TABS.pid_tuning.initialize = function (callback) {
FC.ADVANCED_TUNING.ff_boost = parseInt($('input[name="ffBoost"]').val());
FC.FILTER_CONFIG.dyn_lpf_curve_expo = parseInt($('.pid_filter input[name="dtermLowpassDynExpo"]').val());
FC.ADVANCED_TUNING.vbat_sag_compensation = $('input[id="vbatSagCompensation"]').is(':checked') ? parseInt($('input[name="vbatSagValue"]').val()) : 0;
FC.ADVANCED_TUNING.thrustLinearization = $('input[id="thrustLinearization"]').is(':checked') ? parseInt($('input[name="thrustLinearValue"]').val()) : 0;
}
}