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

PFW-1559 Add filament presence check at start of print #4727

Merged
merged 17 commits into from
Aug 30, 2024

Conversation

gudnimg
Copy link
Collaborator

@gudnimg gudnimg commented Jul 25, 2024

Add filament presence check at start of print job. This PR aims to resolve issues where a user starts a print with no filament loaded. The idea is to use the M862 warning dialogs instead of relying on filament sensor runout. Relying on filament runout will require some fragile logic which may not be very reliable and risks adding new issues.

A new menu setting is added to configure how strict the check should be.

  • None: No check is performed
  • Warning (default): The user is warned about missing filament and is prompted to continue with Yes/No. If No is selected, the print is aborted. If no user input is given (e.g. from host printing) then the warning will expire in 30 seconds and the printer assumes the Yes option was selected.
  • Strict: If the filament is not detected when a print is started, it is immediately canceled with a message saying the filament is missing.

The check is currently performed on G-codes: M24 and M75. Starting a SD print and Host print respectively.

Copy link

github-actions bot commented Jul 25, 2024

All values in bytes. Δ Delta to base

Target ΔFlash ΔSRAM Used Flash Used SRAM Free Flash Free SRAM
MK3S_MULTILANG 0 1 248030 5654 5922 2538
MK3_MULTILANG 20 1 247408 5663 6544 2529

Firmware/eeprom.h Outdated Show resolved Hide resolved
Firmware/messages.cpp Show resolved Hide resolved
@gudnimg gudnimg marked this pull request as ready for review July 26, 2024 16:04
@gudnimg gudnimg added this to the FW 3.14.1 milestone Jul 27, 2024
@gudnimg gudnimg linked an issue Jul 27, 2024 that may be closed by this pull request
@gudnimg
Copy link
Collaborator Author

gudnimg commented Jul 27, 2024

The following videos demonstrate the changes more visually 😃

This video shows the default setting (Warning). I attempt to start a print with no filament loaded.
https://github.com/user-attachments/assets/334b5e05-1906-4891-9bea-38dbfcf5865a

This video shows the "Strict" setting. It will always cancel the print if filament is not loaded.
https://github.com/user-attachments/assets/d5a4fcf2-1716-4241-b88a-de5b2e829f15

Copy link
Collaborator

@leptun leptun left a comment

Choose a reason for hiding this comment

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

Tested on MK3 (PAT9125). Works really nicely!

@gudnimg gudnimg linked an issue Jul 29, 2024 that may be closed by this pull request
@gudnimg gudnimg changed the title Add filament presence check at start of print PFW-1559 Add filament presence check at start of print Jul 31, 2024
@gudnimg gudnimg force-pushed the improve-missing-filament branch 2 times, most recently from 673e856 to fb770cb Compare August 3, 2024 15:46
@gudnimg
Copy link
Collaborator Author

gudnimg commented Aug 3, 2024

Synced the PR with latest MK3 branch. Also got rid of the "fixup" commit to make the history a bit cleaner. (No code has been changed)

@gudnimg
Copy link
Collaborator Author

gudnimg commented Aug 15, 2024

Please do not merge this yet. I want to remove the mmu2.h include in utils.cpp. To make unit testing easier to begin with.

To check if the MMU is enabled, I think it is ok to read the EEPROM value. The printer check shouldnt care if the MMU is communicating or not, it only cares if it is enabled at all.

@gudnimg
Copy link
Collaborator Author

gudnimg commented Aug 15, 2024

Should be ready for review again

A new menu setting is added to configure how strict the check should be.

- None: No check is performed
- Warning (default): The user is warned about missing and is prompted to continue with Yes/No. If No is selected, the print is aborted. If no user input is given (e.g. from host printing) then the warning will expire in 30 seconds and assume the Yes option was selected
- Strict: If the filament is not detected when a print is started, it is immediately canceled.

The check is currently performed on G-codes: M24 and M75. Starting a SD print and Host print respectively.
Change in memory:
Flash: -54 bytes
SRAM: 0 bytes
Pull all checks needed into the function such that the caller
only needs to check the return value

Also added description for the filament_presence_check function
Configuration->HW Setup->Checks showed `a`

MSG_FILAMENT `Filament` can only be 8 chars long and only ES and IT had `Filemanto` as translation.
But as ES the `o` in `Filamento` was overwritten by `[Estricto]` I removed the MSG_FILAMENT to be translated.
Saves few bytes.
Used `trans -b :cs+de+es+fr+hr+hu+it+nl+no+pl+ro+sk+sv "<text>"` to translate
Looked at pre-translated text to reuse as much as possible.
Copy link
Collaborator

@3d-gussner 3d-gussner left a comment

Choose a reason for hiding this comment

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

Please check gudnimg#8

@3d-gussner 3d-gussner self-requested a review August 30, 2024 08:43
@3d-gussner 3d-gussner merged commit d3c326d into prusa3d:MK3 Aug 30, 2024
4 checks passed
@gudnimg gudnimg deleted the improve-missing-filament branch August 30, 2024 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Printing starts without filament FW 3.13.0-3.13.1 filament detection not working at print start
3 participants