Solved Duet controlled starting script.
-
Hi all,
Since more people in my company are using the same 3D printer running Duet, I want to use a central starting and ending script. (now everybody has their own slicer scripts, offsets, etc.)
I took inspiration from Klipper, where you define a PRINT_START macro within the Klipper config, and just call the macro with 2 variables for temperature from the slicer;
print_start EXTRUDER=[first_layer_temperature] BED=[first_layer_bed_temperature]I think I can create a macro within DUET and call it with M98, but how do I communicate the Temperatures from Prusaslicer to the DUET macro??
I could send some commands like;; EXTRUDER=[first_layer_temperature] BED=[first_layer_bed_temperature]
Which will result in these lines in the Gcode;
; EXTRUDER=215 BED=60 M98 P"print-start.g"
My question is;
How do I tell DUET that these are the values for the temps?
(FE how do I create a local variable within duet which I can call with M109 S{local variabletemp} -
-
@SanderLPFRG Perhaps you're looking for something like
M98 P"print-start.g" E[first_layer_temperature] B[first_layer_bed_temperature]
Then you can access the E and B parameters using param.E and param.B in your print-start.g macro file. Note that this requires RRF v3.4 or newer. See here for further information.
-
@chrishamm Cool! Can I make any numbers here?
so FE, also the L, F, R, B parameters?Also, I think I need to call them as a variable right? So the command will be;
M140 S[param.B] ; set bed temperature
-
@SanderLPFRG I think you can use arbitrary parameter letters but avoid G/M/T. That syntax isn't quite right, it should be
M140 S{param.B}
instead - see the documentation page I linked above. -
@chrishamm Thanks Again Chris!
So just to be sure; this would be possible;
Slicer;M98 P"print-start.g" E[first_layer_temperature] B[first_layer_bed_temperature] L{first_layer_print_min[0]} F{first_layer_print_min[1]}
Duet Macro;
; General settings; G90 ; set absolute coordinates local.purgelength = 15 ; Heat up for probing M104 S150 ; set extruder temp for bed leveling M140 S{param.B} ; set bed temperature M109 S150 ; wait for hotend probing temp M190 S{param.B} ; wait for bed temperature ; Prepare for automatic calibration M302 S140 ; lower cold extrusion limit to 160C G1 E-2 F2400 ; cold retraction M302 S170 ; restore cold extrusion limit G28 ; home printer ; Auto mesh calibration; M98 P"kinematic-tramming.g" ; Heat up for printing G90 ; absolute coordinates G1 X10 Y10 Z15 ; move to park position M104 S{param.E} ; set extruder temp M109 S{param.E} ; wait for extruder temp ; Extrude purge line G92 E0 ; reset E position G0 X{param.L} Y{param.F}-5 F4800 ; move to purge start G1 Z0.2 F720 ; move Z to purge height G1 E2 F2400 ; deretraction G91; relative movement G1 X{purgelength} E{purgelength * 0.15} F1000 ; move right G1 Y1.5 E{1.5 * 0.15} F1000 ; move down G1 X{-purgelength} E{purgelength * 0.30} F800 ; move left G92 E0 ; Reset E G90; absolute movements
-
@SanderLPFRG Please read the docs I mentioned above, it's all in there. Local variables in RRF are defined using
var foo = "bar"
and not using "local". So it should be
var purgelength = 15
and accessed usingvar.purgelength
.This won't work either:
G0 X{param.L} Y{param.F}-5 F4800 ; move to purge start
it should beG0 X{param.L} Y{param.F-5} F4800 ; move to purge start
. Likewise, replacepurgelength
withvar.purgelength
in the following lines, then it should work at first glance. -
@chrishamm Sorry,
I see indeed. I changed it and it should work.
Is it also possible to reference to the config file?For example; I want to add a G0 command that moves the Printhead to the Ymax position defined in config.g. I cannot find that in the article you mentioned
-
@SanderLPFRG That's stored in the object model. You can find an offline documentation here: https://github.com/Duet3D/RepRapFirmware/wiki/Object-Model-Documentation But I recommend you use the Object Model Plugin in DWC instead, that lets you view and copy property fields easily. You need to enable it in the settings first.
-
@chrishamm Cool!!
So FE "G0 X{move.axes[0].max}" would move to Xmax? and "G0 X{move.axes[0].max-5}" would move to Xmax-5?
-
@SanderLPFRG Yes.
-