Meta command type of variable
-
Hello
I am trying to configure a multi filament divider including a switch whose purpose is to check if the previous filament has been correctly unloaded before loading the next one (I had issues already).
Conditional GCode is my friend no problem. But now I am trying to load the filament until reaching that switch. For that, I am using a fictive axis U. Here is my GCODE:M18 U ; disable the steppers linked to U that we are going to reassign M584 U3 ; assign axis U to driver 3 (extruder E0) M350 U16 I1 ; configure microstepping with interpolation M92 U400 ; set steps per mm M566 U150.00 ; set maximum instantaneous speed changes (mm/min) M203 U1200.00 ; set maximum speeds (mm/min) M201 U250.00 ; set accelerations (mm/s^2) M906 U800 I30 ; set motor currents (mA) and motor idle factor in per cent M208 U800 S0 ; set U axis maximum value M574 U2 S1 P"^!e0stop" ; configure active-low (S0) endstop for high end (U2) on U axis G91 ; relative moves G92 U0 ; force U to 0mm G1 U800 H1 F3000 ; feed filament to filament sensor G92 U0 ; force U to 0mm
This seem an ugly solution but it works. For now I need a macro like this for each driver.
Question1: Do I need to redefine stepper data (like acceleration, step/mm and so) at each time?
Question2: is there another solution more elegant for achieving this?
Question3: I want this macro to use the active extruder without to specify it explicitly. For that , I tried to use OM variable. For example, I replaced the 1st M594 gcode with:M584 U{move.extruders[state.currentTool].driver}
Problem: I got an error message "M584: expected non negative integer value". I suspect that
move.extruders[state.currentTool].driver returns a string data... How to workaround this?Thanks a lot for your help
PS: I am running DUET 2 on RFF3.3 -
@arno91
Hi , I use similar solution to load filament with MMU feeder and extruder in sync:M574 V2 S1 P"duex.e6stop" ; M400 M18 V E0:1:2:3:4 ; disable the axes/extruder to reassign M584 V3:8 ; reassign them M906 V800 ; set the motor currents M350 V16 I1 ; set the microstepping G92 V0 echo ">reassigned motor" M98 P"/sys/SERVO/ON.g" ;engage MMU G1 H4 V1000 F500 ;load to extruder endstop M98 P"/sys/SERVO/OFF.g" ;disengage MMU M400 M18 V0:1 ; disable the axes/extruder to reassign M584 V8 ; M906 V1400 E1000 ; set the motor currents M913 E80 M350 V16 E16 I1 G92 V0
- 1- I don't redefine stepper data and it works
- 2- I think is a good solution , the only thing is to leave the same situation you found in the beginning
- 3- answered by dc42
I take this opportunity to ask a question @dc42
in my config.g I have:M584 X0 Y1 Z2:9 E3:3:3:3:3 U4 V8 P5 [...] M563 P0 S"E1 " D0 H1 F2 ; Define tool 0 P=tool number, D=driver number, H=heather, F= fan M563 P1 S"E2 " D1 H1 F2 ; Define tool 1 M563 P2 S"E3 " D2 H1 F2 ; Define tool 2 M563 P3 S"E4 " D3 H1 F2 ; Define tool 3 M563 P4 S"E5 " D4 H1 F2 ; Define tool 4 [...]
and the macro executed in the tool change has the code I posted above, I do not reassign the stepper drives to the E axis (no "M584 Ex" other then the one in config.g). Given that the procedure works right now, there is something wrong that could give me problems perhaps following updates of the firmware?
-
@arno91
The error you're getting would occur if no tool was selected
state.currentTool would return -1
You should check if a tool is selected at the beginning. -
@owend Thanks for answering. Actually there is 1 tool selected. If I compute the command with echo instead of M584, it works...
Another interesting fact:var activeDriver = {abs(move.extruders[state.currentTool].driver)}
produce an error: "meta command: expected numeric operand". Thus the result of a command is a string. Is there a way to cast it to a int?
-
-
@arno91 the result is a driver ID which is a composite type that includes both the CAN address and the driver number within that board. That's why it isn't a valid operand to the abs function I'll look into why the M584 command doesn't work.
EDIT: That type of M584 command works for me, using a RRF 3.4beta release.
-
@dc42 Thanks a lot for answering. Ok copied for the abs command. I will try to upgrade my board to RFF3.4 then...
Would you have any tips about question1:
Question1: Do I need to redefine stepper data (like acceleration, step/mm and so) at each time? -
@arno91
Hi , I use similar solution to load filament with MMU feeder and extruder in sync:M574 V2 S1 P"duex.e6stop" ; M400 M18 V E0:1:2:3:4 ; disable the axes/extruder to reassign M584 V3:8 ; reassign them M906 V800 ; set the motor currents M350 V16 I1 ; set the microstepping G92 V0 echo ">reassigned motor" M98 P"/sys/SERVO/ON.g" ;engage MMU G1 H4 V1000 F500 ;load to extruder endstop M98 P"/sys/SERVO/OFF.g" ;disengage MMU M400 M18 V0:1 ; disable the axes/extruder to reassign M584 V8 ; M906 V1400 E1000 ; set the motor currents M913 E80 M350 V16 E16 I1 G92 V0
- 1- I don't redefine stepper data and it works
- 2- I think is a good solution , the only thing is to leave the same situation you found in the beginning
- 3- answered by dc42
I take this opportunity to ask a question @dc42
in my config.g I have:M584 X0 Y1 Z2:9 E3:3:3:3:3 U4 V8 P5 [...] M563 P0 S"E1 " D0 H1 F2 ; Define tool 0 P=tool number, D=driver number, H=heather, F= fan M563 P1 S"E2 " D1 H1 F2 ; Define tool 1 M563 P2 S"E3 " D2 H1 F2 ; Define tool 2 M563 P3 S"E4 " D3 H1 F2 ; Define tool 3 M563 P4 S"E5 " D4 H1 F2 ; Define tool 4 [...]
and the macro executed in the tool change has the code I posted above, I do not reassign the stepper drives to the E axis (no "M584 Ex" other then the one in config.g). Given that the procedure works right now, there is something wrong that could give me problems perhaps following updates of the firmware?
-