diff --git a/js/msp.js b/js/msp.js index 516dcd2376..f077521618 100644 --- a/js/msp.js +++ b/js/msp.js @@ -219,15 +219,19 @@ function process_data(command, message_buffer, message_length_expected) { $('span.cycle-time').html(CONFIG.cycleTime); break; case MSP_codes.MSP_RAW_IMU: - SENSOR_DATA.accelerometer[0] = data.getInt16(0, 1) / 1000; // properly scaled - SENSOR_DATA.accelerometer[1] = data.getInt16(2, 1) / 1000; - SENSOR_DATA.accelerometer[2] = data.getInt16(4, 1) / 1000; + // 512 for mpu6050, 256 for mma + // currently we are unable to differentiate between the sensor types, so we are goign with 512 + SENSOR_DATA.accelerometer[0] = data.getInt16(0, 1) / 512; + SENSOR_DATA.accelerometer[1] = data.getInt16(2, 1) / 512; + SENSOR_DATA.accelerometer[2] = data.getInt16(4, 1) / 512; - SENSOR_DATA.gyroscope[0] = data.getInt16(6, 1) / 8; // no clue about scaling factor - SENSOR_DATA.gyroscope[1] = data.getInt16(8, 1) / 8; - SENSOR_DATA.gyroscope[2] = data.getInt16(10, 1) / 8; + // properly scaled + SENSOR_DATA.gyroscope[0] = data.getInt16(6, 1) * (4 / 16.4); + SENSOR_DATA.gyroscope[1] = data.getInt16(8, 1) * (4 / 16.4); + SENSOR_DATA.gyroscope[2] = data.getInt16(10, 1) * (4 / 16.4); - SENSOR_DATA.magnetometer[0] = data.getInt16(12, 1) / 3; // no clue about scaling factor + // no clue about scaling factor + SENSOR_DATA.magnetometer[0] = data.getInt16(12, 1) / 3; SENSOR_DATA.magnetometer[1] = data.getInt16(14, 1) / 3; SENSOR_DATA.magnetometer[2] = data.getInt16(16, 1) / 3; break; diff --git a/tabs/sensors.js b/tabs/sensors.js index 8f8500e5e2..52480c7f12 100644 --- a/tabs/sensors.js +++ b/tabs/sensors.js @@ -63,7 +63,9 @@ function tab_initialize_sensors() { title: "Gyroscope (deg/s)", shadowSize: 0, yaxis : { - tickDecimals: 0 + tickDecimals: 1, + max : 2000, + min: -2000 }, xaxis : { //noTicks = 0 @@ -82,8 +84,8 @@ function tab_initialize_sensors() { shadowSize: 0, yaxis : { tickDecimals: 1, - max : 1.5, - min : -1.5 + max : 2, + min : -2 }, xaxis : { //noTicks = 0