mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-12 09:01:35 +08:00
[DO NOT MERGE] ist8310 retry probe and enable debug
This commit is contained in:
@@ -35,6 +35,7 @@ px4_add_module(
|
|||||||
MODULE drivers__magnetometer__isentek__ist8310
|
MODULE drivers__magnetometer__isentek__ist8310
|
||||||
MAIN ist8310
|
MAIN ist8310
|
||||||
COMPILE_FLAGS
|
COMPILE_FLAGS
|
||||||
|
-DDEBUG_BUILD
|
||||||
SRCS
|
SRCS
|
||||||
IST8310.cpp
|
IST8310.cpp
|
||||||
IST8310.hpp
|
IST8310.hpp
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ IST8310::IST8310(const I2CSPIDriverConfig &config) :
|
|||||||
I2CSPIDriver(config),
|
I2CSPIDriver(config),
|
||||||
_px4_mag(get_device_id(), config.rotation)
|
_px4_mag(get_device_id(), config.rotation)
|
||||||
{
|
{
|
||||||
|
_debug_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IST8310::~IST8310()
|
IST8310::~IST8310()
|
||||||
@@ -85,14 +86,18 @@ void IST8310::print_status()
|
|||||||
|
|
||||||
int IST8310::probe()
|
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) {
|
if (WAI == Device_ID) {
|
||||||
DEVICE_DEBUG("unexpected WAI 0x%02x", WAI);
|
return PX4_OK;
|
||||||
return PX4_ERROR;
|
|
||||||
|
} else {
|
||||||
|
PX4_DEBUG("unexpected WAI 0x%02x", WAI);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PX4_OK;
|
return PX4_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IST8310::RunImpl()
|
void IST8310::RunImpl()
|
||||||
|
|||||||
Reference in New Issue
Block a user