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

[FR] Binary format for gcode-files for faster transfer #20255

Open
jtkDvlp opened this issue Nov 23, 2020 · 9 comments
Open

[FR] Binary format for gcode-files for faster transfer #20255

jtkDvlp opened this issue Nov 23, 2020 · 9 comments
Labels
T: Feature Request Features requested by users.

Comments

@jtkDvlp
Copy link

jtkDvlp commented Nov 23, 2020

Description

Hi there,

a few weeks ago I decided to write my own wifi printer client (not public yet, will comming). Its working well, I also upload gcode files via wifi to the printers sd card and of course as others already mentioned its slow caused by the serial interface. Of course you could try to get the communication better, but I thinks thats difficult if you dont want to make big changes to the communication itself. But the gcode transfered actual is human readable. Of course thats useful if you want to control the printer via console. But for printing you dont do this just for configuring. So there is no need for human readable gcode files per se. So I decied to give it a try and two afternoon later I had written a snippet converting gcode to binary gcode and vise versa saving up to 50% file size. For my simplicity its written in clojure. But I also could provide an JavaScript Version for clients and C / C++ Version for the firmware.

If there is interest in such a feature and the marlin contributors are willing to accept such a pull request, it would be nice to get this done. As already mentioned I can do / help with this.

For writting the C / C++ part for the firmware it would be nice to get a little api description I have to provide or some direct source links to read getting an overview for the integration.

Best regards
jtkdvlp

Additional Information

Clojure snippet to convert gcode to binary gcode and vise versa saving up to 50% file size.
https://gist.github.com/jtkDvlp/05322a3c333410f1b89ce98808964d9d

@jtkDvlp jtkDvlp added the T: Feature Request Features requested by users. label Nov 23, 2020
@ellensp
Copy link
Contributor

ellensp commented Nov 23, 2020

There have been several attempts at this
see BINARY_FILE_TRANSFER (currently in Marlin)
and https://reprap.org/wiki/Packed_Binary_GCode

@jtkDvlp
Copy link
Author

jtkDvlp commented Nov 23, 2020

Mmh XD perfect!

So this option accepts gcode files with schema of the wiki articel? Do you know some client code for this? Otherwise I tweak my code.

@ellensp
Copy link
Contributor

ellensp commented Nov 23, 2020

Different systems.

From reading the code BINARY_FILE_TRANSFER uses compression, this https://github.com/atomicobject/heatshrink

@rhapsodyv
Copy link
Member

Here is the original PR. It have a script for upload binary data to marlin too. #14817

@jtkDvlp
Copy link
Author

jtkDvlp commented Nov 23, 2020

@ellensp does BINARY_FILE_TRANSFER work. I send M28 B1 foo, then sending some binary stuff and ending with M29 foo but the printer does not respond. Any ideas?

@p3p
Copy link
Member

p3p commented Nov 23, 2020

BINARY_FILE_TRANSFER #14817 as it is currently in Marlin, can only be used to transfer files to the sdcard. To use BINARY_FILE_TRANSFER you need to implement the protocol as described, or just use the script provided, I think there's an octoprint plugin that takes advantage of it for GCode file uploads.

It is still a project I'm working on and the version in Marlin is unfinished (my dev version is nothing like the it), other things have taken priority, at its core this feature is just a multi channel serial binary transport layer, and you could implement any binary protocol you wanted on top of it, I think streaming compressed gcode is enough of a bandwidth improvement, but you could also implement a binary gcode protocol which would probably be more computationally efficient on the mcu.

@ellensp
Copy link
Contributor

ellensp commented Nov 24, 2020

Never looked at it.

But I just gave it a try.

NB transfer.py does not handle long files names (neither does marlin). only 8.3

On USBCDC 32bit Machines this seems to work as expected
On serial 8 bit machines I get timeout errors

@jtkDvlp
Copy link
Author

jtkDvlp commented Nov 24, 2020

@p3p do you have slack or discord for this feature?

@p3p
Copy link
Member

p3p commented Nov 24, 2020

Nothing specific to the feature no, I'm on the Marlin discord if you would like to discus something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: Feature Request Features requested by users.
Projects
None yet
Development

No branches or pull requests

4 participants