From 456cdadb821d300a35cb8f028f931e6608f1ac9e Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 10 Dec 2025 13:38:47 +1100 Subject: [PATCH] SITL: allow calling of init multiple times ... to allow for esp32 using existing init call and HAL_ChibiOS making the call very early --- libraries/SITL/SITL.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/SITL/SITL.h b/libraries/SITL/SITL.h index 0b8cbb7b83..2cc3ae52ff 100644 --- a/libraries/SITL/SITL.h +++ b/libraries/SITL/SITL.h @@ -127,6 +127,11 @@ public: static SIM *get_singleton() { return _singleton; } void init() { + if (init_done) { + return; + } + init_done = true; + AP_Param::setup_object_defaults(this, var_info); AP_Param::setup_object_defaults(this, var_info2); AP_Param::setup_object_defaults(this, var_info3); @@ -149,6 +154,7 @@ public: mag_ofs[i].set(Vector3f(5, 13, -18)); } } + bool init_done; enum SITL_RCFail { SITL_RCFail_None = 0,