Skip to content

fix: M20 F: list binary files without ProUI#27977

Merged
thinkyhead merged 4 commits intoMarlinFirmware:bugfix-2.1.xfrom
hannesweisbach:fix-m20-binary-listing
Aug 14, 2025
Merged

fix: M20 F: list binary files without ProUI#27977
thinkyhead merged 4 commits intoMarlinFirmware:bugfix-2.1.xfrom
hannesweisbach:fix-m20-binary-listing

Conversation

@hannesweisbach
Copy link
Contributor

This addresses #24332.

Likely #23878 introduced a change, where M20 F listed binary only when DO_LIST_BIN_FILES was set, which in turn was only set indirectly by DWIN_LCD_PROUI.

This fix re-enables listing ".BIN"-files when CUSTOM_FIRMWARE_UPLOAD is configured, as documented for M20.

".BIN" files are only listed for M20 F, not in the UI on the printer. Which, from my interpretation of #23878 (comment), is the desired behaviour.

Description

CardReader::is_visible_entity() decides if a directory entry will be displayed/listed or not. If an entry is considered a binary file or not is stored in card_flags_t::filenameIsBin. However, card_flags_t::filenameIsBin used to exist only, if DO_LIST_BIN_FILES was set. At the same time DO_LIST_BIN_FILES also guards reading from and writing to card_flags_t::filenameIsBin in CardReader::fileIsBinary() and CardReader::setBinFlag().

The documentation for M20 says that withCUSTOM_FIRMWARE_UPLOAD M20 F becomes available to list BIN files. This is not what the code does.
First, the preprocessor directives had to be changed to DO_LIST_BIN_FILES || ENABLED(CUSTOM_FIRMWARE_UPLOAD), to enable storing of the filenameIsBin card flag.

Additionally, setting the flag in is_visble_entity() via setBinFlag has to depend on the parameter onlyBin, to list BIN files only for M20 F, but not when constructing a file list for the graphical UI.

Maybe it's a better idea to have DWIN_LCD_PROUI imply CUSTOM_SOFTWARE_UPLOAD, but I don't know the config/Marlin well enough to decide, so I went with the uglier, but safer option.

Requirements

Reproduction:

  • Requires SD support
  • CUSTOM_FIRMWARE_UPLOAD config
  • DWIN_LCD_PROUI config disabled/not set
  • place BIN file on SD card
  • M20 F will not show BIN file

With this patch:

Benefits

M20 F behaves according to specification for all board/configs; not only when DWIN_LCD_PROUI is set.

Configurations

Minimal Config (probably):

  • SD_SUPPORT
  • BINARY_FILE_TRANSFER
  • CUSTOM_FIRMWARE_UPLOAD

config.zip

Related Issues

This aims to fix #24332

This addresses MarlinFirmware#24332.

Likely MarlinFirmware#23878 introduced a change, where M20 F listed binary only when
DO_LIST_BIN_FILES was set, which in turn was only set indirectly by
DWIN_LCD_PROUI.

This fix re-enables listing ".BIN"-files when CUSTOM_FIRMWARE_UPLOAD is
configured, as documented for M20.

".BIN" files are only listed for M20 F, not in the UI on the printer.

Signed-off-by: Hannes Weisbach <[email protected]>
@thinkyhead
Copy link
Member

I modified is_visible_entity so that it marks .BIN files as such (when the flag exists), even when the M20 command does not specify "ONLY BIN files." The apparent intent without the flag is to list both .GCO and .BIN files. If the actual usage and intent was to list only BIN files or only G-code files, exclusively, then the flag's name needs to be changed to clarify that intent.

@thinkyhead
Copy link
Member

It appears that listing only BIN xor GCODE was our original intent, but this got lost in #23878. I'll revert the behavior and clarify the flag name.

@thinkyhead thinkyhead merged commit f81ca65 into MarlinFirmware:bugfix-2.1.x Aug 14, 2025
66 checks passed
bsdnomad pushed a commit to bsdnomad/Marlin that referenced this pull request Sep 25, 2025
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.

[BUG] Binary files not listed with M20 without E3V2 ProUI

3 participants

Comments