Hello everyone,
I really can't figure out a weird behaviour I'm experiencing with a custom .sub file.§
I created a custom .sub file to perform some activities in background, basically how to react to errors and some other events (I/O).
Here's a piece of code to look at:
Code
DEF CUSTOM( )
;FOLD DECLARATIONS
ENUM TYPE ASD1, ASD2, ASD3
DECL TYPE CLTYPE
;ENDFOLD (DECLARATIONS)
LOOP
SWITCH CLTYPE
CASE ASD1
IF $STOPMESS==TRUE THEN ;<----- ISSUE
msgnotify ("error detected")
SOMEPROGRAM()
ENDIF
IF ($IN[5]==TRUE) OR ($IN[23] == FALSE) THEN
OTHERPROGRAM()
ENDIF
CASE [...]
[...]
Display More
The issue is in LINE 12, where despite having an IF $STOPMESS==TRUE THEN, the msgnotify and the SOMEPROGRAM lines are executed anyway each cycle.
It seems that for some reasons $STOPMESS is always detected as TRUE.
I'm not adding more info just because I believe this is purely code-related, as the robot was not in error state during the test I have done.
Anyone has any insight on why it is ignoring the IF?