Change behaviour of python_eval function block : if TRIG is false, then ACK is also false except a pulse precisely when receiving answer from interpreter
--- a/py_ext/plc_python.c Wed Sep 05 12:58:41 2018 +0200
+++ b/py_ext/plc_python.c Tue Sep 11 16:08:21 2018 +0200
@@ -89,6 +89,10 @@
*/
void __PythonEvalFB(int poll, PYTHON_EVAL* data__)
{
+ if(!__GET_VAR(data__->TRIG)){
+ /* ACK is False when TRIG is false, except a pulse when receiving result */
+ __SET_VAR(data__->, ACK,, 0);
+ }
/* detect rising edge on TRIG to trigger evaluation */
if(((__GET_VAR(data__->TRIG) && !__GET_VAR(data__->TRIGM1)) ||
/* polling is equivalent to trig on value rather than on rising edge*/
@@ -109,7 +113,7 @@
if(__GET_VAR(data__->STATE) == PYTHON_FB_ANSWERED){
/* Copy buffer content into result*/
__SET_VAR(data__->, RESULT,, __GET_VAR(data__->BUFFER));
- /* signal result presece to PLC*/
+ /* signal result presence to PLC*/
__SET_VAR(data__->, ACK,, 1);
/* Mark as free */
__SET_VAR(data__->, STATE,, PYTHON_FB_FREE);