Implement version checking part 2
parent
c7d89ed710
commit
a116ce6b05
13
js/msp.js
13
js/msp.js
|
@ -1439,12 +1439,19 @@ MSP.crunch = function (code) {
|
|||
case MSP_codes.MSP_SET_ADVANCED_TUNING:
|
||||
buffer.push16(ADVANCED_TUNING.rollPitchItermIgnoreRate)
|
||||
.push16(ADVANCED_TUNING.yawItermIgnoreRate)
|
||||
.push16(ADVANCED_TUNING.yaw_p_limit)
|
||||
.push8(ADVANCED_TUNING.deltaMethod)
|
||||
.push8(ADVANCED_TUNING.vbatPidCompensation);
|
||||
.push16(ADVANCED_TUNING.yaw_p_limit);
|
||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
|
||||
buffer.push(ADVANCED_TUNING.deltaMethod)
|
||||
buffer.push(ADVANCED_TUNING.vbatPidCompensation);
|
||||
}
|
||||
break;
|
||||
case MSP_codes.MSP_SET_SPECIAL_PARAMETERS:
|
||||
buffer.push(Math.round(SPECIAL_PARAMETERS.RC_RATE_YAW * 100));
|
||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
|
||||
buffer.push(SPECIAL_PARAMETERS.airModeActivateThreshold);
|
||||
buffer.push(SPECIAL_PARAMETERS.rcSmoothInterval);
|
||||
buffer.push(SPECIAL_PARAMETERS.escDesyncProtection);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -185,7 +185,11 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
$('.pid_filter .gyro').val(FILTER_CONFIG.gyro_soft_lpf_hz);
|
||||
$('.pid_filter .dterm').val(FILTER_CONFIG.dterm_lpf_hz);
|
||||
$('.pid_filter .yaw').val(FILTER_CONFIG.yaw_lpf_hz);
|
||||
|
||||
|
||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.lt(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||
$('.pid_filter').hide();
|
||||
$('.pid_tuning input[name="rc_rate_yaw"]').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function form_to_pid_and_rc() {
|
||||
|
@ -424,9 +428,13 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
});
|
||||
|
||||
$('.delta select').val(ADVANCED_TUNING.deltaMethod).change(function() {
|
||||
ADVANCED_TUNING.deltaMethod = $(this).val();
|
||||
ADVANCED_TUNING.deltaMethod = $(this).val();
|
||||
});
|
||||
|
||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.lt(CONFIG.flightControllerVersion, "2.8.2")) {
|
||||
$('.delta').hide();
|
||||
}
|
||||
|
||||
// update == save.
|
||||
$('a.update').click(function () {
|
||||
form_to_pid_and_rc();
|
||||
|
@ -442,13 +450,17 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
if (TABS.pid_tuning.controllerChanged) { return; }
|
||||
MSP.promise(MSP_codes.MSP_SET_PID, MSP.crunch(MSP_codes.MSP_SET_PID)).then(function() {
|
||||
if (TABS.pid_tuning.controllerChanged) { Promise.reject('pid controller changed'); }
|
||||
return MSP.promise(MSP_codes.MSP_SET_SPECIAL_PARAMETERS, MSP.crunch(MSP_codes.MSP_SET_SPECIAL_PARAMETERS));
|
||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||
return MSP.promise(MSP_codes.MSP_SET_SPECIAL_PARAMETERS, MSP.crunch(MSP_codes.MSP_SET_SPECIAL_PARAMETERS));
|
||||
}
|
||||
}).then(function() {
|
||||
if (TABS.pid_tuning.controllerChanged) { Promise.reject('pid controller changed'); }
|
||||
return MSP.promise(MSP_codes.MSP_SET_ADVANCED_TUNING, MSP.crunch(MSP_codes.MSP_SET_ADVANCED_TUNING));
|
||||
}).then(function() {
|
||||
if (TABS.pid_tuning.controllerChanged) { Promise.reject('pid controller changed'); }
|
||||
return MSP.promise(MSP_codes.MSP_SET_FILTER_CONFIG, MSP.crunch(MSP_codes.MSP_SET_FILTER_CONFIG));
|
||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||
return MSP.promise(MSP_codes.MSP_SET_FILTER_CONFIG, MSP.crunch(MSP_codes.MSP_SET_FILTER_CONFIG));
|
||||
}
|
||||
}).then(function() {
|
||||
return MSP.promise(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING));
|
||||
}).then(function() {
|
||||
|
|
Loading…
Reference in New Issue