I’m reading ardupilot code and writing a test code for my hardware, but I see icp20100 driver tries read ID and Version for once and when it fails, there is no retry. I’m curious why since my test code tested a pass and ardupilot tested a fail.
btw my hardware fails for the first read and then passes on the second read and so on.
bool AP_Baro_ICP201XX::init()
{
if (!dev) {
return false;
}
dev->get_semaphore()->take_blocking();
uint8_t id = 0xFF;
uint8_t ver = 0xFF;
read_reg(REG_DEVICE_ID, &id);
read_reg(REG_DEVICE_ID, &id);
read_reg(REG_VERSION, &ver);
if (id != ICP201XX_ID) {
goto failed;
}
if (ver != 0x00 && ver != 0xB2) {
goto failed;
}
hal.scheduler->delay(10);
soft_reset();
ardupilot/libraries/AP_Baro/AP_Baro_ICP201XX.cpp at master · ArduPilot/ardupilot