Skip to content

Commit

Permalink
Show magADC values without re-scaling in Sensors Tab (#3593)
Browse files Browse the repository at this point in the history
show true magADC values
  • Loading branch information
ctzsnooze authored Nov 10, 2023
1 parent 90b7571 commit f65ea96
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3117,7 +3117,7 @@
"message": "Accelerometer - g (deg)"
},
"sensorsMagTitle": {
"message": "Magnetometer - Ga"
"message": "Magnetometer"
},
"sensorsAltitudeTitle": {
"message": "Altitude - meters"
Expand Down
6 changes: 3 additions & 3 deletions src/js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
FC.SENSOR_DATA.gyroscope[2] = data.read16() * (4 / 16.4);

// no clue about scaling factor
FC.SENSOR_DATA.magnetometer[0] = data.read16() / 1090;
FC.SENSOR_DATA.magnetometer[1] = data.read16() / 1090;
FC.SENSOR_DATA.magnetometer[2] = data.read16() / 1090;
FC.SENSOR_DATA.magnetometer[0] = data.read16();
FC.SENSOR_DATA.magnetometer[1] = data.read16();
FC.SENSOR_DATA.magnetometer[2] = data.read16();
break;
case MSPCodes.MSP_SERVO:
const servoCount = data.byteLength / 2;
Expand Down
6 changes: 3 additions & 3 deletions src/js/tabs/sensors.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,9 @@ sensors.initialize = function (callback) {

samples_mag_i = addSampleToData(mag_data, samples_mag_i, FC.SENSOR_DATA.magnetometer);
drawGraph(magHelpers, mag_data, samples_mag_i);
raw_data_text_ements.x[2].text(FC.SENSOR_DATA.magnetometer[0].toFixed(2));
raw_data_text_ements.y[2].text(FC.SENSOR_DATA.magnetometer[1].toFixed(2));
raw_data_text_ements.z[2].text(FC.SENSOR_DATA.magnetometer[2].toFixed(2));
raw_data_text_ements.x[2].text(FC.SENSOR_DATA.magnetometer[0].toFixed(0));
raw_data_text_ements.y[2].text(FC.SENSOR_DATA.magnetometer[1].toFixed(0));
raw_data_text_ements.z[2].text(FC.SENSOR_DATA.magnetometer[2].toFixed(0));
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/tabs/sensors.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,13 @@
<dt i18n="sensorsScale"></dt>
<dd class="scale">
<select name="mag_scale">
<option value="0.5">0.5</option>
<option value="1" selected="selected">1</option>
<option value="100">100</option>
<option value="200">200</option>
<option value="500">500</option>
<option value="1000">1000</option>
<option value="2000" selected="selected">2000</option>
<option value="5000">5000</option>
<option value="10000">10000</option>
</select>
</dd>
<dt>X:</dt>
Expand Down

0 comments on commit f65ea96

Please sign in to comment.