From 245a49a85dd7b6a7cb9ec36ad02f6bb66e42f4e2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 15 Jul 2019 13:26:30 -0700 Subject: altos: Allow ms5607 driver to either set ao_sensor_errors or panic Products that want to remain usable (over USB) after a sensor failure don't want to panic when the ms5607 fails, but products with limited ROM space don't want to have extra code to check for the sensor failure and panic. Change the MS5607 driver to allow either option, and then make the micropeak based devices use it. Signed-off-by: Keith Packard --- src/drivers/ao_ms5607.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/drivers') diff --git a/src/drivers/ao_ms5607.c b/src/drivers/ao_ms5607.c index 495fbe02..febe0111 100644 --- a/src/drivers/ao_ms5607.c +++ b/src/drivers/ao_ms5607.c @@ -112,8 +112,14 @@ ao_ms5607_prom_read(struct ao_ms5607_prom *prom) r++; } - if (!ao_ms5607_prom_valid((uint8_t *) prom)) + + if (!ao_ms5607_prom_valid((uint8_t *) prom)) { +#if HAS_SENSOR_ERRORS + ao_sensor_errors = 1; +#else ao_panic(AO_PANIC_SELF_TEST_MS5607); +#endif + } #if __BYTE_ORDER == __LITTLE_ENDIAN /* Byte swap */ -- cgit v1.2.3