From 268d6523e9c76e0e316bad0d2472c987a431d91d Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 9 Jun 2017 15:38:07 +1000 Subject: [PATCH] DataFlash: check all backends for sensor health --- libraries/DataFlash/DataFlash.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libraries/DataFlash/DataFlash.cpp b/libraries/DataFlash/DataFlash.cpp index cdaaa06389695..3eb7e2a22db05 100644 --- a/libraries/DataFlash/DataFlash.cpp +++ b/libraries/DataFlash/DataFlash.cpp @@ -242,7 +242,12 @@ bool DataFlash_Class::logging_enabled() const if (_next_backend == 0) { return false; } - return backends[0]->logging_enabled(); + for (uint8_t i=0; i<_next_backend; i++) { + if (backends[i]->logging_enabled()) { + return true; + } + } + return false; } bool DataFlash_Class::logging_failed() const { @@ -250,7 +255,12 @@ bool DataFlash_Class::logging_failed() const // we should not have been called! return true; } - return backends[0]->logging_failed(); + for (uint8_t i=0; i<_next_backend; i++) { + if (backends[i]->logging_failed()) { + return true; + } + } + return false; } void DataFlash_Class::Log_Write_MessageF(const char *fmt, ...)