Automatic Bed Leveling with Conditional Gcode Iterations
-
@fcwilt All makes sense. I guess it just goes back to cats, preference to work-flow, and ingrained habit.
Cheers,
Kolbi -
@Kolbi said in Automatic Bed Leveling with Conditional Gcode Iterations:
@fcwilt All makes sense. I guess it just goes back to cats, preference to work-flow, and ingrained habit.
Cheers,
KolbiI'm a dog person myself. They don't insist on hiding their location.
Frederick
-
@fcwilt Me too - that's why I only talk about skinning cats
-
@fcwilt , @Phaedrux , @bearer
During the day's events, I thought of the above conversations and formulated and blend of both ways (dwc/slicer stop/stop gcodes) to handle filament specific settings. I just made the following setups - all is working very well. It is very basic/generic but will grow from here.
Let me know any thoughts./sys/start.g:
; 0:/sys/start.g ; Executed before each print - BEFORE ANY SLICER CODE IS RAN ; This also loads the heightmap from the system's set filament type directory ; (0:/filaments/XXXX/heightmap.csv), if the heightmap does not exist, it will ; create one, and then save in the filament's directory. The HotMesh macro is ; a better choice to generate the heightmap as it performs a heat stabilization ; routine for ~5 minutes. M122 ; Clear diagnostic data to cleanly capture print evolution statistics. T0 ; Ensure the tool is selected. M280 P0 S160 ; BLTouch, alarm release. G4 P100 ; BLTouch, delay for the release command. M572 D0 S0.0 ; Clear pressure advance. 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 any baby-stepping. M106 S0 ; Turn part cooling blower off if it is on. M703 ; Execute loaded filament's config.g. G28 ; Home all. ;G1 Z5 X100 Y100 ; [PINDA] Place nozzle center of the bed, 5mm up. G1 Z160 F300 ; [BLTouch] Last chance to check nozzle cleanliness. M300 S4000 P100 G4 P200 M300 S4000 P100 ; Give a double beep. M116 ; Wait for all temperatures. M300 S4000 P100 ; Give a single beep. ; [BLTouch] Start countdown - use Z as indicator G91 ; [BLTouch] Set to Relative Positioning. while iterations <=9 ; [BLTouch] Perform 10 passes. G4 S12 ; [BLTouch] Wait 12 seconds. G1 Z-15 F300 ; [BLTouch] Move Z 15mm down. G90 ; [BLTouch] Set to Absolute Positioning. ;G4 S120 ; [PINDA] wait an additional 2 minutes for the bed to stabilize. G32 ; Level the gantry. G29 S1 [P{"0:/filaments/" ^ move.extruders[0].filament ^ "/heightmap.csv"}] ; Load bed mesh for the system's set filament type. if result > 1 ; If the file doesn't exist, perform mesh and save. G29 ; Perform mesh now. G29 S3 [P{"0:/filaments/" ^ move.extruders[0].filament ^ "/heightmap.csv"}] ; Save heightmap.csv to filament type's directory. M400 ; Finish all moves, clear the buffer. G90 ; Absolute Positioning. M83 ; Extruder relative mode. M98 P"0:/sys/current-sense-normal.g" ; Ensure that motor currents and sense are set for printing. G1 X0 Y0 F800 ; Final position before slicer's temp is reached and primeline is printed. G1 Z2 F300 ; Final position before slicer's temp is reached and primeline is printed. ; The primeline macro is executed by the slicer gcode to enable direct printing. ; of the primeline at the objects temp and to immediately print the object. ; following primeline completion. ; Slicer generated gcode takes it away from here.
/filaments/PETG/config.g
M300 S1000 P200 G4 P500 M300 S3000 P300 ; play some tones M140 S75 ; set bed temp M104 S150 ; set extruder warm-up temp ; active temp set from slicer gcode ; Insert additional filament specific settings here
ideaMaker Start GCode:
; ideaMaker Start G-Code ; Layer height={layer_height} ; Pass layer height information to DWC ; Set nozzle and bed to the specific temperatures declared within this slicer M140 S{temperature_heatbed} ; Set bed temp M104 S{temperature_extruder1} ; Set extruder temp M116 ; Wait for all temperatures ; Run macro to print primeline at a 'randomized' Y position from -1.1 to -2.9 M98 P"0:/sys/primeLine.g" ; Primeline macro ; Set pressure advance M572 D0 S0.07 ; Set pressure advance
/sys/primeline.g:
; 0:/sys/primeline.g ; Print prime-line at a 'randomized' Y position from -1.1 to -2.9 ; Charge! tune M400 ; Finish all moves, clear the buffer. G4 S1 M300 P200 S523.25 G4 P200 M300 P200 S659.25 G4 P200 M300 P200 S739.99 G4 P250 M300 P285 S880.00 G4 P450 M300 P285 S880.00 G4 P285 M300 P625 S1108.73 G4 S1 M400 G1 X0 Z0.6 Y{-2+(0.1*(floor(10*(cos(sqrt(sensors.analog[0].lastReading * state.upTime))))))} F3000.0; G92 E0.0 ; Reset the extrusion distance. G1 E8 ; Purge Bubble. G1 X60.0 E11.0 F1000.0 ; Intro line part 1. G1 X120.0 E16.0 F1000.0 ; Intro line part 2. G1 X122.0 F1000.0 ; Wipe 2mm of filament. G92 E0.0 ; Reset the extrusion distance. M400 ; Finish all moves, clear the buffer.
ideaMaker/S3D/PS End GCode:
; ideaMaker End G-Code M400 ; Make sure all moves are complete M0 ; Stop everything and run sys/stop.g
/sys/stop.g:
; 0:/sys/stop.g ; Called when M0 (Stop) is run (e.g. when a print from SD card is canceled) M83 ; Set extruder to relative mode. M106 S255 ; Turn the part cooling fan fully on. M572 D0 S0.0 ; Clear pressure advance. M220 S100 ; Set the speed factor back to 100% incase it was changed. M221 S100 ; Set the extrusion factor back to 100% incase it was changed. G1 E-2 ; Retract 2mm of filament. M104 S-273 ; Turn off the hotend. M140 S-273 ; Turn off the heatbed. G1 F1000.0 ; Set feed rate. M98 P"current-sense-homing.g" ; Adjust the current and sensitivity for homing routines. ; Let cool and wiggle for bit to reduce end stringing M300 S4000 P100 G4 P200 M300 S4000 P100 ; Give a double beep. G91 ; Set to Relative Positioning. G1 Z2 F400 ; Move Z axis up 3mm. ; Start countdown - use X/Y as indicators of counting while iterations <=9 ; Perform 10 passes. G4 S6 ; Wait 6 seconds. G1 X1 Y1 F1000 ; Wiggle +1mm. G4 S6 ; Wait 6 seconds. G1 Z0.5 X-1 Y-1 F1000 ; Wiggle -1mm, Z +0.5. G90 ; Set to Absolute Positioning. G1 X220 Y205 Z205 F400 ; Place nozzle to the right side, build plate to front, Z at top. M400 ; Finish all moves, clear the buffer. M107 ; Turn off the part cooling fan. M18 YXE ; Unlock the X, Y, and E axis. ; Play a triumphant tune to celebrate a successful print. G4 S1 M300 P250 S750 G4 P251 M300 P200 S1250 G4 P201 M300 P250 S750 G4 P251 M300 P200 S1250 G4 P201 M300 P250 S2500 G4 P251 M300 P150 S2000 G4 P151 M300 P150 S2500 G4 P151 M300 P350 S3700 G4 P351 M400 ; Finish all moves, clear the buffer.
Simplify3D Start GCode:
; Simplify3D Start G-Code ; Set nozzle and bed to the specific temperatures declared within this slicer M140 S[bed0_temperature] ; set bed temp M104 S[extruder0_temperature] ; set extruder temp M116 ; wait for all temperatures ; Run macro to print primeline at a 'randomized' Y positon from -1.1 to -2.9 M98 P"0:/sys/primeLine.g" ; primeline macro ; Set pressure advance M572 D0 S0.07 ; set pressure advance
PrusaSlicer Start GCode:
; PrusaSlicer Start G-Code: ; Set nozzle and bed to the specific temperatures declared within this slicer M140 S[first_layer_bed_temperature] ; set bed temp M104 S[first_layer_temperature] ; set extruder temp M116 ; wait for all temperatures ; Run macro to print primeline at a 'randomized' Y positon from -1.1 to -2.9 M98 P"0:/sys/primeLine.g" ; primeline macro ; Set pressure advance M572 D0 S0.07 ; set pressure advance
Cheers,
Kolbi -
Hi,
Just FYI you don't need both M140 and M190.
They both set the temp and activate the heater.
The difference is that M140 doesn't wait for the temp to be reached whereas M190 does.
The same applies to M104 and M109.
There is also M116. From the docs, M116 by itself it does:
waits for all temperatures and other slowly-changing variables to arrive at their set values.
Frederick
-
@Kolbi said in Automatic Bed Leveling with Conditional Gcode Iterations:
For some reason, it feels a bit to foreign to me to offload stuff from the slicer's start and end code spots.
When you use multiple slicers it makes it a lot easier to manage.
-
Thanks @fcwilt! I didn't know I was messing that up. I re-read the gcode documentation on this, I believe the following would be the most efficient.
M104 S[first_layer_temperature] ; set extruder temp M140 S[first_layer_bed_temperature] ; set bed temp M116 ; waits for all temperatures
-
@Kolbi said in Automatic Bed Leveling with Conditional Gcode Iterations:
Thanks @fcwilt! I didn't know I was messing that up. I re-read the gcode documentation on this, I believe the following would be the most efficient.
M104 S[first_layer_temperature] ; set extruder temp M140 S[first_layer_bed_temperature] ; set bed temp M116 ; waits for all temperatures
Yes that should work fine.
Now what I and others do is start the heating and then do other things that don't need to wait on the temps, like homing.
When all of the "other" things are done then you can use the M116 to wait before proceeding to the next steps.
It can save a bit of time.
Frederick
-
@fcwilt said in Automatic Bed Leveling with Conditional Gcode Iterations:
Now what I and others do is start the heating and then do other things that don't need to wait on the temps, like homing.
Thanks much! Made changes to above post.
Cheers,
Kolbi -
With all sorted discussed above, I have no actual contents in the following files: tfree0.g, tpost.g, tpre0.g
Can I delete these files from the sdcard or will this throw an error?
-
@Kolbi said in Automatic Bed Leveling with Conditional Gcode Iterations:
With all sorted discussed above, I have no actual contents in the following files: tfree0.g, tpost.g, tpre0.g
Can I delete these files from the sdcard or will this throw an error?
When in doubt you can always rename them while you use your printer to see if an error occurs. Then you can undo the rename if it turns out you need them.
When I do that sort of thing I add .HIDE to the end of the name so tfree.g becomes tgree.g.HIDE
Now I don't think you need these files - I think that are used when changing from one tool to another.
I've never had a printer with more than one tool so I've never had these files.
Frederick
-
@fcwilt Thanks Frederick!
-
-