Skip to content
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

Added initial version of MMU2S feature #17523

Merged
merged 25 commits into from
Apr 26, 2020

Conversation

tonihoang
Copy link
Contributor

Requirements

When the filament reaches the gears, "A" needs to be sent to the MMU2

Description

After initalization of MMU (state -4 reached) in state 1,2, and 3 and the end filament runout sensor is checked.

On the first time it is triggered "A" is send to MMU2. If the user is in calibration mode, this will enable the automatic bowdentube length for MMU2.

Benefits

MMU2S usability

Related Issues

#15614

@vertigo235
Copy link

Make sure you add the load more procedure that pushes the filament forward and then back to make sure the filament path is clear. This is the most important improvement with the MMU2S.

@tonihoang
Copy link
Contributor Author

tonihoang commented Apr 13, 2020

@vertigo235 do you have an example there? As I do not have a MK3S I do not know what behaviour you are referring to.

Where do you need to push it in the MMU or on the extruder?

I guess on the extruder you can edit the "MMU2_LOAD_TO_NOZZLE_SEQUENCE" in the Configuration_adv.h?, but i guess we'd need to add some additional checks then?

or do you mean to tell the MMU2 to load more filament?

@BastR
Copy link
Contributor

BastR commented Apr 13, 2020

@tonihoang

That's a hell of a coincidence. I've been working on this for a week too.
First of all, I've only been coding for a very short time so my code probably needs some work. However, it works perfectly at home, I used the history of the mmu.cpp file of the prusa firmware to add the filament sensor.
I’ve made a test print and It works.

That's the way it works:

  • Tn commands from the gcode
  • Tool change function in mmu2.cpp
  • I make an unload before activating the filament detection
  • MMU2 send ok when filament is unloaded
  • Tn command sent to the MMU
  • Filament is pushed is the bowden

Then 2 options:
1-If filament sensor detect the filament, Marlin send ‘A’ command to MMU to abort loading, finally MMU make last C0 command to push filament into gears
OR
2-if filament is not detected, MMU make N C0 command (defined by user in configuration_adv.h) to push more filament to reach sensor. If finally filament is not detected, the printer enter in runout.

It is also possible that some of the additions I've made are useless, I'll let you have a look so that you can give your opinion.

Thank you

https://github.com/BastR/Marlin/tree/Titan2.0?files=1

@vertigo235
Copy link

vertigo235 commented Apr 13, 2020

@tonihoang This is the relevant function in prusa FW, once he IR sensor is deteced as 1 (loaded to gears), the extruder pushes the filament forward 60mm into the hotend, it then pulls the filament back 52mm. If there was a jam or obstruction then the filament would be pulled out past the gears (resulting in 0 on the IR sensor), if it moved at least 52mm forward (no obstruction), then the sensor would stay in state of 1 the whole time. This is a successful load and the print continues. If it's a failed load it will retry like 3 times before asking for attention.

https://github.com/prusa3d/Prusa-Firmware/blob/MK3/Firmware/mmu.cpp#L1440-L1483

@tonihoang
Copy link
Contributor Author

I have copy pasta'd the can_load function, and adapted it to the marlin MMU module but too late today to integrate and continue, so I did a micro commit, in case of fire 🔥

@BastR I did not have time to check your stuff yet

@tonihoang
Copy link
Contributor Author

tonihoang commented Apr 14, 2020

I have only tested via Menu so far, and tested the "clogged state" via unplugging the sensor. but it fells somewhat useable, so i'll set it to ready for review for now.

@thinkyhead thanks for the overnight review and fixes

@tonihoang tonihoang marked this pull request as ready for review April 14, 2020 10:01
@BastR
Copy link
Contributor

BastR commented Apr 14, 2020

@tonihoang thanks you for your work, can you make change in some language files too?

"MSG_MMU2_LOAD_FILAMENT" can be confusing on the LCD because the message is "LOAD FILAMENT" while real means is "LOAD FILAMENT TO MMU".

In this commit I have made some changes if it helps: https://github.com/BastR/Marlin/commit/31b7462a7dc3d4f8128634ead372980d4814ab94

@tonihoang
Copy link
Contributor Author

@tonihoang thanks you for your work, can you make change in some language files too?

"MSG_MMU2_LOAD_FILAMENT" can be confusing on the LCD because the message is "LOAD FILAMENT" while real means is "LOAD FILAMENT TO MMU".

In this commit I have made some changes if it helps: BastR@31b7462

maybe just create a separate PR for language text update? I'd prefer to keep this one a feature thing, and then you can update the text in a separate one?

@BastR
Copy link
Contributor

BastR commented Apr 14, 2020

@tonihoang thanks you for your work, can you make change in some language files too?

"MSG_MMU2_LOAD_FILAMENT" can be confusing on the LCD because the message is "LOAD FILAMENT" while real means is "LOAD FILAMENT TO MMU".

In this commit I have made some changes if it helps: BastR@31b7462

maybe just create a separate PR for language text update? I'd prefer to keep this one a feature thing, and then you can update the text in a separate one?

Yes you’re right, there's no hurry. I'll try to do it later then.👍🏻

@BastR
Copy link
Contributor

BastR commented Apr 21, 2020

I've made some tests.

Inicial load work has expected but when switching to the next filament, MMU2 act like sensor is already triggered:

(octoprint terminal log)

> Send: T0
Recv: MMU <= T0
Recv: MMU <= 'A'
[...]
Recv: MMU => 'ok'
Recv: MMU <= 'C0'
[...]
Recv: MMU => 'ok'
Recv: MMU <= 'C0'
[...]
Recv: MMU => 'ok'
Recv: MMU <= 'C0'
[...]
Recv: MMU => 'ok'
Recv: MMU <= 'C0'
[...]
Recv: MMU => 'ok'
Recv: MMU <= 'C0'
[...]
Recv: MMU => 'ok'
Recv: MMU <= 'C0'
[...]
Recv: MMU => 'ok'

This is "normal" because the tool change is operated with MMU2::tool_change who send command(MMU_CMD_T0 + index) and then make check_filament() systematically, as the filament is already present when he start T command so the A command is sent to the MMU2. The MMU2 finishes discharging the filament from the nozzle but acts as if it were still present (command A).

In the Prusa firmware there is a condition called mmu_loading_flag that temporarily activates or deactivates the filament sensor when changing tools to avoid this.

@tonihoang
Copy link
Contributor Author

tonihoang commented Apr 21, 2020

I've made some tests.

thanks for the input, I did not notice this, as prusaslicer creates a ramming sequence which unloads the filament, on my G-Codes. I am still fighting with it as it causes the PTFE tube to jam, now waiting for my tube with wider inner diameter.

Don't know when I have time to add this yet.

@tonihoang
Copy link
Contributor Author

I've made some tests.

thanks for the input, I did not notice this, as prusaslicer creates a ramming sequence which unloads the filament, on my G-Codes. I am still fighting with it as it causes the PTFE tube to jam, now waiting for my tube with wider inner diameter.

Don't know when I have time to add this yet.

does anyone know the history here? it states in the comments that for toolchange it does not run the after load sequence as well, so I would assume also not to run unload? from running anything and expect GCode to be suitable?

@BastR
Copy link
Contributor

BastR commented Apr 22, 2020

does anyone know the history here? it states in the comments that for toolchange it does not run the after load sequence as well, so I would assume also not to run unload? from running anything and expect GCode to be suitable?

I'm sorry, but I don't understand

@thinkyhead thinkyhead merged commit 21067ab into MarlinFirmware:bugfix-2.0.x Apr 26, 2020
bool MMU2::load_to_gears() {
command(MMU_CMD_C0);
manage_response(true, true);
LOOP_L_N(i, MMU2_C0_RETRY) { // Keep loading until filament reaches gears
Copy link
Contributor

@GMagician GMagician Apr 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't here missing a check_filament call? before loop?
otherwise isn't the if () break; to be put after check_filament call?

@isanval
Copy link
Contributor

isanval commented Jul 6, 2020

How is PRUSA_MMU2_S_MODE supposedly to work? I mean, with MK3S and MMU2S the filament sensor is on the idler of the extruder.

When a Tx command is executed in Marlin, Marlin will send Tx/C0 commands to MMU2S and it will load the filament up to the nozzle, but while MMU2S is loading the filament, the extruder gears shouldn't be spining for an easy filament load into the extruder? I mean, if the extruder gears are not spining the MMU2S unit won't be able to insert the filament into the extruder and the sensor wouldn't be triggered.

@GMagician
Copy link
Contributor

I think ir sensor logic is done by enabling MMU_EXTRUDER_SENSOR

@isanval
Copy link
Contributor

isanval commented Jul 6, 2020

There are 2 posible sensors. The "MMU_EXTRUDER_SENSOR" is the one just before the extruder gears, and PRUSA_MMU2_S_MODE is the extruder idler sensor.

The first one has no resistance, it smoothly detects the filament.

But the second one needs a lot of torque to get the filament in or, the best option, to get the extruder gears spining while the filament is loaded until the sensor is triggered.

I want to test it myself, I need to spin the extruder gears as soon the C0 command is triggered and until the Abort command is received from the MMU2 unit. I identified the points in the source code where I should do the "spin/stop spin the gears" instructionsm, but I have no idea how to program this.

@GMagician
Copy link
Contributor

GMagician commented Jul 6, 2020

AFAIK MMU_EXTRUDER_SENSOR is the ir sensor that detect filament inside gears

@isanval
Copy link
Contributor

isanval commented Jul 6, 2020

From Configuration_adv.h I do not understand it as you say:

/**
 * MMU Extruder Sensor
 * Add support for Prusa IR Sensor (or other) to detect that filament reach the extruder to make loading filament more reliable
 * If your extruder is equipped with a filament sensor located less than 38mm from the gears you can use this feature
 * During loading to the extruder, the sensor will stop the loading command when he's triggered and make a last move to load filament to the gears
 * If no filament is detected, MMU2 will make more loading attemps, if finally no filament is detected, the printer will enter in runout state
 */

//#define MMU_EXTRUDER_SENSOR
/**
 * Using a sensor like the MMU2S
 * This mode only work if you have a MK3S extruder with sensor sensing the extruder idler mmu2s
 * See https://help.prusa3d.com/en/guide/3b-mk3s-mk2-5s-extruder-upgrade_41560, step 11
 */

//#define PRUSA_MMU2_S_MODE

In this video, MK3S and MMU2S you can see how the extruder gears are spining while the filament is being loaded:
https://www.youtube.com/watch?v=o7ghfPBW_AE#t=2m10s

@GMagician
Copy link
Contributor

right, sorry

@isanval
Copy link
Contributor

isanval commented Jul 7, 2020

Any way to get the extruder gears spining in PRUSA_MMU2_S_MODE while the Tx/C0 commands until the filament sensor is triggered?

How could I extrude slowly until the filament sensor is triggered? Any C functions in Marlin that can do that?

@isanval
Copy link
Contributor

isanval commented Jul 8, 2020

@kakou-fr I saw in 15149 that you were having the same problem than I'm facing now.

Did you get the MMU2S working with the filament sensor on the idler?

@kakou-fr
Copy link
Contributor

kakou-fr commented Jul 8, 2020

@kakou-fr I saw in 15149 that you were having the same problem than I'm facing now.

Did you get the MMU2S working with the filament sensor on the idler?

i think it's implemented in the bugfix version ?

@GMagician
Copy link
Contributor

i think it's implemented in the bugfix version ?

Yes bugfix has added ir-sensor on filament inside bontech gears

@isanval
Copy link
Contributor

isanval commented Jul 9, 2020

Thanks @kakou-fr and @GMagician for your response. I'm using the bugfix version dated from 2020-06-27.

Maybe I'm missing something, but the problem here is that when MMU is executing the C0 command the printer extruder is not spining, so the MMU unit is not able to push the filament into the extruder (it has no enough torque for that).

From my point of view, the solution would be to spin slowly the extruder gear while MMU is executing the C0 command and until the filament inside the bondtech gears is triggered. From my understanding, this is how MK3S/MMU2S works.

I'm doing something wrong? Is someone using the MMU with the sensor inside the bondtech gears and without problems?

@BastR
Copy link
Contributor

BastR commented Jul 9, 2020

@isanval I think you should open a issues because the post is starting to be long, is not related to the PRUSA_MMU2S_MODE and may not be visible to users who could help you.

Plz post your configuration in the new issue too

@tonihoang
Copy link
Contributor Author

Thanks @kakou-fr and @GMagician for your response. I'm using the bugfix version dated from 2020-06-27.

Maybe I'm missing something, but the problem here is that when MMU is executing the C0 command the printer extruder is not spining, so the MMU unit is not able to push the filament into the extruder (it has no enough torque for that).

From my point of view, the solution would be to spin slowly the extruder gear while MMU is executing the C0 command and until the filament inside the bondtech gears is triggered. From my understanding, this is how MK3S/MMU2S works.

I'm doing something wrong? Is someone using the MMU with the sensor inside the bondtech gears and without problems?

it does work for me for some filaments, that's why i stopped, but I did think about the problem you mention, so I was already thinking about how to do it but since noone mentioned it, i did not do anything.

if you open a new FR I can create a PR when I find some time.

@isanval
Copy link
Contributor

isanval commented Jul 9, 2020

@tonihoang nice, thank you! I will open a FR, no problem (#18599). I was trying to code it myself, but I'm not used to Marlin neither I know the available functions, so it's really difficult to me.

Thanks

jmp0x0000 pushed a commit to jmp0x0000/Marlin that referenced this pull request Aug 7, 2020
njibhu pushed a commit to njibhu/Marlin that referenced this pull request Aug 24, 2020
HairingX pushed a commit to HairingX/Marlin that referenced this pull request Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants