AP_Compass: fix AK09916 hangup issue

This commit is contained in:
Hayden 2023-07-07 15:03:49 +10:00 committed by Randy Mackay
parent 58281108c0
commit 852a508a8d
2 changed files with 8 additions and 0 deletions

View File

@ -311,8 +311,15 @@ void AP_Compass_AK09916::_update()
} }
if (!(regs.st1 & 0x01)) { if (!(regs.st1 & 0x01)) {
no_data++;
if (no_data == 5) {
_reset();
_setup_mode();
no_data = 0;
}
goto check_registers; goto check_registers;
} }
no_data = 0;
/* Check for overflow. See AK09916's datasheet*/ /* Check for overflow. See AK09916's datasheet*/
if ((regs.st2 & 0x08)) { if ((regs.st2 & 0x08)) {

View File

@ -97,6 +97,7 @@ private:
bool _initialized; bool _initialized;
enum Rotation _rotation; enum Rotation _rotation;
enum AP_Compass_Backend::DevTypes _devtype; enum AP_Compass_Backend::DevTypes _devtype;
uint8_t no_data;
}; };