mirror of https://github.com/ArduPilot/ardupilot
AP_BoardConfig: fixed device semaphore in board detect
thanks to Mark for finding this
This commit is contained in:
parent
2b86c0e962
commit
abd659212e
|
@ -120,11 +120,16 @@ bool AP_BoardConfig::spi_check_register(const char *devname, uint8_t regnum, uin
|
|||
return false;
|
||||
}
|
||||
dev->set_read_flag(read_flag);
|
||||
if (!dev->get_semaphore()->take(HAL_SEMAPHORE_BLOCK_FOREVER)) {
|
||||
return false;
|
||||
}
|
||||
uint8_t v;
|
||||
if (!dev->read_registers(regnum, &v, 1)) {
|
||||
hal.console->printf("%s: reg %02x read fail\n", devname, (unsigned)regnum);
|
||||
dev->get_semaphore()->give();
|
||||
return false;
|
||||
}
|
||||
dev->get_semaphore()->give();
|
||||
hal.console->printf("%s: reg %02x expected:%02x got:%02x\n", devname, (unsigned)regnum, (unsigned)value, (unsigned)v);
|
||||
return v == value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue