-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extrude Length Preprocessing #491
base: main
Are you sure you want to change the base?
Conversation
356b550
to
10fdba9
Compare
10fdba9
to
c20568b
Compare
This is an interesting idea. What kind of overhead does it add to the parsing? I persuaded the moonraker crew to accept my PR for specifying the timeout of the pre-processing step so at least we can bump that up. Can you give me the use case of how and when you would use this or is this a precursor to something else? |
The parsing is currently pretty slow =
This is indeed a precursor to the Endless Spool feature upgrade. The idea was described in my comment in #340 (comment), but in short - the plan is to check whether it's reasonable to continue printing after a runout detection without unloading the remaining bit of plastic. |
I don't think long preprocessing is a good idea in general. I'd look into optimizing it instead. |
88ad403
to
64926d4
Compare
64926d4
to
ac715c0
Compare
Made the MMU-related parsing into it's own class. Hid some of the parameters into object attributes. This should reduce some overhead. |
Any performance optimization of current parsing would definitely be appreciated but it is actually quite fast. Once a placeholder is found it won't look in subsequent lines, but the logic parses to the end of file to do the NEXT_POS insertions. I see you changing the approach slightly. It would be interesting to see the orig/new parsing performance numbers if you have any.. JFYI I'm not going to be able to spend time looking at this for some time (i know it is still in development). The reason is that I'm really busy getting type-B MMU support polished (in the v3alpha branch) [if you do look at the v3alpha branch you will see a lot of code/class breakout - no changes on the moonraker side though] |
@k1-801 I've been thinking about this and have an idea for you...
To things can happen:
B) A toolchange occurs.
The manipulation of the tool change is not really any different to your approach but it saves having to pre-process the gcode ahead of time... |
In the absence of preprocessing, be it disabled or just had it failed, AND with the presence of an extruder entry sensor, this is certainly how this would work. However, there are plenty of machines that don't have an extruder entry sensor, so without preprocessing there isn't much we could do. Furthermore, there are instances where it woud be wasteful to go on with the print after a runout trigger on MMU, as it would lead to a purge of a whole meter of filament - it would be much better to eject it (if possible), change the spool and maybe use the ejected bit the next time this tool is requested. I think we are going to need a flowchart :) |
Flowchart, ha ha. Yes it is a complex challenge. The statement above "it would be much better to eject it (if possible), change the spool and maybe use the ejected bit the next time this tool is requested." can't work though ... if you are past the point of no return you cannot eject (because the filament cannot be grabbed be the MMU gear stepper) thus you can either continue as far as possible and if the remaining filament is beyond a user defined threshold, say 300mm, then PAUSE and wait for user interaction. else do the very long purge. You can't eject a filament that is too short... |
But there is some more filament between the extruder gears and the nozzle, I always assumed that unloading from the extruder makes the filament reach the MMU gears again. This assumption, however, also heavily relies on the MMU sensor to gears distance being significantly shorter than extruder gears to nozzle distance... UPD: as well as on the runout response time being short enough If these conditions are not met, then a runout is indeed a point of no return, and our only options are to continue printing, purge, or request manual intervention. |
This gave me another thought. What if we used the pre-gate sensor, when available? That would notify the system about a runout in advance, thus, allowing to run checks earlier |
My point is that often users will have over 1m of filament between that "point of no return" and the extruder. So, once past, you have no choice but a massive purge IF a toolchange occurs. |
Indeed the pre-gate sensor IS used today for runout unless the user explicitly turns it off. If can be turned off by disabling the mmu_pre_gate sensor in Mainsail OR by configuring a "waste gate". This functionality was added at the request of the community so the waste filament can be dumped out a single gate -- that obviously requires the filament to clear the selector before triggering runout. |
WORK IN PROGRESS
Currently has syntax errors. Working on it.
This change aims to provide a basis for Endless Spool functionality improvement.
It scans each block of GCode between toolchanges and records the total length of filament used within each block. This data is then attached to the
MMU_CHANGE_TOOL
macro (in theEXTRUDE_LENGTH=...
parameter).Additionally, this change removes buffering of GCode lines between the toolchange macro and the next G1 move. This potentially can reduce RAM consumption. This is achieved by recording the file position after the Tx macro and then rewinding the file stream to that point.