Jump to content

Need help with LOAD_FILAMENT macro


Penatr8tor

Recommended Posts

Hi all, thanks in advance for any and all help and comments.

This is my problem...

I want to implement a LOAD_FILAMENT macro in my printer.cfg like the example below.

[gcode_macro LOAD_FILAMENT]

gcode:

{% set speed = params.SPEED|default(300) %}

{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity %}

SAVE_GCODE_STATE NAME=load_state

M300 # beep

G91

G92 E0

G1 E350 F{max_velocity} # fast-load

G1 E25 F{speed} # purge

M300

M300

RESTORE_GCODE_STATE NAME=load_state

My problem is... I keep getting this error.

Extrude only move too long (350.000mm vs 50.000mm)

Now, I understand what this error means, i.e. 50mm is the max allowable extrude distance and I also learned, based on my research, that the way to avoid this is to have a G92 E0 code before extruding but I still get the error.

Any help will be greatly appreciated.

Link to comment
Share on other sites

30 minutes ago, smirk said:

Beyond putting in 7 "G1 E50"s 😉, you could try the "max_extrude_only_distance" in the extruder section. It governs how far an extrude/retraction only move goes, and defaults to the annoying 50mm

Yeah... I tried inserting that into the macro but the editor turns it into multi-color which tells me it won't work. I did the multiple G1 E50's for now and it works but what really blows me away is that this is the macro to load filament that is in klipperscreen. I mean why post up or include stuff that doesn't even work.

image.thumb.png.a73d24fe570f35522c8276db8a895842.png

https://klipperscreen.readthedocs.io/en/latest/macros/

Link to comment
Share on other sites

Not very elegant, but I wonder if this might work..

 

FORCE_MOVE STEPPER=extruder DISTANCE=350 VELOCITY={max_velocity}

54 minutes ago, Penatr8tor said:

Yeah... I tried inserting that into the macro but the editor turns it into multi-color which tells me it won't work.

You can't put the max_extrude_only_distance in a macro. It has to go in the [extruder] section. This makes it a permanent setting which defeats some of the gcode sanity-check that it is there for in the first place.. There really should be a better solution in Klipper for these type of use cases.

 

Link to comment
Share on other sites

4 minutes ago, atrushing said:

There really should be a better solution in Klipper for these type of use cases.

Agree. The people that coded the RatOS version seemed to have gotten around this problem. I'm not very familiar with macro coding so I tend to get stuck but I will persevere and search for how they did it. I've got both macros working pretty decently for now and that might even be good enough. We will see. Thanks, I'll keep looking and trying stuff. 

Link to comment
Share on other sites

15 minutes ago, Penatr8tor said:

The people that coded the RatOS version seemed to have gotten around this problem.

In their hotend.cfg file they define: max_extrude_only_distance: 200

>> the link is to a fork of the official RatOS github but the official page makes the same definition.

Edited by atrushing
clarification
  • Like 1
Link to comment
Share on other sites

2 hours ago, Penatr8tor said:

eah... I tried inserting that into the macro but the editor turns it into multi-color which tells me it won't work.

Sorry I wasn't clear, I meant in the printer.cfg file in the [extruder] section for something like :

max_extrude_only_distance: 400

[extruder]
step_pin: PE6
dir_pin: PC13
enable_pin: !PE5
microsteps: 16
rotation_distance: 3.85370024056875
#rotation_distance: 7.75587469829832  # BMG Dual drive
#rotation_distance: 9.337068161 # TriangleLab Matrix
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PB15
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC0
control: pid
pid_Kp: 22
pid_Ki: 1.08
pid_Kd: 114
min_temp: 0
max_temp: 260
min_extrude_temp: 0
pressure_advance: 0.0794
pressure_advance_smooth_time: 0.04
max_extrude_only_distance: 400

