diff options
author | Paweł Spychalski <pspychalski@gmail.com> | 2020-08-14 21:48:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-14 21:48:38 +0300 |
commit | 0cd7cc0903eb4529c321e0bb9597a33367459ba7 (patch) | |
tree | 1bf77431154ab4f4550db06152d8ef28d7991280 /js | |
parent | 8fcc804148dca00db032a3b84d328f3be1d5f459 (diff) | |
parent | b85c671b7773e58695bbe88cbdbece8c6900c173 (diff) |
Merge pull request #1044 from iNavFlight/dzikuvx-mag-gain-calibration
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 d032c8e9..535df725 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -1254,6 +1254,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; @@ -1901,8 +1907,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: |