Thing-O-Matic: Revised start.gcode and end.gcode

SJFW supports the Dimension plugin with the E extruder axis and doesn’t implement the older M101/M103/M108/M113 direct extruder commands. So I rewrote start.gcode to take advantage of that, compensate for Z-axis backlash, and clean up a few other nits; an older version (for MBI firmware) is there. The new files are at the bottom of this post.

The M351 disables dry-run mode, which I often engage while manually tweaking things: running the whole start.gcode file without heating helps get all the coordinates just right.

Coarse homing sets the axis positions to zero, rather than their real values, to simplify the fine homing process. I could switch into G91 relative motion to back off the switches, but this is easier. The fine homing now runs dead slow through the 2 mm backoff distance and produces very consistent results.

The first wipe gets rid of any residual snot before touching off on the Z-minimum platform switch, although I generally pick it off with a tweezer as the extruder heats.

Unlike the MBI firmware, SJFW’s G92 can set each axis independently, which means the Z-min touchoff need not simultaneously reset the XY position. Note that the G92 distance gets smaller to raise the Z=0.0 position: a thinner switch means a smaller distance to the platform, so when you make the value smaller (for a constant switch height) the nozzle doesn’t travel as far downward to Z=0.0.

I’d hoped to use SJFW’s M220/M221 commands to auto-set the home positions (including Z-min!), but they don’t quite work for this “in development” version. At least, feeding the appropriate commands directly through pronsole produces error messages indicating that the home positions aren’t set after a single-axis move, so I’ll continue using G92 for a while.

I ram 10 mm of filament into the extruder with the nozzle positioned in front of the wiper blade, which generally does not poot out a giant tangle of thread because the previous print ended with a retraction that leaves the extruder depressurized. The point here is to squirt out at least some thread to get the extruder pressure close to normal, then do a retraction and wipe to prevent drooling on the way to the start of the Skirt outline.

The Z axis has about 0.2 mm of backlash, which I compensate in two places. The mechanical Z=0.0 position works out to be 0.2 mm above the platform with the Z axis descending, so I made the G92 value slightly too small. The next two Z motions after the G92 descend to Z=0.0 in the left rear corner, then ascend to Z=0.2 to take up the mechanical backlash without causing any mechanical motion. After that, the nozzle is exactly (kinda-sorta) 0.2 mm above the platform and that matches the firmware’s notion of where it is. All successive Z motions (including to the first layer at Z=0.25) will be upward, so the backlash stays compensated and every layer comes out just about exactly correct.

The last G92 presets the E axis position so that the first anti-reversal at the start of the Skirt thread doesn’t produce a giant blob. This is totally empirical; I think my manual reversal after priming doesn’t result in exactly the same extruder pressure as Skeinforge’s reversals.

SJFW doesn’t implement the G0 rapid-motion command at all (which, for me, is better than implementing it wrong), so all the motion commands use G1 with an appropriate F feedrate parameter.

However, extruder speed control using a G1 F before the G1 E doesn’t produce consistent results. I think the extruder normally runs in inverse-time mode, where the speed makes the E distance come out right for the prevailing XY speed. All I know for sure is that changing the F parameter doesn’t work the way it should: it does not set the subsequent filament speed in any predictable way.

The new start.gcode file:

;---- start.gcode begins ----
; TOM 286 - Al plates + Geared extruder + Zmin platform sense
; Ed Nisley - KE4ZNU - Dec 2011
; SJFW 1.11 without G0 and G28/G16x homing
; Not yet -> Requires M220/M221 endstop positions
; See TOM286-sjfw.gcode for EEPROM setup
; Set initial conditions
G21                 ; set units to mm
G90                 ; set positioning to absolute
; Dry run?
M351 P0             ; P0 = normal P1 = no heat
; Begin heating
M104 S200           ; extruder head
M140 S110           ; HBP
; Coarse home axes
; Set zero at limits for convenience
G1 Z999 F1500       ; home Z to get nozzle out of danger zone
G92 Z0
G1 Y-999 F4000      ; retract Y to get X out of front opening
G92 Y0
G1 X-999 F4000      ; now safe to home X
G92 X0
; Fine home axes
; Set actual offsets!
G1 X2 Y2 Z-2 F5000  ; back off switches
G1 Z999 F50
G92 Z116.3
G1 Y-999 F50
G92 Y-58.5
G1 X-999 F50
G92 X-53.5
; Initial nozzle wipe to clear snot for Z touchoff
G1 X0 Y0 Z3.0 F1500     ; pause at center to build confidence
G4 P1000
G1 Z10                  ; ensure clearance
G1 X39 Y-58.0 F10000    ; move to front, avoid wiper blade
G1 X55                  ; to wipe station
G1 Z6.0                 ; to wipe level
M116                    ; wait for temperature settling
G1 Y-45 F500            ; slowly wipe nozzle
; Z platform height touchoff
; Make sure the XY position is actually over the switch!
; Home Z downward to platform switch
; Compensate for 0.05 mm backlash in G92: make it 0.05 too low
G1 X55.5 Y8.2 Z3.0 F6000     ; get over build platform switch
G1 Z0 F50                    ; home downward very slowly
G92 Z1.35                    ; set Z-min switch height
G1 Z6.0 F1000                ; back off switch to wipe level
; Prime extruder to stabilize initial pressure
G1 X55 Y-45 F6000   ; set up for wipe from rear
G1 Y-58.0 F500      ; wipe to front
G91                 ; use incremental motion for extrusion
G1 F4               ; set slow rate
G1 E10              ; extrude enough to get good pressure
G1 F4000            ; set for fast retract
G1 E-2.0            ; retract
G90                 ; back to absolute motion
G1 Y-45 F1000       ; wipe nozzle to rear
; Set up for Skirt start in left rear corner
; Compensate for Z backlash: move upward from zero point
G1 X-50 Y55 Z0.0 F10000     ; left rear corner -- kiss platform
G1 Z0.2 F1500       ; take up Z backlash to less than thread height
G92 E1.5            ; preset to avoid huge un-Reversal blob
;G1 X0 Y0
;---- start.gcode ends ----

The matching end.gcode on the other end of the file simply retracts a bit more filament, then positions the stage front-and-center for easy build plate removal:

;---- end.gcode starts ----
; TOM 286 - Al plates + Geared extruder
; Ed Nisley - KE4ZNU - Dec 2011
; SJFW 1.11 without G0 and G28/G16x homing
; Not yet -> Requires M220/M221 endstop positions
; See TOM286-sjfw.gcode for EEPROM setup
;- inhale filament blob
G1 E-5 F900
;- turn off heaters
M104 S0         ; extruder head
M140 S0         ; HBP
;- move to eject position
G1 Z999 F1000   ; home Z to get nozzle away from object
G92 Z117.2      ; reset Z
G1 X0 F6000     ; center X axis
G1 Y35          ; move Y stage forward
;---- end.gcode ends ----

The replace.csv file that squashes commands that SJFW doesn’t implement:

M101	;-- M101 no Extruder Forward
M103	;-- M103 no All Extruders Off
M108	;-- M108 no Extruder Speed
M113	;-- M113 no Extruder PWM