1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-16 04:45:20 +03:00

Merge pull request #2197 from haslinghuis/add-feature-sensor

Add degrees to accelerometer for X and Y axis in sensor tab
This commit is contained in:
Michael Keller 2020-10-09 01:59:06 +13:00 committed by GitHub
commit 14d98c4dea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -2610,7 +2610,7 @@
"message": "Gyroscope - deg/s"
},
"sensorsAccelTitle": {
"message": "Accelerometer - g"
"message": "Accelerometer - g (deg)"
},
"sensorsMagTitle": {
"message": "Magnetometer - Ga"

View file

@ -379,9 +379,15 @@ TABS.sensors.initialize = function (callback) {
samples_accel_i = addSampleToData(accel_data, samples_accel_i, FC.SENSOR_DATA.accelerometer);
drawGraph(accelHelpers, accel_data, samples_accel_i);
raw_data_text_ements.x[1].text(FC.SENSOR_DATA.accelerometer[0].toFixed(2));
raw_data_text_ements.y[1].text(FC.SENSOR_DATA.accelerometer[1].toFixed(2));
raw_data_text_ements.z[1].text(FC.SENSOR_DATA.accelerometer[2].toFixed(2));
const x = FC.SENSOR_DATA.accelerometer[0].toFixed(2);
const y = FC.SENSOR_DATA.accelerometer[1].toFixed(2);
const z = FC.SENSOR_DATA.accelerometer[2].toFixed(2);
const pi = Math.PI;
const rollACC = Math.round(Math.atan(y / (Math.sqrt(Math.pow(x, 2)) + (Math.pow(z, 2)))) * (180 / pi));
const pitchACC = Math.round(Math.atan(x / (Math.sqrt(Math.pow(y, 2)) + (Math.pow(z, 2)))) * (180 / pi));
raw_data_text_ements.x[1].text(`${x} (${rollACC})`);
raw_data_text_ements.y[1].text(`${y} (${pitchACC})`);
raw_data_text_ements.z[1].text(`${z}`);
}
if (checkboxes[2]) {