mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-28 10:34:07 +08:00
ms5611: check for all zero in the prom
when SPI CLK fails we get all zero data
This commit is contained in:
parent
39b40e41c2
commit
8744aa7536
@ -236,9 +236,12 @@ MS5611_SPI::_read_prom()
|
||||
usleep(3000);
|
||||
|
||||
/* read and convert PROM words */
|
||||
bool all_zero = true;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
uint8_t cmd = (ADDR_PROM_SETUP + (i * 2));
|
||||
_prom.c[i] = _reg16(cmd);
|
||||
if (_prom.c[i] != 0)
|
||||
all_zero = false;
|
||||
//debug("prom[%u]=0x%x", (unsigned)i, (unsigned)_prom.c[i]);
|
||||
}
|
||||
|
||||
@ -247,6 +250,10 @@ MS5611_SPI::_read_prom()
|
||||
if (ret != OK) {
|
||||
debug("crc failed");
|
||||
}
|
||||
if (all_zero) {
|
||||
debug("prom all zero");
|
||||
ret = -EIO;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user