QMC5883LCompass icon indicating copy to clipboard operation
QMC5883LCompass copied to clipboard

solving hangup of the sensor (in continuous mode)

Open Stef-aap opened this issue 4 years ago • 2 comments

sometimes the sensor hangs, resetting or init doesn´t solve the problem. There are 2 ways to solve the problem:

  1. powercycle the sensor
  2. modify the Data_Ready method as shown below

bool QMC5883LCompass::Data_Ready () { Wire.beginTransmission ( _ADDR ) ; Wire.write ( 0x06 ) ; int err = Wire.endTransmission(); if (!err) { Wire.requestFrom(_ADDR, (byte)1); uint8_t Status = Wire.read() ; if ( ( Status & 0x01 ) > 0 ) return true ;

// ********************************************************************* //SM: to prevent hangup, if skipbit DOR (0x04) is set // youe to perform a read to get it working again (but data will be invalid)
if ( ( Status & 0x04 ) > 0 ) read() ; // *********************************************************************

} return false ; }

Stef-aap avatar Apr 24 '21 20:04 Stef-aap

I can't find this Data_Ready function anywhere.

capedra avatar May 22 '21 07:05 capedra

where is this data_Ready function?

ZIVsc avatar Feb 05 '23 06:02 ZIVsc