From 0694154f1c69b004caa4ceb7ebb29f2a0cacf1e8 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 7 Feb 2024 20:50:34 +1100 Subject: [PATCH] AP_Vehicle: move logger object up to AP_Vehicle --- libraries/AP_Vehicle/AP_Vehicle.cpp | 10 ++++++++++ libraries/AP_Vehicle/AP_Vehicle.h | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/libraries/AP_Vehicle/AP_Vehicle.cpp b/libraries/AP_Vehicle/AP_Vehicle.cpp index 37507b41a2..bfaa356e8f 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.cpp +++ b/libraries/AP_Vehicle/AP_Vehicle.cpp @@ -264,6 +264,12 @@ const AP_Param::GroupInfo AP_Vehicle::var_info[] = { AP_SUBGROUPINFO(scripting, "SCR_", 28, AP_Vehicle, AP_Scripting), #endif +#if HAL_LOGGING_ENABLED + // @Group: LOG + // @Path: ../AP_Logger/AP_Logger.cpp + AP_SUBGROUPINFO(logger, "LOG", 29, AP_Vehicle, AP_Logger), +#endif + AP_GROUPEND }; @@ -372,6 +378,10 @@ void AP_Vehicle::setup() can_mgr.init(); #endif +#if HAL_LOGGING_ENABLED + logger.init(get_log_bitmask(), get_log_structures(), get_num_log_structures()); +#endif + // init_ardupilot is where the vehicle does most of its initialisation. init_ardupilot(); diff --git a/libraries/AP_Vehicle/AP_Vehicle.h b/libraries/AP_Vehicle/AP_Vehicle.h index 953ea8d7c5..33797531a6 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.h +++ b/libraries/AP_Vehicle/AP_Vehicle.h @@ -37,6 +37,7 @@ #include #include #include +#include #include // Notify library #include #include @@ -317,6 +318,14 @@ protected: #endif RangeFinder rangefinder; +#if HAL_LOGGING_ENABLED + AP_Logger logger; + // method supplied by vehicle to provide log bitmask: + virtual const AP_Int32 &get_log_bitmask() = 0; + virtual const struct LogStructure *get_log_structures() const = 0; + virtual uint8_t get_num_log_structures() const = 0; +#endif + #if AP_RSSI_ENABLED AP_RSSI rssi; #endif