mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-16 21:05:30 +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:
commit
14d98c4dea
2 changed files with 10 additions and 4 deletions
|
@ -2610,7 +2610,7 @@
|
|||
"message": "Gyroscope - deg/s"
|
||||
},
|
||||
"sensorsAccelTitle": {
|
||||
"message": "Accelerometer - g"
|
||||
"message": "Accelerometer - g (deg)"
|
||||
},
|
||||
"sensorsMagTitle": {
|
||||
"message": "Magnetometer - Ga"
|
||||
|
|
|
@ -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]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue