Run Before Job Gcode

I am currently on 1.4.13. I am seeing an issue with teh first run of an event driven gcode. I have the below code in "run before job". And I am doing a call to START_NO_ABL in my generated gcode. After a power up I always have the same issue in that this code doesn't seem to run. My gcode basically starts doing things after the call, without doing the call. If I stop the print and restart, it works fine and will continue to work fine until another power failure. Sounds like a flag is not being initialized some place. 


@func START_WITH_ABL bed filament
M503 ;report Status
M117 Setting up heaters...
M140 S{{local.bed}} ; set bed final temp
M104 S{{local.filament}} ; set extruder final temp
M109 S{{local.filament}} ; wait for extruder final temp
M190 S{{local.bed}} ; wait for bed final temp
M117 Print Starting...
M75 ; Start Print Timer and Engage Fil Sensor if USB Printing
M84 E ; Disable E Motor for probe accuracy on direct drive systems
M117 Antiblob retract...
G92 E0 ; Reset Extruder distance to 0
M117 Homing All...
G28 ; home all axes
M117 Generating mesh...
G29; auto bed leveling
M503 ;Report status
M117 Heaters Recovering...
M420 Z0; Z fade
M900 K0; LA
M140 S{{local.bed}} ; set bed final temp
M104 S{{local.filament}} ; set extruder final temp
M109 S{{local.filament}} ; wait for extruder final temp
M190 S{{local.bed}} ; wait for bed final temp
M117 Purging extruder...
G92 E0     ; reset extruder
G1 Z1.0 F3000    ; move z up little to prevent scratching of surface
G1 X20 Y0.1 Z0.28 F5000.0  ; move to start-line position
G1 E2 F1000 ; de-retract and push ooze
G92 E0     ; reset extruder
G1 X200.0 Y0.1 Z0.28 F1200.0 E9  ; draw 1st line
G92 E0     ; reset extruder
G1 X200 Y2.0 Z0.28 F5000.0  ; move to side a little
G1 X20 Y2.0 Z0.28 E9 F1200.0  ; draw 2nd line
G92 E0     ; reset extruder
G1 E-0.8 F3000; retract to avoid stringing
G92 E0     ; reset extruder
G1 X20.5 E0 F1000.0 ; -0.5mm wipe action to avoid string
G1 X10.0 E0 F1000.0 ; +10mm intro line @ 0.00
G1 E0.6 F1500; de-retract
G92 E0     ; reset extruder
G1 Z1.0 F3000    ; move z up little to prevent scratching of surface
M117 Printing.....

@func START_NO_ABL bed filament
M503 ;report Status
M117 Setting up heaters...
M140 S{{local.bed}} ; set bed final temp
M104 S{{local.filament}} ; set extruder final temp
M109 S{{local.filament}} ; wait for extruder final temp
M190 S{{local.bed}} ; wait for bed final temp
M117 Print Starting...
M75 ; Start Print Timer and Engage Fil Sensor if USB Printing
M84 E ; Disable E Motor for probe accuracy on direct drive systems
M117 Antiblob retract...
G92 E0 ; Reset Extruder distance to 0
M117 Homing All...
G28 ; home all axes
M117 Homing Z Probe...
G28 Z ; home z again
M117 Load Existing mesh...
M420 S1 ;load mesh
M503 ;report Status
M117 Heaters Recovering...
M420 Z0; Z fade
M900 K0; LA
M140 S{{local.bed}} ; set bed final temp
M104 S{{local.filament}} ; set extruder final temp
M109 S{{local.filament}} ; wait for extruder final temp
M190 S{{local.bed}} ; wait for bed final temp
M117 Purging extruder...
G92 E0     ; reset extruder
G1 Z1.0 F3000    ; move z up little to prevent scratching of surface
G1 X20 Y0.1 Z0.28 F5000.0  ; move to start-line position
G1 E2 F1000 ; de-retract and push ooze
G92 E0     ; reset extruder
G1 X200.0 Y0.1 Z0.28 F1200.0 E9  ; draw 1st line
G92 E0     ; reset extruder
G1 X200 Y2.0 Z0.28 F5000.0  ; move to side a little
G1 X20 Y2.0 Z0.28 E9 F1200.0  ; draw 2nd line
G92 E0     ; reset extruder
;G1 E-6 F1500 ;retract to prevent drag line
G1 E-0.8 F3000; retract to avoid stringing
G92 E0     ; reset extruder
G1 X20.5 E0 F1000.0 ; -0.5mm wipe action to avoid string
G1 X10.0 E0 F1000.0 ; +10mm intro line @ 0.00
G1 E0.6 F1500; de-retract
G92 E0     ; reset extruder
G1 Z1.0 F3000    ; move z up little to prevent scratching of surface
M117 Printing.....

Comments

  • Scripts with functions must have run once before you can use them. After a connect all functions are removed, so from what you say it seems you call the function before it is run the first time or in run script but before the function definition so it is only known for the second run. So when to you send @call START_NO_ABL ?

    Functions you like to be always defined should be in "Run on printer activation". When you make changes here remember to deactivate and activate printer first. But then it is defined always.

Sign In or Register to comment.