@dc42 Thanks, David!
Latest posts made by wackyfrog
-
RE: Unexpected behaviour of expression { } in command parameters.
As a workaround, I'm currently using the code below, but I would like to figure out how to correctly pass multiple values using variables in such parameters.
M581 T9 P-1 M581 T9 R0 S1 P{global.x_axis_endstop_pin} M581 T9 R0 S1 P{global.y_axis_left_endstop_pin} M581 T9 R0 S1 P{global.y_axis_right_endstop_pin} M581 T9 R0 S1 P{global.z_axis_endstop_pin} M581 T9 Result: Trigger 9 fires on a rising edge of endstops/inputs 6 7 8 9
-
RE: Unexpected behaviour of expression { } in command parameters.
@dc42 I've got the error:
M581 T9 R0 S1 P{global.x_axis_endstop_pin ^ "+" ^ global.y_axis_left_endstop_pin ^ "+" ^ global.y_axis_right_endstop_pin ^ "+" ^ global.z_axis_endstop_pin} Error: M581: expected integer value
-
RE: Unexpected behaviour of expression { } in command parameters.
Returning to the question, I found that the solution still does not work.
Tested on Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.0 (2022-03-15)
Operator '+' just summarizes pins values and as result I have one pin number 30 instead of 4 pins (6:7:8:9)
G-CODE to reproduce
; Variables global x_axis_endstop_pin = 6 global y_axis_left_endstop_pin = 7 global y_axis_right_endstop_pin = 8 global z_axis_endstop_pin = 9 ; remove all pins from trigger M581 T9 P-1 ; check the trigger configuration M581 T9 Result: Trigger 9 is not configured ; setup new pins M581 T9 R0 S1 P{global.x_axis_endstop_pin + global.y_axis_left_endstop_pin + global.y_axis_right_endstop_pin + global.z_axis_endstop_pin} ; check what we have M581 T9 Result: Trigger 9 fires on a rising edge of endstops/inputs 30
-
RE: Unexpected behaviour of expression { } in command parameters.
@jay_s_uk said in Unexpected behaviour of expression { } in command parameters.:
@adegtiar there should be + in between , not a ,
Thank you! It works
-
RE: Unexpected behaviour of expression { } in command parameters.
@dc42 said in Unexpected behaviour of expression { } in command parameters.:
@adegtiar I have updated https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands#Section_Use_of_expressions_within_GCode_commands to show the correct syntax.
I have tried that syntax, but got an error:
M581 T9 R0 S1 P{global.x_axis_endstop_pin, global.y_axis_left_endstop_pin, global.y_axis_right_endstop_pin, global.z_axis_endstop_pin} Error: M581: expected '}'
-
Unexpected behaviour of expression { } in command parameters.
Hi, David!
It seems that not more that one expression can be used when it is necessary to specify several values, for instance:
M581 P{var.myVar1}:{var.myVar2}:{var.myVar3} ...
My test g-code:
global x_axis_endstop_pin = 6 global y_axis_left_endstop_pin = 7 global y_axis_right_endstop_pin = 8 global z_axis_endstop_pin = 9 echo {global.x_axis_endstop_pin} echo {global.y_axis_left_endstop_pin} echo {global.y_axis_right_endstop_pin} echo {global.z_axis_endstop_pin} ; Emergency stop trigger on endstops hits M581 T8 R0 S1 P{global.x_axis_endstop_pin}:{global.y_axis_left_endstop_pin}:{global.y_axis_right_endstop_pin}:{global.z_axis_endstop_pin}
Only the first pin triggers when its state changes. The rest 3 specified pins does not cause the trigger.
Am I use wrong syntax or it is a bug ?
Echoed values are correct, additionally I have checked them in the object viewer.
And all 4 pins work correctly only when I specify them manually, like this:
M581 T8 R0 S1 P6:7:8:9
Board: Duet 2 WiFi (2WiFi)
Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.0beta5 (2021-10-12)Thank you very much!
-
RE: Spindle immediately turns off on error
@dc42 Good idea! But in order to correctly interpret when it happened (just) or a long time ago, it would be good to either reset this status on request (for example, after processing inside a trigger) or so that the last status has the time of the event, how long ago it happened at the time of its reading. Just for example:
if {job.lastPrintStatus='some failure code'} && {job.lastPrintStatusAge < 10} ; react if it is a 'fresh' event, not older 10 seconds (or a couple seconds would be enough for process) echo "Last recent job failed"; ; proposition for event age value ; if this code executes just after error event echo {job.lastPrintStatusAge} ; will be 0 sec G4 S1.0 echo {job.lastPrintStatusAge} ; will be 1 sec G4 S10.0 echo {job.lastPrintStatusAge} ; will be 11 sec
-
RE: Spindle immediately turns off on error
@bearer Cam simulations is OK. Out of bounds of coordinates occurred due to the incorrect WCS (a few mm was insufficient).