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

Document different gcode data block encoding format in specification #36

Open
mtreinish opened this issue Nov 29, 2023 · 1 comment
Open

Comments

@mtreinish
Copy link

Right now the G-Code data block just lists the encoding header format and lists the possible values for the header field:

0 = No encoding
1 = MeatPack algorithm
2 = MeatPack algorithm modified to keep comment lines

without defining what MeatPack or the modified MeatPack algorithms are. It would be good if the definition of those encoding types were documented (also assuming no encoding just means the text gcode). While you can look at the source code, documenting the actual specifics of the encoding formats will make the specification more useful for people trying to interoperate with the format.

@elfrocampeador
Copy link

I agree that the actual compression algorithm should be documented. This is an error shared by its creator, but considering the core code is only a couple hundred lines long it really shouldn't be difficult to explain.

For proof of concept / preliminary suggestion, here's my attempt based on reading the original Meatpack code:
"libbgcode implements the Meatpack gcode binary compression algorithm created by Scott Mudge (https://github.com/scottmudge/". It takes advantage of the small set of approximately 15 characters needed by gcode by assigning each character a 4 bit representation. Each pair of characters in the ASCII gcode can be compressed into a single byte by bitshifting the first character's binary representation left and combining them with a bitwise or operation. Combined with a few other structural details, this results in a nearly 2:1 reduction of space usage."

This is just a crude start, but I hope this illustrates how the effect can be achieved with relatively little text.

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

No branches or pull requests

2 participants