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

Add 'one click print' feature #25781

Merged
merged 7 commits into from
May 15, 2023
Merged

Conversation

ellensp
Copy link
Contributor

@ellensp ellensp commented May 5, 2023

Description

Adds advanced option: ONE_CLICK_PRINT

With this option enabled on power-up with media or insertion of media, Marlin will search for the newest gcode file and prompt the user to print that file.

Simply selecting Confirm (the default) will print the latest file in one click.

Example:
One Click Print screen

Requirements

SDSUPPORT, a display that uses Marlin Menus, NO_SD_AUTOSTART and ONE_CLICK_PRINT

Benefits

Marlin support true one click printing.

Configurations

Config file part of the PR, as options have been added

Related Issues

Has been requesting in Discord a number of times, and there is a FR for it somewhere (can't find it just now)

@thinkyhead
Copy link
Member

thinkyhead commented May 14, 2023

Pretty cool! I think we could tweak it slightly to imitate SD_REPRINT_LAST_SELECTED_FILE where it puts up the select_screen.

  char * const longest = card.longest_filename();
  char buffer[strlen(longest) + 2];
  buffer[0] = ' ';
  strcpy(buffer + 1, longest);
  MenuItem_confirm::select_screen(
    GET_TEXT_F(MSG_BUTTON_PRINT), GET_TEXT_F(MSG_BUTTON_CANCEL),
   []{
      card.openAndPrintFile(card.filename);
      ui.return_to_status();
      ui.reset_status();
    }, nullptr,
    GET_TEXT_F(MSG_ONE_CLICK_PRINT), buffer, F("?")
  );

The relevant workDir and filename just need to be selected within CardReader by the same methodology as diveToFile before the working directory and file name are ready to be used by openAndPrintFile(card.filename). That should also result in less buffer being needed since we never need to store any full path outside of the recursive dive. We just store the final workDir and short path which already have storage set aside in CardReader.

@thinkyhead thinkyhead force-pushed the one-click branch 3 times, most recently from ce98fa5 to aac3032 Compare May 14, 2023 05:40
@thinkyhead
Copy link
Member

Well, I went for it a bit there but haven't gotten into testing it yet. Maybe more of the stuff in CardReader::manage_media can/should be moved to MarlinUI::media_changed, as that's where BROWSE_MEDIA_ON_INSERT happens, among other things. There's also this feature PASSWORD_ON_SD_PRINT_MENU that's meant to require a password for SD printing, so we might look at that (and how it also interacts with SD_REPRINT_LAST_SELECTED_FILE).

Anyway, I'm fading here at 3am so I'll hold off on flashing my printer, testing, and debugging until after a long snooze.

@thinkyhead
Copy link
Member

Somehow those updates actually worked the first time, which is surprising considering how convoluted CardReader can be. The important thing is that is (usually) uses less memory and doesn't require copying the whole path each time it finds a newer file. It just copies the MediaFile and short name, which adds up to ~37 bytes.

The Select Screen function expects to draw wrapped strings, so it's not great at making inverted headings / prefixes, but I think users will forgive that aspect. For color screens, at least, it should be pretty easy to change the prefix and string/filename colors later on.

Anyway, it works as you would want. On first boot it asks if you want to print the newest file on the attached media. And it does the same for any media inserted later. I'm not sure how it will behave when booting with both an SD card and a Flash Drive inserted at the same time. We'll have to work that out sooner or later, along with making it work with password protection.

thinkyhead added a commit to MarlinFirmware/Configurations that referenced this pull request May 15, 2023
MarlinFirmware/Marlin#25781

Co-Authored-By: ellensp <530024+ellensp@users.noreply.github.com>
thinkyhead added a commit to MarlinFirmware/Configurations that referenced this pull request May 15, 2023
MarlinFirmware/Marlin#25781

Co-Authored-By: ellensp <530024+ellensp@users.noreply.github.com>
@thinkyhead thinkyhead merged commit 2e24637 into MarlinFirmware:bugfix-2.1.x May 15, 2023
56 checks passed
oponyx pushed a commit to oponyx/Marlin that referenced this pull request May 15, 2023
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
oponyx pushed a commit to oponyx/Marlin that referenced this pull request May 15, 2023
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
EvilGremlin pushed a commit to EvilGremlin/Marlin that referenced this pull request May 17, 2023
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
@ellensp ellensp deleted the one-click branch May 23, 2023 03:38
tspiva pushed a commit to tspiva/Marlin that referenced this pull request May 25, 2023
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Andy-Big pushed a commit to Andy-Big/Marlin_FB_Reborn that referenced this pull request Jul 15, 2023
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Andy-Big pushed a commit to Andy-Big/Marlin_FB_Reborn that referenced this pull request Jul 18, 2023
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
mriscoc added a commit to mriscoc/Ender3V2S1 that referenced this pull request Aug 5, 2023
- LCD brightness dims after 5 minute timeout (not available in all versions)
- Slow retract item in Filament management menu
- Better bed tramming wizard
- Automatic homing axes before M48 (Probe test) if necessary
- Support to M86-M87 Hotend Idle Timeout
- Fixed C104 bug
- Fixed bug in UBL when an invalid point is found
- Improved UBL smart-fill
- M300 E1/0 enables or disables sounds
- C851 F edit probe Z fix compensation
- Fixed BLTouch deploy bug in HS mode
- Several minor bug fixes and Misc. optimizations
- New OFFICIAL/CUSTOM BUILD label in the info page
- and many more fixes from latest Marlin's bugfix 2.1.x

In Source:
- Added support to One cLick print MarlinFirmware/Marlin#25781
- Preliminary support for E3 Free-runs board CR4NTxxC10 and other boards https://store.creality.com/products/e3-free-runs-tmc2209-32-bit-open-source-silent-motherboard
- Fixed Time Motion experimental support
- Improved support for Marlin Auto Build firmware xfer
- Maple support was deprecated
mriscoc added a commit to mriscoc/Ender3V2S1 that referenced this pull request Aug 17, 2023
- Improved filament run-out code
- Fix Input shaping menu items
- Fixes bug on some boards that disables ProUI extensions on cold boot.

Universal AUGUST 2023 Edition (20230805)
- LCD brightness dims after 5 minute timeout (not available in all versions)
- Slow retract item in Filament management menu
- Better bed tramming wizard
- Automatic homing axes before M48 (Probe test) if necessary
- Support to M86-M87 Hotend Idle Timeout
- Fixed C104 bug
- Fixed bug in UBL when an invalid point is found
- Improved UBL smart-fill
- M300 E1/0 enables or disables sounds
- C851 F edit probe Z fix compensation
- Fixed BLTouch deploy bug in HS mode
- Several minor bug fixes and Misc. optimizations
- New OFFICIAL/CUSTOM BUILD label in the info page
- and many more fixes from latest Marlin's bugfix 2.1.x

In Source:
- Added support to One cLick print MarlinFirmware/Marlin#25781
- Preliminary support for E3 Free-runs board CR4NTxxC10 and other boards https://store.creality.com/products/e3-free-runs-tmc2209-32-bit-open-source-silent-motherboard
- Fixed Time Motion experimental support
- Improved support for Marlin Auto Build firmware xfer
- Fix EZABL compile
- Maple support was deprecated
mriscoc added a commit to mriscoc/Ender3V2S1 that referenced this pull request Aug 17, 2023
- Improved filament run-out code
- Fix Input shaping menu items
- Fixes bug on some boards that disables ProUI extensions on cold boot.

Universal AUGUST 2023 Edition (20230805)
- LCD brightness dims after 5 minute timeout (not available in all versions)
- Slow retract item in Filament management menu
- Better bed tramming wizard
- Automatic homing axes before M48 (Probe test) if necessary
- Support to M86-M87 Hotend Idle Timeout
- Fixed C104 bug
- Fixed bug in UBL when an invalid point is found
- Improved UBL smart-fill
- M300 E1/0 enables or disables sounds
- C851 F edit probe Z fix compensation
- Fixed BLTouch deploy bug in HS mode
- Several minor bug fixes and Misc. optimizations
- New OFFICIAL/CUSTOM BUILD label in the info page
- and many more fixes from latest Marlin's bugfix 2.1.x

In Source:
- Added support to One cLick print MarlinFirmware/Marlin#25781
- Preliminary support for E3 Free-runs board CR4NTxxC10 and other boards https://store.creality.com/products/e3-free-runs-tmc2209-32-bit-open-source-silent-motherboard
- Fixed Time Motion experimental support
- Improved support for Marlin Auto Build firmware xfer
- Fix EZABL compile
- Maple support was deprecated
Frank0587 pushed a commit to Frank0587/Marlin that referenced this pull request Sep 5, 2023
- Improved filament run-out code
- Fix Input shaping menu items
- Fixes bug on some boards that disables ProUI extensions on cold boot.

Universal AUGUST 2023 Edition (20230805)
- LCD brightness dims after 5 minute timeout (not available in all versions)
- Slow retract item in Filament management menu
- Better bed tramming wizard
- Automatic homing axes before M48 (Probe test) if necessary
- Support to M86-M87 Hotend Idle Timeout
- Fixed C104 bug
- Fixed bug in UBL when an invalid point is found
- Improved UBL smart-fill
- M300 E1/0 enables or disables sounds
- C851 F edit probe Z fix compensation
- Fixed BLTouch deploy bug in HS mode
- Several minor bug fixes and Misc. optimizations
- New OFFICIAL/CUSTOM BUILD label in the info page
- and many more fixes from latest Marlin's bugfix 2.1.x

In Source:
- Added support to One cLick print MarlinFirmware#25781
- Preliminary support for E3 Free-runs board CR4NTxxC10 and other boards https://store.creality.com/products/e3-free-runs-tmc2209-32-bit-open-source-silent-motherboard
- Fixed Time Motion experimental support
- Improved support for Marlin Auto Build firmware xfer
- Fix EZABL compile
- Maple support was deprecated
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.

None yet

3 participants