Duet3D / RepRapFirmware

OO C++ RepRap Firmware
GNU General Public License v3.0
940 stars 532 forks source link

Extra indentation causes script not to work #897

Closed dc42 closed 1 year ago

dc42 commented 1 year ago

Duet Forum Discussion Thread

https://forum.duet3d.com/topic/33363/writing-variables-to-a-file-problems-with-nested-echo-commands

Which Duet products are you using?

Firmware Version

3.5.0-beta.4

Duet Web Control Version

3.5.0-beta.4

Are you using a Single Board Computer (RaspberryPi) with your Duet?

What happened?

Additional indentation between a M291 command in an if-block and a following nested if-block appears to cause the nested if-block not to be executed. Un-indenting the if-block relative to the M291 command solved it. Inserting an un-indented echo command between the M291 command and the indented if-block also solved it.

dc42 commented 1 year ago

Simple test script to demonstrate the problem:

if true
    M291 S2 P"Press OK"
        echo "got ok"

Another example:

if true
    M120
    M121
        echo "got ok"

In both cases the "got ok" message is not echoed, unless either it is not indented wrt the previous M291 or M121 command, or another echo command that is not indented is inserted before it.

dc42 commented 1 year ago

Fixed in 3.5-dev branch.