@@ -171,7 +171,7 @@ void BNO080::enableDebugging(Stream &debugPort)
171
171
172
172
// Updates the latest variables if possible
173
173
// Returns false if new readings are not available
174
- bool BNO080::dataAvailable (void )
174
+ uint16_t BNO080::dataAvailable (void )
175
175
{
176
176
// If we have an interrupt pin connection available, check if data is available.
177
177
// If int pin is not set, then we'll rely on receivePacket() to timeout
@@ -187,21 +187,18 @@ bool BNO080::dataAvailable(void)
187
187
// Check to see if this packet is a sensor reporting its data to us
188
188
if (shtpHeader[2 ] == CHANNEL_REPORTS && shtpData[0 ] == SHTP_REPORT_BASE_TIMESTAMP)
189
189
{
190
- parseInputReport (); // This will update the rawAccelX, etc variables depending on which feature report is found
191
- return (true );
190
+ return parseInputReport (); // This will update the rawAccelX, etc variables depending on which feature report is found
192
191
}
193
192
else if (shtpHeader[2 ] == CHANNEL_CONTROL)
194
193
{
195
- parseCommandReport (); // This will update responses to commands, calibrationStatus, etc.
196
- return (true );
194
+ return parseCommandReport (); // This will update responses to commands, calibrationStatus, etc.
197
195
}
198
196
else if (shtpHeader[2 ] == CHANNEL_GYRO)
199
197
{
200
- parseInputReport (); // This will update the rawAccelX, etc variables depending on which feature report is found
201
- return (true );
198
+ return parseInputReport (); // This will update the rawAccelX, etc variables depending on which feature report is found
202
199
}
203
200
}
204
- return ( false ) ;
201
+ return 0 ;
205
202
}
206
203
207
204
// This function pulls the data from the command response report
@@ -222,7 +219,7 @@ bool BNO080::dataAvailable(void)
222
219
// shtpData[5 + 6]: R6
223
220
// shtpData[5 + 7]: R7
224
221
// shtpData[5 + 8]: R8
225
- void BNO080::parseCommandReport (void )
222
+ uint16_t BNO080::parseCommandReport (void )
226
223
{
227
224
if (shtpData[0 ] == SHTP_REPORT_COMMAND_RESPONSE)
228
225
{
@@ -233,6 +230,7 @@ void BNO080::parseCommandReport(void)
233
230
{
234
231
calibrationStatus = shtpData[5 + 0 ]; // R0 - Status (0 = success, non-zero = fail)
235
232
}
233
+ return shtpData[0 ];
236
234
}
237
235
else
238
236
{
@@ -241,6 +239,7 @@ void BNO080::parseCommandReport(void)
241
239
}
242
240
243
241
// TODO additional feature reports may be strung together. Parse them all.
242
+ return 0 ;
244
243
}
245
244
246
245
// This function pulls the data from the input report
@@ -258,7 +257,7 @@ void BNO080::parseCommandReport(void)
258
257
// shtpData[8:9]: k/accel z/gyro z/etc
259
258
// shtpData[10:11]: real/gyro temp/etc
260
259
// shtpData[12:13]: Accuracy estimate
261
- void BNO080::parseInputReport (void )
260
+ uint16_t BNO080::parseInputReport (void )
262
261
{
263
262
// Calculate the number of data bytes in this packet
264
263
int16_t dataLength = ((uint16_t )shtpHeader[1 ] << 8 | shtpHeader[0 ]);
@@ -279,7 +278,7 @@ void BNO080::parseInputReport(void)
279
278
rawFastGyroY = (uint16_t )shtpData[11 ] << 8 | shtpData[10 ];
280
279
rawFastGyroZ = (uint16_t )shtpData[13 ] << 8 | shtpData[12 ];
281
280
282
- return ;
281
+ return SENSOR_REPORTID_GYRO_INTEGRATED_ROTATION_VECTOR ;
283
282
}
284
283
285
284
uint8_t status = shtpData[5 + 2 ] & 0x03 ; // Get status bits
@@ -398,9 +397,11 @@ void BNO080::parseInputReport(void)
398
397
{
399
398
// This sensor report ID is unhandled.
400
399
// See reference manual to add additional feature reports as needed
400
+ return 0 ;
401
401
}
402
402
403
403
// TODO additional feature reports may be strung together. Parse them all.
404
+ return shtpData[5 ];
404
405
}
405
406
406
407
// Quaternion to Euler conversion
0 commit comments