diff --git a/locales/en/messages.json b/locales/en/messages.json index db309b93..4f4b7280 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -2610,7 +2610,7 @@ "message": "Gyroscope - deg/s" }, "sensorsAccelTitle": { - "message": "Accelerometer - g" + "message": "Accelerometer - g (deg)" }, "sensorsMagTitle": { "message": "Magnetometer - Ga" diff --git a/src/js/tabs/sensors.js b/src/js/tabs/sensors.js index 436211b3..a646793a 100644 --- a/src/js/tabs/sensors.js +++ b/src/js/tabs/sensors.js @@ -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]) {