1.2109 - macro + while(){}
Posted: Thu Mar 07, 2019 7:34 am
I don't know if this is a bug or just (my) bad macro code?
I wrote a macro which has a while (){} statement within it , but when I pressed the reset / e-stop the macro remained running and it did not terminate the macro as I thought it probably would.
I added a work around to the macro to kill the macro in event of a reset / e-stop.
BAD CODE (potential bug):
WORK AROUND CODE:
I've not tried the bad code with any previous development / the stable release to see if the issue is consistent.
thought it may be worth a check if it was a bug or not.
I wrote a macro which has a while (){} statement within it , but when I pressed the reset / e-stop the macro remained running and it did not terminate the macro as I thought it probably would.
I added a work around to the macro to kill the macro in event of a reset / e-stop.
BAD CODE (potential bug):
- Code: Select all
if (AS3.GetLED(11))
{
exec.Setoutpin( 1, 1);
while (AS3.GetLED(10) && AS3.GetLED(11))
{
Thread.Sleep(50);
}
exec.Clroutpin( 1, 1);
}
return;
WORK AROUND CODE:
- Code: Select all
if (AS3.GetLED(11))
{
exec.Setoutpin( 1, 1);
while (AS3.GetLED(10) && AS3.GetLED(11))
{
Thread.Sleep(50);
if (AS3.GetLED(25))
{
exec.Clroutpin( 1, 1);
return;
}
}
exec.Clroutpin( 1, 1);
}
return;
I've not tried the bad code with any previous development / the stable release to see if the issue is consistent.
thought it may be worth a check if it was a bug or not.