bdring / FluidNC

The next generation of motion control firmware
Other
1.61k stars 383 forks source link

Flow control: skip dollar commands if parser is skipping blocks #1333

Closed dymk closed 1 month ago

dymk commented 1 month ago

Fixes a bug where dollar commands such as $Alarm/Send=1 would be executed in conditionals even if the conditional was false. Adds a test fixture.

All fixtures pass with ./fixture_tests/run_fixture /dev/cu.usbserial-31320 fixture_tests/fixtures/.

Tested with the following:

(print, start)
o100 repeat [0]
(print, fail repeat 0)
o100 endrepeat

#<count> = 0
o200 repeat [3]
#<count> = [#<count> + 1]
o200 endrepeat
(print, pass, count=%d#<count>)

o300 if [#<count> EQ 3]
(print, pass if)
o300 else
(print, fail if)
o300 endif

which produces the following output:

$LocalFS/Run=repeat.nc
ok
[MSG:INFO: PRINT, start]
[MSG:INFO: PRINT, pass, count=3]
[MSG:INFO: PRINT, pass if]
[MSG:DBG: /repeat.nc job sent]