1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

moving kinematics data to array

This commit is contained in:
cTn 2014-06-20 12:39:42 +02:00
parent 8dfec796ee
commit 8273081fdd
4 changed files with 10 additions and 12 deletions

View file

@ -48,9 +48,7 @@ var SENSOR_DATA = {
accelerometer: [0, 0, 0],
magnetometer: [0, 0, 0],
altitude: 0,
kinematicsX: 0.0,
kinematicsY: 0.0,
kinematicsZ: 0.0,
kinematics: [0.0, 0.0, 0.0],
debug: [0, 0, 0, 0]
};

View file

@ -231,9 +231,9 @@ MSP.process_data = function(code, message_buffer, message_length) {
GPS_DATA.update = data.getUint8(4);
break;
case MSP_codes.MSP_ATTITUDE:
SENSOR_DATA.kinematicsX = data.getInt16(0, 1) / 10.0;
SENSOR_DATA.kinematicsY = data.getInt16(2, 1) / 10.0;
SENSOR_DATA.kinematicsZ = data.getInt16(4, 1);
SENSOR_DATA.kinematics[0] = data.getInt16(0, 1) / 10.0; // x
SENSOR_DATA.kinematics[1] = data.getInt16(2, 1) / 10.0; // y
SENSOR_DATA.kinematics[2] = data.getInt16(4, 1); // z
break;
case MSP_codes.MSP_ALTITUDE:
SENSOR_DATA.altitude = parseFloat((data.getInt32(0, 1) / 100.0).toFixed(2)); // correct scale factor

View file

@ -251,9 +251,9 @@ function tab_initialize_initial_setup() {
// Update cube
var cube = $('div#cube');
cube.css('-webkit-transform', 'rotateY(' + ((SENSOR_DATA.kinematicsZ * -1.0) - yaw_fix) + 'deg)');
$('#cubePITCH', cube).css('-webkit-transform', 'rotateX(' + SENSOR_DATA.kinematicsY + 'deg)');
$('#cubeROLL', cube).css('-webkit-transform', 'rotateZ(' + SENSOR_DATA.kinematicsX + 'deg)');
cube.css('-webkit-transform', 'rotateY(' + ((SENSOR_DATA.kinematics[2] * -1.0) - yaw_fix) + 'deg)');
$('#cubePITCH', cube).css('-webkit-transform', 'rotateX(' + SENSOR_DATA.kinematics[1] + 'deg)');
$('#cubeROLL', cube).css('-webkit-transform', 'rotateZ(' + SENSOR_DATA.kinematics[0] + 'deg)');
}
GUI.interval_add('initial_setup_data_pull', get_analog_data, 50, true);

View file

@ -155,9 +155,9 @@ function tab_initialize_logging() {
sample += ',' + SENSOR_DATA.magnetometer;
break;
case 'MSP_ATTITUDE':
sample += ',' + SENSOR_DATA.kinematicsX;
sample += ',' + SENSOR_DATA.kinematicsY;
sample += ',' + SENSOR_DATA.kinematicsZ;
sample += ',' + SENSOR_DATA.kinematics[0];
sample += ',' + SENSOR_DATA.kinematics[1];
sample += ',' + SENSOR_DATA.kinematics[2];
break;
case 'MSP_ALTITUDE':
sample += ',' + SENSOR_DATA.altitude;