Open Koepel opened 6 years ago
Thank you for your comment Koepel! the Issue has been fixed.
I think I did not look at it very well the first time. In the function "readRegister16()" and "readRegister24()" there is a Wire.beginTransmission() and Wire.endTransmission() around the Wire.requestFrom(). However, the Wire.beginTransmission() and Wire.endTransmission() should only be use when writing data. Explanation: Common-mistakes, number 2 and 3.
I also prefer not to shift a 8-bit variable 8 bits to the left. The compiler will solve that, so it will work.
For example:
uint16_t IMU::readRegister16(uint8_t reg)
{
SWire.beginTransmission(MS5611_ADDRESS);
SWire.write(reg);
SWire.endTransmission();
SWire.requestFrom(MS5611_ADDRESS, 2);
uint16_t value = SWire.read();
value <<= 8;
value |= SWire.read();
return value;
}
In the file "Quad-Copter/QuadM3/IMU.cpp" there is waiting after the Wire.requestFrom(). You may remove the "
while(SWire.available() < 14);
" and all the "while(!SWire.available()) {};
" after a Wire.requestFrom(), regardless which (software) Wire library you use. Explanation: Common-mistakes#1