From 2de01964e2ca30344f64df69500775a4eb7af36d Mon Sep 17 00:00:00 2001 From: Kynos Date: Fri, 2 May 2014 22:00:34 +0200 Subject: [PATCH] Reset MS5611 baro sensor after an error Reset MS5611 baro sensor after an error in order to avoid endless error loops --- src/drivers/ms5611/ms5611.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/drivers/ms5611/ms5611.cpp b/src/drivers/ms5611/ms5611.cpp index 0ef056273f..3fe1b0abcb 100644 --- a/src/drivers/ms5611/ms5611.cpp +++ b/src/drivers/ms5611/ms5611.cpp @@ -526,6 +526,7 @@ void MS5611::cycle() { int ret; + unsigned dummy; /* collection phase? */ if (_collect_phase) { @@ -542,6 +543,8 @@ MS5611::cycle() } else { //log("collection error %d", ret); } + /* issue a reset command to the sensor */ + _interface->ioctl(IOCTL_RESET, dummy); /* reset the collection state machine and try again */ start_cycle(); return; @@ -573,6 +576,8 @@ MS5611::cycle() ret = measure(); if (ret != OK) { //log("measure error %d", ret); + /* issue a reset command to the sensor */ + _interface->ioctl(IOCTL_RESET, dummy); /* reset the collection state machine and try again */ start_cycle(); return;