From 8ff9fc0f70a402afa4ba87e392584268effbcf9c Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sat, 15 Jul 2023 14:41:37 +1000 Subject: [PATCH] AP_Logger: add Write_NamedValueFloat for getting diagnostics into the code during ddebug fast --- libraries/AP_Logger/AP_Logger.cpp | 14 ++++++++++++++ libraries/AP_Logger/AP_Logger.h | 1 + 2 files changed, 15 insertions(+) diff --git a/libraries/AP_Logger/AP_Logger.cpp b/libraries/AP_Logger/AP_Logger.cpp index 02d237b6ac..d0b0f7b5a3 100644 --- a/libraries/AP_Logger/AP_Logger.cpp +++ b/libraries/AP_Logger/AP_Logger.cpp @@ -912,6 +912,20 @@ void AP_Logger::Write_Fence() } #endif +void AP_Logger::Write_NamedValueFloat(const char *name, float value) +{ + WriteStreaming( + "NVF", + "TimeUS,Name,Value", + "s#-", + "F--", + "QNf", + AP_HAL::micros(), + name, + value + ); +} + // output a FMT message for each backend if not already done so void AP_Logger::Safe_Write_Emit_FMT(log_write_fmt *f) { diff --git a/libraries/AP_Logger/AP_Logger.h b/libraries/AP_Logger/AP_Logger.h index 8fafb9b10a..84b1d25218 100644 --- a/libraries/AP_Logger/AP_Logger.h +++ b/libraries/AP_Logger/AP_Logger.h @@ -247,6 +247,7 @@ public: #if HAL_LOGGER_FENCE_ENABLED void Write_Fence(); #endif + void Write_NamedValueFloat(const char *name, float value); void Write_Power(void); void Write_Radio(const mavlink_radio_t &packet); void Write_Message(const char *message);