Skip to content

ENH: send files to external storage by default when a USB stick is present - #12146

Open
maziggy wants to merge 1 commit into
bambulab:masterfrom
maziggy:fix/default-to-external-storage
Open

ENH: send files to external storage by default when a USB stick is present#12146
maziggy wants to merge 1 commit into
bambulab:masterfrom
maziggy:fix/default-to-external-storage

Conversation

@maziggy

@maziggy maziggy commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Addresses #10481.

What happens today

A printer that can store a sliced file in its internal cache always does, whether
or not a USB stick is plugged in. Both dialogs decide this without asking, and
they get there by two different routes.

Print dialog. The firmware capability bit is forwarded straight through as
the destination: could_emmc_print, set from is_support_print_with_emmc,
becomes params.try_emmc_print unchanged. Nothing in the UI can alter it, so on
every printer that supports the cache, Print goes to the cache.

Send dialog. This one does offer a picker, but preselects the head of the
printer's media ability list. Firmware answers that query with emmc ahead of
udisk, so the head is always Cache -- even with a stick in, and even though the
dialog already knows there is one, having used exactly that two lines earlier to
decide whether the External radio should be enabled.

The consequence is the same either way: a file in the cache cannot be selected in
Bambu Handy, is not offered for a reprint on the printer's own screen, and is
invisible to anything reading the printer over FTP. The printer-side "Store sent
files on external storage" setting does not affect either path.

The change

Both dialogs now prefer external storage when a stick is present, and fall back
to the cache when there is not -- which is the only place the file can go then.

The capability and the choice become separate things. try_emmc_print is now
could_emmc_print && use_emmc_storage. could_emmc_print keeps its other jobs
unchanged: the port 6000 access-code check and the two no-SD-card gates in
PrintJob, which are about what the printer can do rather than where this file
goes.

use_emmc_storage defaults to true, so any caller that does not set it behaves
exactly as before -- the calibration jobs in CalibUtils keep their current
routing, including on a printer with no external storage at all. Only the two
dialogs set it.

m_if_has_sdcard had no initialiser. It already gated the External radio's
enabled state; it now also picks the default, so it is initialised to false.

Scope

The change is a no-op everywhere except the two cases it targets. With no stick
present, use_emmc_storage evaluates to true and try_emmc_print is
bit-for-bit what it was before; in the send dialog, want_emmc is then true and
the loop selects emmc, which firmware lists first, so it picks the same entry
.front() did. Printers without cache support are unaffected in both dialogs,
as are callers that never touch the new field.

Testing

Built and run against an H2D:

  • Stick present, Print: the file goes to external storage rather than the cache,
    and behaves as expected end to end.
  • Stick present, Send: the picker opens on External instead of Cache.

The no-stick path is unchanged by construction rather than by measurement -- see
Scope above; the computed values are identical to the current ones.

Measured while investigating: H2C/H2D route sliced sends to brtc://emmc/, while
X1C uses ftp:// and so was never affected in practice.

Not included

The Print dialog still has no storage picker of its own -- it now chooses well by
default, but cannot be overridden the way the Send dialog can. Adding one would
follow the existing show_timelapse_folder_popup pattern in SelectMachine.cpp
(folder button, Internal/External radio popup, External disabled with fallback
when no card). Happy to do that as a follow-up if you would like it, but it is a
UI addition and seemed better kept out of a behaviour fix.

…esent

A printer that can store a sliced file in its internal cache always did,
whether or not external storage was available. Both dialogs decided this
without ever asking which was wanted.

The print dialog forwarded the firmware capability bit straight through as
the destination: could_emmc_print, set from is_support_print_with_emmc,
became params.try_emmc_print unchanged. Nothing in the UI could alter it,
so on every printer that supports the cache, Print went to the cache.

The send dialog does offer a picker, but preselected the head of the
printer's media ability list. Firmware answers that query with "emmc"
ahead of "udisk", so the head was always Cache -- even with a stick in,
and even though the dialog already knew that, using it two lines earlier
to decide whether External could be enabled at all.

A file left in the cache cannot be selected in Bambu Handy, is not offered
for a reprint on the printer's own screen, and is invisible to anything
reading the printer over FTP. The printer-side "Store sent files on
external storage" setting does not affect either path.

Both now prefer external storage when a stick is present and fall back to
the cache when there is not, which is the only place the file can go then.
The two sites document the rule and point at each other.

The capability and the choice are now separate: try_emmc_print is
could_emmc_print && use_emmc_storage. could_emmc_print still guards the
port 6000 access-code check and the two no-SD-card gates in PrintJob,
which are about what the printer can do, not about where this file goes.
use_emmc_storage defaults to true so callers that do not set it are
unchanged -- the calibration jobs in CalibUtils keep their current
routing, including on a printer with no external storage at all.

m_if_has_sdcard had no initialiser. It already gated the External radio's
enabled state; it now also picks the default, so it is initialised false.

Reported as bambulab#10481.
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.

1 participant