From 256b6703f18b7b36df45da344446c880237a835c Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 3 Jun 2019 13:20:53 +1000 Subject: [PATCH] AP_InternalError: keep count of number of errors having occured --- libraries/AP_InternalError/AP_InternalError.cpp | 4 +++- libraries/AP_InternalError/AP_InternalError.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/AP_InternalError/AP_InternalError.cpp b/libraries/AP_InternalError/AP_InternalError.cpp index 52217a3289..a8123276cf 100644 --- a/libraries/AP_InternalError/AP_InternalError.cpp +++ b/libraries/AP_InternalError/AP_InternalError.cpp @@ -17,8 +17,10 @@ void AP_InternalError::error(const AP_InternalError::error_t e) { } #endif internal_errors |= uint32_t(e); + total_error_count++; + hal.util->persistent_data.internal_errors = internal_errors; - hal.util->persistent_data.internal_error_count++; + hal.util->persistent_data.internal_error_count = total_error_count; } diff --git a/libraries/AP_InternalError/AP_InternalError.h b/libraries/AP_InternalError/AP_InternalError.h index 770a03a325..997439af82 100644 --- a/libraries/AP_InternalError/AP_InternalError.h +++ b/libraries/AP_InternalError/AP_InternalError.h @@ -54,6 +54,7 @@ public: }; void error(const AP_InternalError::error_t error); + uint32_t count() const { return total_error_count; } // internal_errors - return mask of internal errors seen uint32_t errors() const { @@ -64,6 +65,8 @@ private: // bitmask holding errors from internal_error_t uint32_t internal_errors; + + uint32_t total_error_count; }; namespace AP {