diff --git a/ArduPlane/Parameters.cpp b/ArduPlane/Parameters.cpp index 5dfcee011d..d57e38db4f 100644 --- a/ArduPlane/Parameters.cpp +++ b/ArduPlane/Parameters.cpp @@ -1177,6 +1177,11 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = { // @User: Advanced AP_GROUPINFO("FLIGHT_OPTIONS", 13, ParametersG2, flight_options, 0), +#ifdef ENABLE_SCRIPTING + // Scripting is intentionally not showing up in the parameter docs until it is a more standard feature + AP_SUBGROUPINFO(scripting, "SCR_", 14, ParametersG2, AP_Scripting), +#endif + AP_GROUPEND }; diff --git a/ArduPlane/Parameters.h b/ArduPlane/Parameters.h index 37670edb0c..6b891f9469 100644 --- a/ArduPlane/Parameters.h +++ b/ArduPlane/Parameters.h @@ -545,6 +545,10 @@ public: #endif AP_Int32 flight_options; + +#ifdef ENABLE_SCRIPTING + AP_Scripting scripting; +#endif // ENABLE_SCRIPTING }; extern const AP_Param::Info var_info[]; diff --git a/ArduPlane/Plane.h b/ArduPlane/Plane.h index f7c3114410..4810066688 100644 --- a/ArduPlane/Plane.h +++ b/ArduPlane/Plane.h @@ -108,6 +108,10 @@ // Local modules #include "defines.h" +#ifdef ENABLE_SCRIPTING +#include +#endif + #include "RC_Channel.h" // RC Channel Library #include "Parameters.h" #include "avoidance_adsb.h" diff --git a/ArduPlane/system.cpp b/ArduPlane/system.cpp index 697437271e..3c449d234a 100644 --- a/ArduPlane/system.cpp +++ b/ArduPlane/system.cpp @@ -251,6 +251,12 @@ void Plane::startup_ground(void) ); #endif +#ifdef ENABLE_SCRIPTING + if (!g2.scripting.init()) { + gcs().send_text(MAV_SEVERITY_ERROR, "Scripting failed to start"); + } +#endif // ENABLE_SCRIPTING + // reset last heartbeat time, so we don't trigger failsafe on slow // startup failsafe.last_heartbeat_ms = millis();