Merge pull request #1034 from Cleric-K/dterm-sp-weight-tooltip

Dterm Setpoint Weight tooltip update
10.3.x-maintenance
Michael Keller 2018-06-07 23:38:30 +12:00 committed by GitHub
commit e3b77bc6c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 7 deletions

View File

@ -864,6 +864,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
ADVANCED_TUNING.itermThrottleThreshold = data.readU16();
ADVANCED_TUNING.itermAcceleratorGain = data.readU16();
}
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
ADVANCED_TUNING.dtermSetpointWeight = data.readU16();
}
}
break;
case MSPCodes.MSP_SENSOR_CONFIG:
@ -1479,7 +1482,7 @@ MspHelper.prototype.crunch = function(code) {
.push8(ADVANCED_TUNING.deltaMethod)
.push8(ADVANCED_TUNING.vbatPidCompensation)
.push8(ADVANCED_TUNING.dtermSetpointTransition)
.push8(ADVANCED_TUNING.dtermSetpointWeight)
.push8(Math.min(ADVANCED_TUNING.dtermSetpointWeight, 254))
.push8(ADVANCED_TUNING.toleranceBand)
.push8(ADVANCED_TUNING.toleranceBandReduction)
.push8(ADVANCED_TUNING.itermThrottleGain)
@ -1493,6 +1496,9 @@ MspHelper.prototype.crunch = function(code) {
buffer.push16(ADVANCED_TUNING.itermThrottleThreshold)
.push16(ADVANCED_TUNING.itermAcceleratorGain);
}
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
buffer.push16(ADVANCED_TUNING.dtermSetpointWeight);
}
}
// only supports 1 version pre bf 3.0
else {

View File

@ -6,7 +6,10 @@ TABS.pid_tuning = {
updating: true,
dirty: false,
currentProfile: null,
currentRateProfile: null
currentRateProfile: null,
SETPOINT_WEIGHT_RANGE_LOW: 2.55,
SETPOINT_WEIGHT_RANGE_HIGH: 20,
SETPOINT_WEIGHT_RANGE_LEGACY: 2.54
};
TABS.pid_tuning.initialize = function (callback) {
@ -250,7 +253,8 @@ TABS.pid_tuning.initialize = function (callback) {
dtermSetpointTransitionRangeElement.val(ADVANCED_TUNING.dtermSetpointTransition / 100);
$('input[name="dtermSetpoint-number"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100);
$('input[name="dtermSetpoint-range"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100);
$('input[name="dtermSetpoint-range"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100)
.change(); // trigger adjustRangeElement()
} else {
$('.pid_filter .newFilter').hide();
}
@ -516,6 +520,11 @@ TABS.pid_tuning.initialize = function (callback) {
$('.tab-pid_tuning .pidTuningFeatures').hide();
}
if (semver.lt(CONFIG.apiVersion, "1.39.0")) {
$('input[name="dtermSetpoint-number"]').attr('max', self.SETPOINT_WEIGHT_RANGE_LEGACY);
$('input[name="dtermSetpoint-range"]').attr('max', self.SETPOINT_WEIGHT_RANGE_LEGACY);
}
// translate to user-selected language
i18n.localizePage();
@ -707,11 +716,25 @@ TABS.pid_tuning.initialize = function (callback) {
var dtermNumberElement = $('input[name="dtermSetpoint-number"]');
var dtermRangeElement = $('input[name="dtermSetpoint-range"]');
function adjustRangeElement(value) {
var range = dtermRangeElement.attr('max');
if (value >= self.SETPOINT_WEIGHT_RANGE_LOW && range <= self.SETPOINT_WEIGHT_RANGE_LOW) {
dtermRangeElement.attr('max', self.SETPOINT_WEIGHT_RANGE_HIGH);
} else if (value < self.SETPOINT_WEIGHT_RANGE_LOW && range > self.SETPOINT_WEIGHT_RANGE_LOW) {
dtermRangeElement.attr('max', self.SETPOINT_WEIGHT_RANGE_LOW);
}
}
dtermNumberElement.change(function () {
dtermRangeElement.val($(this).val());
var value = $(this).val();
adjustRangeElement(value);
dtermRangeElement.val(value);
});
dtermRangeElement.change(function () {
dtermNumberElement.val($(this).val());
var value = $(this).val();
adjustRangeElement(value);
dtermNumberElement.val(value);
});
} else {
$('.tab-pid_tuning .rate_profile').hide();

View File

@ -294,8 +294,8 @@
</td>
</tr>
<tr class="dtermSetpoint" style="height:30px;">
<td><input type="number" name="dtermSetpoint-number" step="0.01" min="0.00" max="2.54"/></td>
<td class="slider"><input type="range" name="dtermSetpoint-range" step="0.01" min="0.00" max="2.54"/></td>
<td><input type="number" name="dtermSetpoint-number" step="0.01" min="0.00" max="20"/></td>
<td class="slider"><input type="range" name="dtermSetpoint-range" step="0.01" min="0.00" max="20"/></td>
<td>
<div>
<label>