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

MMU improved fsensor handling #3885

Open
wants to merge 8 commits into
base: MK3
Choose a base branch
from
Open

Conversation

leptun
Copy link
Collaborator

@leptun leptun commented Jan 9, 2023

  • FSensorBlockRunout now properly handles nesting of the blocker.
  • Events were introduced in the filament sensor code. These can be checked using polling for the three supported actions: runout, autoload and filament jam. These flags persist until they are manually cleared. These events work regardless of the FSensorBlockRunout suppression status, but can be disabled using the global eeprom setting. Example usage of these flags are checking for issues in VerifyFilamentEnteredPTFE, checking for autoload events when the user is expected to insert a filament, etc...
  • These events allow VerifyFilamentEnteredPTFE to actually do it's job on non-S printers, so if the printer fails to grab the filament, the issue will be detected and a reload will be issued. On S printers, the jam event will never happen since that fsensor doesn't have the capability.

@leptun leptun requested a review from gudnimg January 9, 2023 15:48
@leptun leptun added this to the FW 3.13.0 milestone Jan 9, 2023
@leptun
Copy link
Collaborator Author

leptun commented Jan 9, 2023

@gudnimg suggestion: It might be helpful if we forced a rehome of the MMU after unload when a VerifyFilamentEnteredPTFE error occurs. On the non-S printers, VerifyFilamentEnteredPTFE can fail due to filament strings where the fsensor sees "filament" too early, so the gears don't end up grabbing it. The current behaviour is to just unload the filament and immediately load back, which does nothing about the strings. If the selector were to move away from the slot and back (eg, due to rehoming), it might be enough to bend the stringy tip backwards and force it to load correctly on the next loading attempt. I'm not sure if cutting plays any role in this retry attempt since I haven't used it for now (due to 12V unit which struggles significantly more than the 24V mmu).

@gudnimg
Copy link
Collaborator

gudnimg commented Jan 15, 2023

It might be helpful if we forced a rehome of the MMU after unload when a VerifyFilamentEnteredPTFE error occurs.

We would need some way to tell the MMU to invalidate the homing 🤔 I think a G-code is overkill, but maybe a command via the Protocol would suffice and add 'H' to enum class RequestMsgCodes to tell the MMU to home (via invalidating its current homing, state machine will take care of homing automatically)

@DRracer what are your thoughts on this?

Looking closer I see we already have Home = 'H' 🤔

@DRracer
Copy link
Collaborator

DRracer commented Jan 16, 2023

Yes, we can issue a homing command when the MMU is not performing anything else.

@DRracer DRracer modified the milestones: FW 3.13.0-RC1, FW 3.13.0-RC2 Feb 17, 2023
@gudnimg
Copy link
Collaborator

gudnimg commented Apr 29, 2023

Rebased to sync with MK3 branch

@leptun
Copy link
Collaborator Author

leptun commented Apr 30, 2023

@gudnimg The VerifyFilamentEnteredPTFE() jam detection seems to be working correctly after rebase. One note though: it's weird that there is no indication whatsoever that a jam happened during the checking. The progress bar can show all blocks as ok, but the VerifyFilamentEnteredPTFE() could still fail in the end because of the jam event. Any proposals as to what we could do about this?

@leptun leptun marked this pull request as ready for review April 30, 2023 00:27
@leptun leptun changed the title 🚧 MMU improved fsensor handling MMU improved fsensor handling Apr 30, 2023
@gudnimg
Copy link
Collaborator

gudnimg commented Apr 30, 2023

@gudnimg The VerifyFilamentEnteredPTFE() jam detection seems to be working correctly after rebase. One note though: it's weird that there is no indication whatsoever that a jam happened during the checking. The progress bar can show all blocks as ok, but the VerifyFilamentEnteredPTFE() could still fail in the end because of the jam event. Any proposals as to what we could do about this?

I added a commit today PR 4080 to log the result c7f669f Maybe we can echo jam as failure reason?

