[DO NOT MERGE] ist8310 retry probe and enable debug

This commit is contained in:
Daniel Agar 2022-04-19 11:24:18 -04:00
parent 3c6b72c33b
commit ddbc75bb56
No known key found for this signature in database
GPG Key ID: FD3CBA98017A69DE
2 changed files with 11 additions and 5 deletions

View File

@ -35,6 +35,7 @@ px4_add_module(
MODULE drivers__magnetometer__isentek__ist8310
MAIN ist8310
COMPILE_FLAGS
-DDEBUG_BUILD
SRCS
IST8310.cpp
IST8310.hpp

View File

@ -45,6 +45,7 @@ IST8310::IST8310(const I2CSPIDriverConfig &config) :
I2CSPIDriver(config),
_px4_mag(get_device_id(), config.rotation)
{
_debug_enabled = true;
}
IST8310::~IST8310()
@ -85,14 +86,18 @@ void IST8310::print_status()
int IST8310::probe()
{
const uint8_t WAI = RegisterRead(Register::WAI);
for (int i = 0; i < 10; i++) {
const uint8_t WAI = RegisterRead(Register::WAI);
if (WAI != Device_ID) {
DEVICE_DEBUG("unexpected WAI 0x%02x", WAI);
return PX4_ERROR;
if (WAI == Device_ID) {
return PX4_OK;
} else {
PX4_DEBUG("unexpected WAI 0x%02x", WAI);
}
}
return PX4_OK;
return PX4_ERROR;
}
void IST8310::RunImpl()