AP_Vehicle: move logger object up to AP_Vehicle

This commit is contained in:
Peter Barker 2024-02-07 20:50:34 +11:00 committed by Andrew Tridgell
parent e39fad1411
commit 0694154f1c
2 changed files with 19 additions and 0 deletions

View File

@ -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();

View File

@ -37,6 +37,7 @@
#include <AP_ExternalControl/AP_ExternalControl_config.h>
#include <AP_GPS/AP_GPS.h>
#include <AP_Generator/AP_Generator.h>
#include <AP_Logger/AP_Logger.h>
#include <AP_Notify/AP_Notify.h> // Notify library
#include <AP_Param/AP_Param.h>
#include <AP_RangeFinder/AP_RangeFinder.h>
@ -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