diff options
author | Konstantin Sharlaimov (DigitalEntity) <konstantin.sharlaimov@gmail.com> | 2019-05-01 22:42:31 +0300 |
---|---|---|
committer | Konstantin Sharlaimov (DigitalEntity) <konstantin.sharlaimov@gmail.com> | 2019-05-01 22:42:31 +0300 |
commit | 5916100b226f1cd6dabf4851d85f961f9157638b (patch) | |
tree | fec11fec62e44d2e2cbd26e487fd17068897d55e /js/msp | |
parent | 79c39486db35cc3d91a5a738a4ccfe18a2b5529d (diff) |
[OPFLOW] Initial cut on optic flow calibration
Diffstat (limited to 'js/msp')
-rw-r--r-- | js/msp/MSPCodes.js | 4 | ||||
-rw-r--r-- | js/msp/MSPHelper.js | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/js/msp/MSPCodes.js b/js/msp/MSPCodes.js index 9308719b..f774120d 100644 --- a/js/msp/MSPCodes.js +++ b/js/msp/MSPCodes.js @@ -209,5 +209,7 @@ var MSPCodes = { MSP2_INAV_SET_LOGIC_CONDITIONS: 0x2023, MSP2_PID: 0x2030, - MSP2_SET_PID: 0x2031 + MSP2_SET_PID: 0x2031, + + MSP2_INAV_OPFLOW_CALIBRATION: 0x2032 }; diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index e1dc856d..943e0612 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -642,6 +642,9 @@ var mspHelper = (function (gui) { case MSPCodes.MSP_MAG_CALIBRATION: console.log('Mag calibration executed'); break; + case MSPCodes.MSP2_INAV_OPFLOW_CALIBRATION: + console.log('Optic flow calibration executed'); + break; case MSPCodes.MSP_SET_MISC: console.log('MISC Configuration saved'); break; @@ -1293,6 +1296,11 @@ var mspHelper = (function (gui) { CALIBRATION_DATA.magZero.X = data.getInt16(13, true); CALIBRATION_DATA.magZero.Y = data.getInt16(15, true); CALIBRATION_DATA.magZero.Z = data.getInt16(17, true); + + if (semver.gte(CONFIG.flightControllerVersion, "2.2.0")) { + CALIBRATION_DATA.opflow.Scale = (data.getInt16(19, true) / 256.0); + } + break; case MSPCodes.MSP_SET_CALIBRATION_DATA: @@ -1945,6 +1953,11 @@ var mspHelper = (function (gui) { buffer.push(lowByte(CALIBRATION_DATA.magZero.Z)); buffer.push(highByte(CALIBRATION_DATA.magZero.Z)); + + if (semver.gte(CONFIG.flightControllerVersion, "2.2.0")) { + buffer.push(lowByte(Math.round(CALIBRATION_DATA.opflow.Scale * 256))); + buffer.push(highByte(Math.round(CALIBRATION_DATA.opflow.Scale * 256))); + } break; case MSPCodes.MSP_SET_POSITION_ESTIMATION_CONFIG: |