Remove VBat PID Compensation

Some api version check fixes

Remove blanck line

More api version fixes

Remove extra parentesix

Removing more parentexis

Rebase fixing
10.8-maintenance
Asizon 2020-07-06 18:49:19 +02:00
parent c59f49d160
commit d2ef89b6a3
3 changed files with 117 additions and 121 deletions

View File

@ -1095,6 +1095,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
FC.ADVANCED_TUNING_ACTIVE = { ...FC.ADVANCED_TUNING };
break;
case MSPCodes.MSP_PID_ADVANCED:
if (semver.gte(FC.CONFIG.apiVersion, "1.16.0")) {
FC.ADVANCED_TUNING.rollPitchItermIgnoreRate = data.readU16();
FC.ADVANCED_TUNING.yawItermIgnoreRate = data.readU16();
FC.ADVANCED_TUNING.yaw_p_limit = data.readU16();
@ -1167,6 +1168,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
}
}
}
}
FC.ADVANCED_TUNING_ACTIVE = { ...FC.ADVANCED_TUNING };
break;
case MSPCodes.MSP_SENSOR_CONFIG:
@ -2035,19 +2037,19 @@ MspHelper.prototype.crunch = function(code) {
}
break;
case MSPCodes.MSP_SET_PID_ADVANCED:
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
if (semver.gte(FC.CONFIG.apiVersion, "1.16.0")) {
buffer.push16(FC.ADVANCED_TUNING.rollPitchItermIgnoreRate)
.push16(FC.ADVANCED_TUNING.yawItermIgnoreRate)
.push16(FC.ADVANCED_TUNING.yaw_p_limit)
.push8(FC.ADVANCED_TUNING.deltaMethod)
.push8(FC.ADVANCED_TUNING.vbatPidCompensation);
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
if (semver.gte(FC.CONFIG.apiVersion, "1.40.0")) {
buffer.push8(FC.ADVANCED_TUNING.feedforwardTransition);
} else {
buffer.push8(FC.ADVANCED_TUNING.dtermSetpointTransition);
}
buffer.push8(Math.min(FC.ADVANCED_TUNING.dtermSetpointWeight, 254))
.push8(FC.ADVANCED_TUNING.toleranceBand)
.push8(FC.ADVANCED_TUNING.toleranceBandReduction)
@ -2110,13 +2112,6 @@ MspHelper.prototype.crunch = function(code) {
}
}
}
// only supports 1 version pre bf 3.0
else {
buffer.push16(FC.ADVANCED_TUNING.rollPitchItermIgnoreRate)
.push16(FC.ADVANCED_TUNING.yawItermIgnoreRate)
.push16(FC.ADVANCED_TUNING.yaw_p_limit)
.push8(FC.ADVANCED_TUNING.deltaMethod)
.push8(FC.ADVANCED_TUNING.vbatPidCompensation);
}
break;
case MSPCodes.MSP_SET_SENSOR_CONFIG:

View File

@ -64,6 +64,8 @@ TABS.pid_tuning.initialize = function (callback) {
$('#content').load("./tabs/pid_tuning.html", process_html);
}
const vbatpidcompensationIsUsed = semver.gte(FC.CONFIG.apiVersion, "1.16.0") && semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44);
function pid_and_rc_to_form() {
self.setProfile();
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
@ -106,9 +108,8 @@ TABS.pid_tuning.initialize = function (callback) {
$('.pid_tuning input[name="rc_expo"]').attr("rowspan", "3");
}
if (semver.gte(FC.CONFIG.apiVersion, "1.16.0")) {
$('.vbatpidcompensation').toggle(vbatpidcompensationIsUsed);
$('input[id="vbatpidcompensation"]').prop('checked', FC.ADVANCED_TUNING.vbatPidCompensation !== 0);
}
if (semver.gte(FC.CONFIG.apiVersion, "1.16.0")) {
$('#pid-tuning .delta select').val(FC.ADVANCED_TUNING.deltaMethod);
@ -822,7 +823,7 @@ TABS.pid_tuning.initialize = function (callback) {
FC.FILTER_CONFIG.dterm_lowpass_hz = parseInt($('.pid_filter input[name="dtermLowpassFrequency"]').val());
FC.FILTER_CONFIG.yaw_lowpass_hz = parseInt($('.pid_filter input[name="yawLowpassFrequency"]').val());
if (semver.gte(FC.CONFIG.apiVersion, "1.16.0")) {
if (vbatpidcompensationIsUsed) {
const element = $('input[id="vbatpidcompensation"]');
const value = element.is(':checked') ? 1 : 0;
let analyticsValue = undefined;

View File

@ -588,7 +588,7 @@
</td>
</tr>
<tr>
<tr class="vbatpidcompensation">
<td><input type="checkbox" id="vbatpidcompensation" class="toggle" /></td>
<td colspan="2">
<span i18n="pidTuningVbatPidCompensation"></span>