AP_Compass: fix AK09916 hangup issue

This commit is contained in:
Hayden 2023-07-07 15:03:49 +10:00 committed by Peter Barker
parent e05780c446
commit b237fd9fa4
2 changed files with 8 additions and 0 deletions

View File

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

View File

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