diff options
author | Pawel Spychalski (DzikuVx) <pspychalski@gmail.com> | 2020-07-24 19:52:04 +0300 |
---|---|---|
committer | Pawel Spychalski (DzikuVx) <pspychalski@gmail.com> | 2020-07-24 19:52:04 +0300 |
commit | b85c671b7773e58695bbe88cbdbece8c6900c173 (patch) | |
tree | d4179d199cc7d71339eeb4803628621846e746df /js | |
parent | 14e2e1ad1b847a081b34533525ff71f286451b60 (diff) |
Add support for MAG gain calibration
Diffstat (limited to 'js')
-rw-r--r-- | js/fc.js | 5 | ||||
-rw-r--r-- | js/msp/MSPHelper.js | 22 |
2 files changed, 25 insertions, 2 deletions
@@ -401,6 +401,11 @@ var FC = { }, opflow: { Scale: null + }, + magGain: { + X: null, + Y: null, + Z: null } }; diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index f3a7d944..8c7ffb7b 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -1270,6 +1270,12 @@ var mspHelper = (function (gui) { CALIBRATION_DATA.magZero.Y = data.getInt16(15, true); CALIBRATION_DATA.magZero.Z = data.getInt16(17, true); CALIBRATION_DATA.opflow.Scale = (data.getInt16(19, true) / 256.0); + + if (semver.gte(CONFIG.flightControllerVersion, "2.6.0")) { + CALIBRATION_DATA.magGain.X = data.getInt16(21, true); + CALIBRATION_DATA.magGain.Y = data.getInt16(23, true); + CALIBRATION_DATA.magGain.Z = data.getInt16(25, true); + } break; @@ -1917,8 +1923,20 @@ var mspHelper = (function (gui) { buffer.push(lowByte(CALIBRATION_DATA.magZero.Z)); buffer.push(highByte(CALIBRATION_DATA.magZero.Z)); - buffer.push(lowByte(Math.round(CALIBRATION_DATA.opflow.Scale * 256))); - buffer.push(highByte(Math.round(CALIBRATION_DATA.opflow.Scale * 256))); + buffer.push(lowByte(Math.round(CALIBRATION_DATA.opflow.Scale * 256))); + buffer.push(highByte(Math.round(CALIBRATION_DATA.opflow.Scale * 256))); + + if (semver.gte(CONFIG.flightControllerVersion, "2.6.0")) { + buffer.push(lowByte(CALIBRATION_DATA.magGain.X)); + buffer.push(highByte(CALIBRATION_DATA.magGain.X)); + + buffer.push(lowByte(CALIBRATION_DATA.magGain.Y)); + buffer.push(highByte(CALIBRATION_DATA.magGain.Y)); + + buffer.push(lowByte(CALIBRATION_DATA.magGain.Z)); + buffer.push(highByte(CALIBRATION_DATA.magGain.Z)); + } + break; case MSPCodes.MSP_SET_POSITION_ESTIMATION_CONFIG: |