Would it make sense to check the jam event more regularly so we can show the status with individual pixel?

@leptun
Copy link
Collaborator Author

leptun commented Apr 30, 2023

We could check it more regularly instead of just the end. Would we show only one block as "jammed" or all blocks following the jam event?

@leptun
Copy link
Collaborator Author

leptun commented Apr 30, 2023

Done. The pixels now show an "error" for each jam event that is generated

@leptun
Copy link
Collaborator Author

leptun commented Apr 30, 2023

Testing scenario:

  1. Check that the filament loads to the nozzle correctly with MMU. This is to be tested on both MK3 and MK3S. Also check that if the gears fail to grab the filament, the VerifyFilamentEnteredPTFE() fails and retries.
  2. Check that autoloading works. This is to be tested both from a cold printer and a preheated printer. When the filament is inserted while cold, the filament prompt should be displayed. If the printer is already hot, the filament should just start being loaded. If there is a prompt that says "press to continue", the filament can be removed and inserted back and the prompt should be dismissed. This behavior is implemented for both the regular filament loading/autoloading and for the M600 change filament command / filament runout/jam.

@gudnimg
Copy link
Collaborator

gudnimg commented Apr 30, 2023

I'll try running this on my MK3S+ this evening. 👍

@gudnimg
Copy link
Collaborator

gudnimg commented Apr 30, 2023

Tested the current changes on MK3S+ with MMU. Note I added these changes on top of PR #4080 to test those together.

  • ✅ Load to Nozzle from LCD
  • ✅ Sending T0 and T4 gcodes after preheating
  • ✅ M600
  • ✅ Starting Single color MMU print

Firmware/mmu2.cpp Outdated Show resolved Hide resolved
Firmware/mmu2.cpp Outdated Show resolved Hide resolved
@leptun
Copy link
Collaborator Author

leptun commented Apr 30, 2023

@gudnimg What still needs to be done is to extract these Filament_sensor.h specific code from mmu2.cpp to mmu2_fsensor.cpp so that it can be ported to the MK4 fw. Afaik, the MK4 side doesn't have this jam detection capability yet, but it could in theory be implemented with the loadcell. The ifdefs for the defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125) can then be added to the wrappers in mmu2_fsensor.cpp

@gudnimg
Copy link
Collaborator

gudnimg commented Apr 30, 2023

The PR seems to add about ~130B on MK3S+. The ifdefs only save ~30B. I wonder what is using more memory 🤔

@leptun
Copy link
Collaborator Author

leptun commented Apr 30, 2023

The rest of the changes for autoloading and events in general I guess?

@leptun leptun requested a review from DRracer April 30, 2023 14:39
@leptun
Copy link
Collaborator Author

leptun commented Apr 30, 2023

@DRracer I'd like to get the mmu2_fsensor.h interfaces unified with the Buddy fw. I see that the buddy fw uses BlockRunoutRAII, something which we don't have here. Instead, we have FSensorBlockRunout in Filament_sensor.h which is functionally identical. How should we proceed with unifying the code? I want to get rid of all Filament_sensor.h dependencies in mmu2.cpp. Only mmu2_fsensor.cpp should make MK3 fw specific calls.

@3d-gussner 3d-gussner modified the milestones: FW 3.13.1, FW 3.14.0 Aug 2, 2023
@3d-gussner 3d-gussner added the Post release tasks open Tasks after release label Sep 29, 2023
@3d-gussner 3d-gussner added the MMU MMU2s and MMU3 label Oct 20, 2023
@leptun leptun modified the milestones: FW 3.14.0, FW 3.14.1 Nov 25, 2023
@3d-gussner
Copy link
Collaborator

@DRracer @leptun @gudnimg What is the status of this one? Needs some attention to fix the conflicts.

@3d-gussner 3d-gussner removed this from the FW 3.14.1 milestone Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MMU MMU2s and MMU3 Post release tasks open Tasks after release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants