py_ext/plc_python.c
changeset 4109 2fb97bc2158a
parent 4104 9e59bb5ad9e1
--- a/py_ext/plc_python.c	Sun Jan 26 14:58:13 2025 +0100
+++ b/py_ext/plc_python.c	Fri Feb 07 18:42:43 2025 +0100
@@ -156,7 +156,7 @@
 	}
 }
 
-char* PythonIterator(char* result, void** id)
+char* PythonIterator(char* result, void** id, int* is_last)
 {
 	char* next_command;
 	PYTHON_EVAL* data__;
@@ -213,6 +213,8 @@
 	/* next command is BUFFER */
 	next_command = (char*)__GET_VAR(data__->BUFFER, .body);
 	*id=data__;
+    /*check if last command in the queue */
+	*is_last = EvalFBs[(Current_Python_EvalFB + 1) %% %(python_eval_fb_count)d] == NULL;
 	/* free python mutex */
 	UnLockPython();
 	/* return the next command to eval */