Just to make sure I verified it on  one of my printers (so that's my extruder section) and it happily extrudes 350mm with that GCODE line from your macro.

Link to comment
Share on other sites

That max extrude setting defaulting at 50 was maddening until I found a tip to make it bigger. After that I could get my load and unload macros working. I'd post mine, but they look crazy complicated due to using centralized variable definitions and some other related functions.

  • Like 1
Link to comment
Share on other sites

@claudermilk Thanks, I really appreciate you and everyone else jumping to the aid of a fellow printing nerd. I have a pretty good setup right now. I will definitely up the max extrude when I implement a prime blob. Apart from the frustration related to finding answers... the coding (if you can even call it that) is a lot of fun. Brings me back to the days of writing AutoCAD AutoLisp macros.

Link to comment
Share on other sites

I've had a ball learning Jinja2 and tweaking the printer functionality to exactly how I want it. That part is right in my wheelhouse.

For the prime blob, I just switched over to the KAMP one that makes a little Voron logo and moves around depending on the plate real estate usage. I like it better than the one I cobbled together from some other typical long line examples (largely based on Prusa's I expect).

https://github.com/kyleisah/Klipper-Adaptive-Meshing-Purging

I also switched my adaptive bed mesh to this from the other one I was using. Implementation is simple with the prerequisites in place (you are using object exclusion, right?).

Link to comment
Share on other sites

48 minutes ago, smirk said:

LISP! Now that's a blast from the past, sadly, I have amusing(*) LISP stories and jokes stored in a dark corner of my brain.......

(*) No they're not if you're approaching anything relatively normal.

Like, Lots of Idiotic Stupid Parenthesis? 😁

  • Haha 2
Link to comment
Share on other sites

49 minutes ago, claudermilk said:

(you are using object exclusion, right?).

Yes, Implemented and working. I'm using SuperSlicer BTW if that matters.

I saw that Voron prime blob and adaptive meshing in someone's video somewhere, probably Maple Leaf. That looks like a really cool place to start my prime blob journey and the adaptive meshing makes a lot of sense.

Have you implemented Auto Z Calibration? That's something I have yet to implement. 

Link to comment
Share on other sites

Yeah, I created an entire suite of tools that would do stuff like create holes in plan view or side view with centerlines and all of the hole sizes were selectable from a dialog box among numerous other tools. I had one autolisp routine that was over 1000 lines. Before 3D CAD I was the AutoCAD guy. 😄

Link to comment
Share on other sites

10 minutes ago, Penatr8tor said:

I had one autolisp routine that was over 1000 lines.

You must have forgot about recursion in Lisp 🤪

I cobbled my through writing the routines but when other Cad guys would work with me they would be surprised at how quick I could work through drawings. You could divide AutoCAD users in two groups, point & clickers and command line gurus..

  • Like 1
Link to comment
Share on other sites

6 hours ago, Penatr8tor said:

Have you implemented Auto Z Calibration?

Highly recommend you do. Takes some patience and multiple adjustments but once it works - it is brilliant! 

 

6 hours ago, Penatr8tor said:

Voron prime blob and adaptive meshing

Looks like I am starting that journey with you. This is where I started: https://gist.github.com/ChipCE/95fdbd3c2f3a064397f9610f915f7d02, but have not progressed with it, as still reading through discourse (a nightmare) Will let you know of my progress. This is what I found on the Prime blob so farL https://gist.github.com/brandon3055/f5297f191fa576d2228e700ac6857abc. Again just reading. To many other things going on at the moment to fully concentrate on this.

Good luck and looking forward to reading about your progress

  • Like 1
Link to comment
Share on other sites

23 hours ago, Penatr8tor said:

Yes, Implemented and working. I'm using SuperSlicer BTW if that matters.

I saw that Voron prime blob and adaptive meshing in someone's video somewhere, probably Maple Leaf. That looks like a really cool place to start my prime blob journey and the adaptive meshing makes a lot of sense.

Have you implemented Auto Z Calibration? That's something I have yet to implement. 

But of course I have! That's part of the Klicky magic.

20 hours ago, atrushing said:

You must have forgot about recursion in Lisp 🤪

I cobbled my through writing the routines but when other Cad guys would work with me they would be surprised at how quick I could work through drawings. You could divide AutoCAD users in two groups, point & clickers and command line gurus..

Isn't recursion the point of LISP? 😆

For the KAMP setup, it was pretty easy (at least for me). I'm not sure you guys are looking at the one I'm using & referring to: https://github.com/kyleisah/Klipper-Adaptive-Meshing-Purging

  • Make sure object exclusion is set up.
  • Make sure max_extrude_cross_section is bumped up in the [extruder] section (mine is at 5).
  • Remove stock bed_mesh_calibrate
  • Import the KAMP bed_mesh_calibrate and adaptive_purge macros
  • Call those from print_start
  • Profit!

Those ones in the gists look far more complex to implement.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...