@@ -291,6 +291,7 @@ uint16_t BNO080::parseInputReport(void)
291291 uint16_t data3 = (uint16_t )shtpData[5 + 9 ] << 8 | shtpData[5 + 8 ];
292292 uint16_t data4 = 0 ;
293293 uint16_t data5 = 0 ; // We would need to change this to uin32_t to capture time stamp value on Raw Accel/Gyro/Mag reports
294+ uint16_t data6 = 0 ;
294295
295296 if (dataLength - 5 > 9 )
296297 {
@@ -300,6 +301,11 @@ uint16_t BNO080::parseInputReport(void)
300301 {
301302 data5 = (uint16_t )shtpData[5 + 13 ] << 8 | shtpData[5 + 12 ];
302303 }
304+ if (dataLength - 5 > 13 )
305+ {
306+ data6 = (uint16_t )shtpData[5 + 15 ] << 8 | shtpData[5 + 14 ];
307+ }
308+
303309
304310 // Store these generic values to their proper global variable
305311 if (shtpData[5 ] == SENSOR_REPORTID_ACCELEROMETER)
@@ -317,12 +323,22 @@ uint16_t BNO080::parseInputReport(void)
317323 rawLinAccelZ = data3;
318324 }
319325 else if (shtpData[5 ] == SENSOR_REPORTID_GYROSCOPE)
320- {
326+ {
321327 gyroAccuracy = status;
322328 rawGyroX = data1;
323329 rawGyroY = data2;
324330 rawGyroZ = data3;
325331 }
332+ else if (shtpData[5 ] == SENSOR_REPORTID_UNCALIBRATED_GYRO)
333+ {
334+ UncalibGyroAccuracy = status;
335+ rawUncalibGyroX = data1;
336+ rawUncalibGyroY = data2;
337+ rawUncalibGyroZ = data3;
338+ rawBiasX = data4;
339+ rawBiasY = data5;
340+ rawBiasZ = data6;
341+ }
326342 else if (shtpData[5 ] == SENSOR_REPORTID_MAGNETIC_FIELD)
327343 {
328344 magAccuracy = status;
@@ -697,6 +713,61 @@ uint8_t BNO080::getGyroAccuracy()
697713 return (gyroAccuracy);
698714}
699715
716+ // Gets the full uncalibrated gyro vector
717+ // x,y,z,bx,by,bz output floats
718+ void BNO080::getUncalibratedGyro (float &x, float &y, float &z, float &bx, float &by, float &bz, uint8_t &accuracy)
719+ {
720+ x = qToFloat (rawUncalibGyroX, gyro_Q1);
721+ y = qToFloat (rawUncalibGyroY, gyro_Q1);
722+ z = qToFloat (rawUncalibGyroZ, gyro_Q1);
723+ bx = qToFloat (rawBiasX, gyro_Q1);
724+ by = qToFloat (rawBiasY, gyro_Q1);
725+ bz = qToFloat (rawBiasZ, gyro_Q1);
726+ accuracy = UncalibGyroAccuracy;
727+ }
728+ // Return the gyro component
729+ float BNO080::getUncalibratedGyroX ()
730+ {
731+ float gyro = qToFloat (rawUncalibGyroX, gyro_Q1);
732+ return (gyro);
733+ }
734+ // Return the gyro component
735+ float BNO080::getUncalibratedGyroY ()
736+ {
737+ float gyro = qToFloat (rawUncalibGyroY, gyro_Q1);
738+ return (gyro);
739+ }
740+ // Return the gyro component
741+ float BNO080::getUncalibratedGyroZ ()
742+ {
743+ float gyro = qToFloat (rawUncalibGyroZ, gyro_Q1);
744+ return (gyro);
745+ }
746+ // Return the gyro component
747+ float BNO080::getUncalibratedGyroBiasX ()
748+ {
749+ float gyro = qToFloat (rawBiasX, gyro_Q1);
750+ return (gyro);
751+ }
752+ // Return the gyro component
753+ float BNO080::getUncalibratedGyroBiasY ()
754+ {
755+ float gyro = qToFloat (rawBiasY, gyro_Q1);
756+ return (gyro);
757+ }
758+ // Return the gyro component
759+ float BNO080::getUncalibratedGyroBiasZ ()
760+ {
761+ float gyro = qToFloat (rawBiasZ, gyro_Q1);
762+ return (gyro);
763+ }
764+
765+ // Return the gyro component
766+ uint8_t BNO080::getUncalibratedGyroAccuracy ()
767+ {
768+ return (UncalibGyroAccuracy);
769+ }
770+
700771// Gets the full gravity vector
701772// x,y,z output floats
702773void BNO080::getGravity (float &x, float &y, float &z, uint8_t &accuracy)
@@ -1113,6 +1184,7 @@ uint8_t BNO080::resetReason()
11131184// See https://en.wikipedia.org/wiki/Q_(number_format)
11141185float BNO080::qToFloat (int16_t fixedPointValue, uint8_t qPoint)
11151186{
1187+
11161188 float qFloat = fixedPointValue;
11171189 qFloat *= pow (2 , qPoint * -1 );
11181190 return (qFloat);
@@ -1166,6 +1238,12 @@ void BNO080::enableGyro(uint16_t timeBetweenReports)
11661238 setFeatureCommand (SENSOR_REPORTID_GYROSCOPE, timeBetweenReports);
11671239}
11681240
1241+ // Sends the packet to enable the uncalibrated gyro
1242+ void BNO080::enableUncalibratedGyro (uint16_t timeBetweenReports)
1243+ {
1244+ setFeatureCommand (SENSOR_REPORTID_UNCALIBRATED_GYRO, timeBetweenReports);
1245+ }
1246+
11691247// Sends the packet to enable the magnetometer
11701248void BNO080::enableMagnetometer (uint16_t timeBetweenReports)
11711249{
0 commit comments