From 6769d976a03e8f1814498b076d68421288bc18e3 Mon Sep 17 00:00:00 2001 From: Noel Eck Date: Wed, 11 Jan 2017 15:52:41 -0800 Subject: [PATCH] max30100: ISR recover attempt Handle failure in ISR routine - attempt to read status and FIFO registers and continue sampleing (vs exiting and turning off continuous sampling). Signed-off-by: Noel Eck --- src/max30100/max30100.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/max30100/max30100.c b/src/max30100/max30100.c index c4d13ff7..4ee260d4 100644 --- a/src/max30100/max30100.c +++ b/src/max30100/max30100.c @@ -397,9 +397,15 @@ static void _internal_sample_rdy(void *arg) * log an error in syslog and attempt to stop sampling * Handle all failing cases here */ max30100_sample_rdy_fail: - syslog(LOG_CRIT, "%s: _internal_sample_rdy() failed, attempting to stop sampling...\n", + syslog(LOG_CRIT, + "%s: _internal_sample_rdy() failed, attempting to restart sampling...\n", __FUNCTION__); - max30100_sample_stop(dev); + + /* Read FIFO AND status register in a last attempt to continue + * sampling, ignore result */ + max30100_read(dev, MAX30100_REG_FIFO_WR_PTR, &tmp); + max30100_read(dev, MAX30100_REG_INTERRUPT_STATUS, &tmp); + return; }