OctoPrint causing huge retraction on print following a cancelled print

What is the problem?

As stated in the title. My OctoPrint is causing/doing a huge filament retraction at the start of a print following a cancelled print.

I can't be certain, but it appears the retraction length is equal to the amount extruded on the prior cancelled print.

Also, if I use OctoPrint to do an extrude for priming the filament into the hotend before the next print, the amount extruded during the prime will also then be retracted at the start of the next print.

Up to the point where the filament can be totally unloaded from the printer. Depending on how much had been extruded in the cancelled print and/or extruded in the prime.

What did you already try to solve it?

Everything.

Added a cancelled print Gcode script to OctoPrint which switches between absolute and relative positioning (G90,G91), an attempt to reset the extruders position.

Tried both OctoPrint setting in 'Features' for Marlin G90/G91, enabled and disabled.

Removed and recreated printer profile in OctoPrint (multiple times).

Reinstalled OctoPrint from scratch. Tried barebones no plugins and with plugins.

Updated printers firmware.

Two different slicers (Cura and Kiss).

Various different settings in the slicers. Including editing the start and end gcode scripts (adding G90/G91, disabling runout sensors, etc, etc).

Printing from OctoPrint directly and from Cura connected to OctoPrint's API (preferred method and slicer).

Searched Marlin config for anything which may be causing the retraction ('FWRETRACT' enabled for example)

Enabled Serial logging, and read through the serial.log to try and find the retraction and/or what might be causing it.

I honestly can't think of anything else to try, hence the post.

My only conclusion is that something in OctoPrint is keeping a tally of the amount extruded, and then injecting that as a retraction into the start of the next print, but only if the previous print was cancelled.

If the print is successful or if I reboot Octoprint, or disconnect then reconnect the printer, then the next print (after a cancelled) is fine, no huge retraction at the start.

Have you tried running in safe mode?

Yes

Did running in safe mode solve the problem?

No

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)
octoprint-systeminfo-20220713055245.zip (53.1 KB)

This systeminfo was generated on a fresh boot without any printing being done.

Here is a copy of the logs from a cancelled then restarted print where the problem occurred.

octoprint-logs(6).zip (947.7 KB)

serial.log somewhere around line 6480 is where the retraction happend

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

OctoPrint Version 1.8.1, OctoPi 0.18.0-1.8.1, Printer: Stock Geeetech A10M (GT2560 4.1B board), Marlin 2.1.x Bugfix. Firefox, Win10, Ubuntu Linux (Not applicable, issue irrelevant to OS or browser) .

Hello @Hexx !

First, the Pi is constantly running with undervoltage and throttled:

|      throttle_state: '0x50005'

At line 6480 in the serial log, the print job just starts.
The next cancel is at line 6578
Referring to the extrusion values, the is no retraction before at all.

There is this in the octoprint.log:

2022-07-13 08:23:57,469 - octoprint.util.comm - INFO - Cancelling job on behalf of user admin

that results to this in the serial log:

2022-07-13 08:23:57,473 - Changing monitoring state from "Printing" to "Cancelling"

Also, there is quite a gap in the octoprint log:

2022-07-12 17:36:15,327 - octoprint.plugins.softwareupdate - INFO - Minimum free storage across all update relevant locations is 10.3GB. That is considered sufficient for updating.
2022-07-13 05:48:51,728 - octoprint.server.heartbeat - INFO - Server heartbeat <3

Hi @Ewald_Ikemann ,

Thank you for your quick response.

Yeah, the gap in the Octoprint log is probably from yesterday when in frustration I just unplugged the Pi without shutting it down first (problems with PETG peeling off the bed, summer heat, lack of sleep and I'd just had enough).

The undervoltage and throttling issue is down to just recently adding a Raspberry Pi touchscreen, without upgrading the PSU. A 2 Amp PSU just isn't quite enough for the Pi and screen together. Although after testing it on a meter it's not wildly under. Don't worry I have a Pi4 with official PSU which I'm going to swap over to this setup soon.

As for the print job at 6480. It is started after a cancelled print and is where a large retraction happens. Although as you have stated there is no retraction at all in the log. I'm kind of clueless (or still learning) when it comes to gcode, I couldn't find a retraction either but thought I might be missing something.

This makes me think that the problem lies elsewhere and is nothing to do with OctoPrint. Maybe something to do with the Marlin firmware.

If I'm correct, disconnecting then reconnecting OctoPrint from the printer would also reset the printer firmware, in turn resetting the extruders position?

Thank you, more to investigate.

If the extruder is in absolute mode (G90, M82) then as a print progresses, the E value can get larger and larger (some slicers reset at the beginning of each layer, some don't).

When a print is cancelled or stopped this larger E value can be remembered by the firmware and if the next print starts with a low E value (like zero), then there will be a huge retraction.

The solution is the always set the mode (absolute or relative) and then reset the position using G92 (G92 E0) in the slicer's start gcode before any commands that move the filament.

You could do this with an OctoPrint script, but IMO, its best done in the slicer.

1 Like

Thanks @b-morgan much appreciated!

My start G-code does have a G92 E0 in it (see code below), although looking at it now, I think it might be a good idea to move it just after the G90, since the 'G1 X0 Y0 Z5 E0 ;go to wait position' happens before the G92, and the retraction usually happens around that point, hot or cold hotend.

If that doesn't work I'll try adding a G92 E0 to the end (or beginning) of the cancellation script in OctoPrint.

Can't do it at the moment, finally got the PETG to stop peeling (higher extruder temp, higher first layer bed temp and much slower first layer. 6 hour print).

Start Script:

;Geeetech A10M start script
M412 S0; Disable runout sen
G28 ;home
G90 ; absolute positioning
G1 X0 Y0 Z5 E0 ; go to wait position
M140 S{material_bed_temperature_layer_0} ;set bed temp
M109 S{material_print_temperature_layer_0} ;set extruder temp and wait
G1 Z0.8 F200 ; set extruder height
G92 E0
G1 X220 Y0 E80 F1000 ; purge line
;end of start script

Current cancelled print script:

;Home X
G28 X
; disable motors
M84
;disable all heaters
{% snippet 'disable_hotends' %}
{% snippet 'disable_bed' %}
;disable fan
M106 S0

You are correct, move the G92 E0 to just after the G90. As it is now, the G1 X0 Y0 Z5 E0 says move from the current E position to 0 which could be a huge retraction.

2 Likes

Thanks again @b-morgan

Moving the G92 solved it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.