Start.g Issues
-
I understand that Start.g can be used instead of inserting start gcode into the Slicer (Slc3r in my case). What I would like my printer to do is:
- Turn on the heated bed to 60 deg (so it is starting to warm up to reduce start up time a bit)
- Level the two Z motors (using G32 and bed.g)
- Probe each of the four corners of the bed (using G29 with M557 in config.g)
- Heat up the bed & extruder to the temperatures set in the slicer before starting to print.
If I put all my code into Start.g it works as expected, up to heating the extruder and bed, but then It skips M140/M190 and tries to start printing (but as expected, it fails with an error message to the effect that the extruder has not reached temperature).
If I put just the G code for steps 1-3 above in Start.g and the rest in the slicer, it works as I would like it to do, but this defeats the object and convenience of having all the start code in one place in Start.g.
I believe it is skipping the heating functions because the gcode is looking for the first layer temperatures entered in the slicer and the code cannot be read at this stage.
Is there anything I can do the get the temperature information from the slicer and have everything in Start.g. (or anything else I can do to improve my start code)
My Duet Start.g :
M140 S60
G32
G29
M83 ; extruder relative modeMy code in the slicer is:
M140 S[first_layer_bed_temperature] ;set bed temp
M190 S[first_layer_bed_temperature] ;wait for bed temp
M104 S[first_layer_temperature] ;set extruder temp
M109 S[first_layer_temperature] ;wait for extruder temp
G92 E0
G1 X8.0 F2000
G1 Y8.0 F2000
G1 Z0.1 F1000
G1 X60.0 E4.0 F1000.0 ; prime
G1 X100.0 E8.5 F1000.0 ; prime
G92 E0
T0
M116
M376 H10 ;set bed compensation taper
M572 D0 S0.025 ;set pressure advance
Duet Web Control 2.0.0-RC3
Electronics: Duet WiFi 1.02 or laterFirmware:
RepRapFirmware for Duet 2 WiFi/Ethernet 2.02(RTOS) (2018-12-24b1)
Duet WiFi Server Version: 1.22
Prusa Style CartesianThanks John S
-
@jmshep At the moment, you can't pass variables to macros (which is what start.g is) so you have to use fixed values. I do something similar but instead of using start.g I have "pre-print" macros which I call from the slicer start code. There is still no way to pass variables but it does allow me to have a number of macros - one for each temperature that I want to use.
-
@jmshep said in Start.g Issues:
M140 S[first_layer_bed_temperature] ;set bed temp
M190 S[first_layer_bed_temperature] ;wait for bed temp
M104 S[first_layer_temperature] ;set extruder temp
M109 S[first_layer_temperature] ;wait for extruder tempSlicers can only substitute the placeholder fields when they are in their own gcode sections. Start.g won't know what those fields represent.
I do something similar to what you want, so maybe it will work for you too, but it does require splitting the code into different places.
I use 3 sections of starting gcode that work together to do what I want.
Start.g contains a preheat and some other prep to reset from the previous print.
M140 S65 ; set heated bed to 65 and release T0 ; Select Tool 0 M291 P"Print Started. Preheating and Homing." T10 G4 S1 M98 P"0:/macros/Musical Tunes/LuckyTune.g" ; Lucky tune to start print off on the right foot G4 S1 M220 S100 ; Set speed factor back to 100% in case it was changed M221 S100 ; Set extrusion factor back to 100% in case it was changed M290 R0 S0 ; clear babystepping M106 S0 ; Turn part cooling blower off if it is on G10 P0 R0 S80 ; Set extruder to 80 and release M190 S65 ; set heated bed to 65 and wait G28 ; home XYZ G10 P0 R100 S180 ; Set extruder to 180 and release ; Slicer Start Gcode begins.
The slicer start code contains the temp setting gcode, and then calls a macro to prime the nozzle:
M109 S[first_layer_temperature] ; Set extruder to first layer temp and wait G10 P0 R100 S[first_layer_temperature] ; set temp and standby temp M116 ; wait for temps M98 P"0:/sys/PrimeNozzle.g" M98 P"0:/macros/musicaltunes/Charge.g" ;Print starts
PrimeNozzle contains:
;M98 P"0:/sys/PrimeNozzle.g" G90 ; Absolute positioning G1 X1 Y270 F6000 ; Move to front left corner M400 ; clear movement buffer M116 ; Wait for temps G1 Z0.3 F100 ; Move Z to prime height G91 ; Relative positioning M83 ; Relative extrusion G1 X40 E10 F300 ; Prime nozzle G10 ; Retract G1 Y-1 X1 F10000 ; Wipe nozzle M98 P"ZSpeedsPrint.g" ; Load Z speeds for printing
Now if you're only ever printing PLA at the same temps all the time you could set the print temps in start.g or set them before starting the print manually.
-
Thanks to you both for clarifying this for me.
I think the best option that suits me is to split my code between Start.g and the Slicer start code as I have it now. Some interesting additions thanks to Phaedrux to look at though. -
@jmshep Just to round things off, you can call other macros from within macros.
So for example, my slicer start gcode just has one line which calls a "pre-print" macro. This macro starts by heating the bed to 40 deg C and waits. Once the temperature has been reached, it then sets the bed temperature to (say) 50 deg C but does not wait. At the same time, it runs a G28 command which calls my homeall.g. Because I use my nozzle as a probe, the first line of the home all macro heats the hot end to 140 deg C to soften any plastic that may have oozed out of the nozzle. Then the homing sequence finishes and control gets passed back to the "pre-print" macro which now selects the active and standby temperatures for all the tools, selects a tool, moves the carriage to the rear of the printer then waits for all temperatures to reach their set points. When that happens, the nozzle then gets wiped and printing starts.
In practice, all I do is select a file and hit "print". The bed starts to heat and once it reaches 40 deg C everything else gets heated, homed, primed and wiped during the time it takes to complete heating the bed. I have different printer settings in the slicer which simply point to a different macro in the start gcode to set the required hot end and bed temperatures.
HTH