ENH: send files to external storage by default when a USB stick is present - #12146
Open
maziggy wants to merge 1 commit into
Open
ENH: send files to external storage by default when a USB stick is present#12146maziggy wants to merge 1 commit into
maziggy wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 fromis_support_print_with_emmc,becomes
params.try_emmc_printunchanged. Nothing in the UI can alter it, so onevery 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
emmcahead ofudisk, so the head is always Cache -- even with a stick in, and even though thedialog 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_printis nowcould_emmc_print && use_emmc_storage.could_emmc_printkeeps its other jobsunchanged: 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 filegoes.
use_emmc_storagedefaults totrue, so any caller that does not set it behavesexactly as before -- the calibration jobs in
CalibUtilskeep their currentrouting, including on a printer with no external storage at all. Only the two
dialogs set it.
m_if_has_sdcardhad no initialiser. It already gated the External radio'senabled 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_storageevaluates totrueandtry_emmc_printisbit-for-bit what it was before; in the send dialog,
want_emmcis then true andthe 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:
and behaves as expected end to end.
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/, whileX1C 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_popuppattern inSelectMachine.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.