AP_Vehicle: move scripting up to AP_Vehicle

This commit is contained in:
Peter Barker 2024-01-30 13:41:27 +11:00 committed by Andrew Tridgell
parent 13af81ba61
commit 6da7cfcf4e
2 changed files with 18 additions and 4 deletions

View File

@ -258,6 +258,12 @@ const AP_Param::GroupInfo AP_Vehicle::var_info[] = {
AP_SUBGROUPINFO(stats, "STAT", 27, AP_Vehicle, AP_Stats),
#endif
#if AP_SCRIPTING_ENABLED
// @Group: SCR_
// @Path: ../AP_Scripting/AP_Scripting.cpp
AP_SUBGROUPINFO(scripting, "SCR_", 28, AP_Vehicle, AP_Scripting),
#endif
AP_GROUPEND
};
@ -367,6 +373,10 @@ void AP_Vehicle::setup()
// init_ardupilot is where the vehicle does most of its initialisation.
init_ardupilot();
#if AP_SCRIPTING_ENABLED
scripting.init();
#endif // AP_SCRIPTING_ENABLED
#if AP_AIRSPEED_ENABLED
airspeed.init();
if (airspeed.enabled()) {
@ -976,10 +986,7 @@ void AP_Vehicle::one_Hz_update(void)
}
#if AP_SCRIPTING_ENABLED
AP_Scripting *scripting = AP_Scripting::get_singleton();
if (scripting != nullptr) {
scripting->update();
}
scripting.update();
#endif
}

View File

@ -69,6 +69,9 @@
#include <AP_KDECAN/AP_KDECAN.h>
#include <Filter/AP_Filter.h>
#include <AP_Stats/AP_Stats.h> // statistics library
#if AP_SCRIPTING_ENABLED
#include <AP_Scripting/AP_Scripting.h>
#endif
class AP_DDS_Client;
@ -415,6 +418,10 @@ protected:
AP_TemperatureSensor temperature_sensor;
#endif
#if AP_SCRIPTING_ENABLED
AP_Scripting scripting;
#endif
static const struct AP_Param::GroupInfo var_info[];
static const struct AP_Scheduler::Task scheduler_tasks[];