@@ -222,25 +222,41 @@ void loop()
222222 myICM.readDMPdataFromFIFO (&data);
223223 if ( myICM.status == ICM_20948_Stat_Ok )
224224 {
225- SERIAL_PORT.print (" Received data! Header: " );
226- SERIAL_PORT.println ( data.header );
227- if ( data.header == DMP_header_bitmap_Quat9 ) // We have asked for orientation data so we should receive Quat9
225+ SERIAL_PORT.print (F (" Received data! Header: 0x" ));
226+ if ( data.header < 0x1000 ) SERIAL_PORT.print ( " 0" ); // Pad the zeros
227+ if ( data.header < 0x100 ) SERIAL_PORT.print ( " 0" );
228+ if ( data.header < 0x10 ) SERIAL_PORT.print ( " 0" );
229+ SERIAL_PORT.println ( data.header , HEX );
230+ if ( (data.header | DMP_header_bitmap_Quat9) > 0 ) // We have asked for orientation data so we should receive Quat9
228231 {
229- SERIAL_PORT.print (" Quat9 data is: 0x" );
232+ SERIAL_PORT.print (F ( " Quat9 data is: 0x" ) );
230233 for (int i = 0 ; i < 14 ; i++) // Quat9 data is 14 bytes long
231234 {
232- if ( data.Quat9 [i] < 16 ) SERIAL_PORT.print ( " 0" ); // Pad the zero
235+ if ( data.Quat9 [i] < 0x10 ) SERIAL_PORT.print ( " 0" ); // Pad the zero
233236 SERIAL_PORT.print ( data.Quat9 [i], HEX );
234237 }
235238 SERIAL_PORT.println ();
236239 }
237240 }
238241 else if ( myICM.status != ICM_20948_Stat_FIFONoDataAvail )
239242 {
240- SERIAL_PORT.print (" readDMPdataFromFIFO failed! Status is: " );
243+ SERIAL_PORT.print (F (" readDMPdataFromFIFO failed! Status is: " ));
244+ SERIAL_PORT.print ( myICM.status );
245+ SERIAL_PORT.print (" : " );
241246 SERIAL_PORT.println ( myICM.statusString () );
242- SERIAL_PORT.print (" Header is: 0x" );
247+ SERIAL_PORT.print (F (" Header is: 0x" ));
248+ if ( data.header < 0x1000 ) SERIAL_PORT.print ( " 0" ); // Pad the zeros
249+ if ( data.header < 0x100 ) SERIAL_PORT.print ( " 0" );
250+ if ( data.header < 0x10 ) SERIAL_PORT.print ( " 0" );
243251 SERIAL_PORT.println ( data.header , HEX );
252+ if ( data.header == DMP_header_bitmap_Header2 )
253+ {
254+ SERIAL_PORT.print (F (" Header2 is: 0x" ));
255+ if ( data.header2 < 0x1000 ) SERIAL_PORT.print ( " 0" ); // Pad the zeros
256+ if ( data.header2 < 0x100 ) SERIAL_PORT.print ( " 0" );
257+ if ( data.header2 < 0x10 ) SERIAL_PORT.print ( " 0" );
258+ SERIAL_PORT.println ( data.header2 , HEX );
259+ }
244260 }
245261
246262 delay (10 );
0 commit comments