1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 00:35:26 +03:00

Add degrees to accelerometer for X and Y axis in sensor tab

This commit is contained in:
Mark Haslinghuis 2020-10-05 23:07:12 +02:00
parent 59076c0c3a
commit 243d8e81eb
2 changed files with 10 additions and 4 deletions

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]) {