Adding support for M20 L?

Yes looking at comms.py: OctoPrint is looking for EXTENDED_M20 to decide whether to send the L. Marlin also sends that.

Recv: Cap:EXTENDED_M20:1

It seems Cap:LONG_FILENAME means M33 is supported and OctoPrint ignores it.

The LFN_WRITE capability was merged into the bugfix-2.0.x branch of Marlin in January this year, so it does seem to be new.

I have haven't updated OctoPrint or Marlin for many years until now. I don't understand how a Marlin bugfix branch would have new features in it compared to the last release.

Looking at the code in comms.py my best guess as to why the first M20 doesn't include an L is because the commands are queued, so perhaps the M20 command is built and added to the queue before the preceding M115 results have been parsed and the capability set.

M20 and M33 do not the same.
M20 throws out a file list, M33 gives a long filename for one file or a folder:

https://reprap.org/wiki/G-code#M20:_List_SD_card

https://reprap.org/wiki/G-code#M33:_Get_the_long_name_for_an_SD_card_file_or_folder

If you have M20 L, why would you need to use M33?

As far as I can see Cap:LONG_FILENAME:1 indicates M33 can be used but I don't think OctoPrint looks for that capability and I don't think it uses M33.

Because they are not the same (as mentioned above).

  • M33 is only supported by Marlin
  • Using of M33 is more complicated:
    1. Getting the SD file list
    1. Going through the list and request every long file name from the firmware

If M20 L sends the list of files with both the short and long names, why do you need M33? You have all the loing names. The only comments I can find for M33 is @foosel saying it doesn't scale as you have to call it for every file.

My only issues are that the first M20 after connection is missing the L parameter and when writing files OctoPrint sends the short name regardless of Recv: Cap:LFN_WRITE:1 which indicates Marlin will accept long names for writes.

Who said you have to use it?

I use neither M20 nor M33. I print, as it is intended, directly from OctoPrint.

On my LulzBot TAZ 6 (with LulzBot's Marlin 2.0.9.0.13 firmware), M20 and M20 L return only the 8.3 filenames but M33 returns the long file name. LulzBot probably doesn't have the right options selected.

1 Like

But does Octoprint display long files name by running all the 8.3 results from L20 though M33?

No, OctoPrint doesn't do anything with M33.

OctoPrint reads the results of M33, to update the file list. But it will not send an M33 command for every file in the list from M20, as it would lock up the serial connection for an unspecified length of time. There is however a plugin should you wish for this:

@nophead this does indeed sound like a bug - whether it is easily solvable or not due to the timing of the capabilities, it sounds like a bug and it should be fixed. Could you open a report on the repo? It doesn't have to be very detailed if you want to just reference the comments here. GitHub - OctoPrint/OctoPrint: OctoPrint is the snappy web interface for your 3D printer!

1 Like

yeah, that sounds like a possible race condition.

I have added an issue for the bug The first M20 done on connection is missing the L flag. Β· Issue #4493 Β· OctoPrint/OctoPrint Β· GitHub and also a request to support LFN_WRITE.

1 Like

Looks like the release version of Marlin always adds the ??? long filename unless the file has a long filename. I.e. Even files that have short uppercase names that are 8.3 compatible. So the only files that get a correct name are those with long names that have been written directly to the card.

I am surprised I am the only one to notice this. Does nobody else run the release version of Marlin with LONG_FILENAMES enabled?

I would think the majority of people that use OctoPrint don't use SD card printing, I know I don't.

1 Like

LOL, I do and I need the long file name to be displayed in OctoDash! :smiley:

Do I understand correctly that we'll have to wait for an update to fixt it?

Long filenames could potentially be problematic with OctoDash too. I think it has it's own clipping of filename that will only show the first x characters and then finish out with ellipses IIRC.

If I understand you correctly we have a multiple problem. A bug in both OctoPrint and OctoDash, correct?

Bug in OctoPrint for initial loading issue based on what I've read here, and potential feature request in OctoDash. The file list in OctoDash will display a lot of characters, but if it does go beyond the length available on screen it will truncate, see below example, 4th file down.

If this picture is of OctoDash then mine doesn't show it like this. It shows it in a 8.3 format. If it would show it like this I would have not mentioned it.