From c765979f9ac446f2f2a230d2252a54e7da26e580 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 21 Apr 2016 16:11:21 +1000 Subject: [PATCH] DataFlash: expose the number of lost log messages will be logged in PM message --- libraries/DataFlash/DataFlash.cpp | 8 ++++++++ libraries/DataFlash/DataFlash.h | 3 +++ libraries/DataFlash/DataFlash_Backend.h | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/libraries/DataFlash/DataFlash.cpp b/libraries/DataFlash/DataFlash.cpp index e79b9144cf..24c1c1083c 100644 --- a/libraries/DataFlash/DataFlash.cpp +++ b/libraries/DataFlash/DataFlash.cpp @@ -203,6 +203,14 @@ void DataFlash_Class::Log_Write_Mission_Cmd(const AP_Mission &mission, FOR_EACH_BACKEND(Log_Write_Mission_Cmd(mission, cmd)); } +uint32_t DataFlash_Class::num_dropped() const +{ + if (_next_backend == 0) { + return 0; + } + return backends[0]->num_dropped(); +} + // end functions pass straight through to backend diff --git a/libraries/DataFlash/DataFlash.h b/libraries/DataFlash/DataFlash.h index 16df684b8a..01f1471fa5 100644 --- a/libraries/DataFlash/DataFlash.h +++ b/libraries/DataFlash/DataFlash.h @@ -159,6 +159,9 @@ public: void periodic_tasks(); // may want to split this into GCS/non-GCS duties + // number of blocks that have been dropped + uint32_t num_dropped(void) const; + vehicle_startup_message_Log_Writer _vehicle_messages; // parameter support diff --git a/libraries/DataFlash/DataFlash_Backend.h b/libraries/DataFlash/DataFlash_Backend.h index 7a66e7c2d2..b172282190 100644 --- a/libraries/DataFlash/DataFlash_Backend.h +++ b/libraries/DataFlash/DataFlash_Backend.h @@ -94,6 +94,10 @@ public: const AP_Param::ParamToken &token, enum ap_var_type type); + uint32_t num_dropped(void) const { + return _dropped; + } + protected: uint32_t dropped; uint8_t internal_errors; // uint8_t - wishful thinking?