From 2263dced74c2f51af8be378b7d6dc36b02e54383 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 15 Feb 2024 08:48:02 +1100 Subject: [PATCH] AP_Scripting use scheduler semaphore only if AP_SCHEDULER_ENABLED --- libraries/AP_Scripting/generator/src/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/AP_Scripting/generator/src/main.c b/libraries/AP_Scripting/generator/src/main.c index da19db6778..de1c6e48ec 100644 --- a/libraries/AP_Scripting/generator/src/main.c +++ b/libraries/AP_Scripting/generator/src/main.c @@ -1918,7 +1918,9 @@ void emit_userdata_method(const struct userdata *data, const struct method *meth } else if (data->flags & UD_FLAG_SEMAPHORE_POINTER) { fprintf(source, " %s%sget_semaphore()->take_blocking();\n", ud_name, ud_access); } else if (data->flags & UD_FLAG_SCHEDULER_SEMAPHORE) { + fprintf(source, "#if AP_SCHEDULER_ENABLED\n"); fprintf(source, " AP::scheduler().get_semaphore().take_blocking();\n"); + fprintf(source, "#endif\n"); } int static_cast = TRUE; @@ -2050,7 +2052,9 @@ void emit_userdata_method(const struct userdata *data, const struct method *meth } else if (data->flags & UD_FLAG_SEMAPHORE_POINTER) { fprintf(source, " %s%sget_semaphore()->give();\n", ud_name, ud_access); } else if (data->flags & UD_FLAG_SCHEDULER_SEMAPHORE) { + fprintf(source, "#if AP_SCHEDULER_ENABLED\n"); fprintf(source, " AP::scheduler().get_semaphore().give();\n"); + fprintf(source, "#endif\n"); } // we need to emit out refernce arguments, iterate the args again, creating and copying objects, while keeping a new count