1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-19 14:25:13 +03:00

Add support for MAG gain calibration

This commit is contained in:
Pawel Spychalski (DzikuVx) 2020-07-24 18:52:04 +02:00
parent 14e2e1ad1b
commit b85c671b77
4 changed files with 41 additions and 5 deletions

View file

@ -401,6 +401,11 @@ var FC = {
},
opflow: {
Scale: null
},
magGain: {
X: null,
Y: null,
Z: null
}
};

View file

@ -1271,6 +1271,12 @@ var mspHelper = (function (gui) {
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;
case MSPCodes.MSP_SET_CALIBRATION_DATA:
@ -1919,6 +1925,18 @@ var mspHelper = (function (gui) {
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:

View file

@ -98,17 +98,29 @@
</div>
<table id="mag-calibrated-data" class="cf_table">
<tr>
<td><label for="MagX"><span>X</span></label></td>
<td><label for="MagX"><span>Zero X</span></label></td>
<td><input type="number" name="MagX" min="0" max="2000"></td>
</tr>
<tr>
<td><label for="MagY"><span>Y</span></label></td>
<td><label for="MagY"><span>Zero Y</span></label></td>
<td><input type="number" name="MagY" min="0" max="2000"></td>
</tr>
<tr>
<td><label for="MagZ"><span>Z</span></label></td>
<td><label for="MagZ"><span>Zero Z</span></label></td>
<td><input type="number" name="MagZ" min="0" max="2000"></td>
</tr>
<tr>
<td><label for="MagGainX"><span>Gain X</span></label></td>
<td><input type="number" name="MagGainX" min="0" max="2000"></td>
</tr>
<tr>
<td><label for="MagGainY"><span>Gain Y</span></label></td>
<td><input type="number" name="MagGainY" min="0" max="2000"></td>
</tr>
<tr>
<td><label for="MagGainZ"><span>Gain Z</span></label></td>
<td><input type="number" name="MagGainZ" min="0" max="2000"></td>
</tr>
</table>
</div>
</div>

View file

@ -103,6 +103,7 @@ TABS.calibration.initialize = function (callback) {
$('[name=accGain' + item + ']').val(CALIBRATION_DATA.accGain[item]);
$('[name=accZero' + item + ']').val(CALIBRATION_DATA.accZero[item]);
$('[name=Mag' + item + ']').val(CALIBRATION_DATA.magZero[item]);
$('[name=MagGain' + item + ']').val(CALIBRATION_DATA.magGain[item]);
});
$('[name=OpflowScale]').val(CALIBRATION_DATA.opflow.Scale);
updateCalibrationSteps();