From d981bc42d5caa155623fe5cd6f219ae98f660116 Mon Sep 17 00:00:00 2001 From: mikeller Date: Sun, 14 Aug 2016 01:55:50 +1200 Subject: [PATCH] Added new filters to MSP. --- js/fc.js | 6 +++++- js/msp/MSPHelper.js | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/js/fc.js b/js/fc.js index 88f0c382..87c38273 100644 --- a/js/fc.js +++ b/js/fc.js @@ -259,7 +259,11 @@ var FC = { FILTER_CONFIG = { gyro_soft_lpf_hz: 0, dterm_lpf_hz: 0, - yaw_lpf_hz: 0 + yaw_lpf_hz: 0, + gyro_soft_notch_hz: 0, + gyro_soft_notch_cutoff: 0, + dterm_notch_hz: 0, + dterm_notch_cutoff: 0 }; ADVANCED_TUNING = { diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index 560b1982..99a06c56 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -681,6 +681,17 @@ MspHelper.prototype.process_data = function(dataHandler) { FILTER_CONFIG.dterm_lpf_hz = data.getUint16(offset, 1); offset += 2; FILTER_CONFIG.yaw_lpf_hz = data.getUint16(offset, 1); + offset += 2; + if (semver.gte(CONFIG.apiVersion, "1.20.0")) { + FILTER_CONFIG.gyro_soft_notch_hz = data.getUint16(offset, 1); + offset += 2; + FILTER_CONFIG.gyro_soft_notch_cutoff = data.getUint16(offset, 1); + offset += 2; + FILTER_CONFIG.dterm_notch_hz = data.getUint16(offset, 1); + offset += 2; + FILTER_CONFIG.dterm_notch_cutoff = data.getUint16(offset, 1); + offset += 2; + } break; case MSPCodes.MSP_PID_ADVANCED: @@ -1313,6 +1324,12 @@ MspHelper.prototype.crunch = function(code) { buffer.push8(FILTER_CONFIG.gyro_soft_lpf_hz) .push16(FILTER_CONFIG.dterm_lpf_hz) .push16(FILTER_CONFIG.yaw_lpf_hz); + if (semver.gte(CONFIG.apiVersion, "1.20.0")) { + buffer.push16(FILTER_CONFIG.gyro_soft_notch_hz) + .push16(FILTER_CONFIG.gyro_soft_notch_cutoff) + .push16(FILTER_CONFIG.dterm_notch_hz) + .push16(FILTER_CONFIG.dterm_notch_cutoff); + } break; case MSPCodes.MSP_SET_PID_ADVANCED: if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {