garethky / PrusaSlicerPressureAdvanceCalibration

An web tool that modified PrusaSlicer GCode to add a Pressure Advance test pattern
https://garethky.github.io/PrusaSlicerPressureAdvanceCalibration/
GNU General Public License v3.0
3 stars 1 forks source link

Support .bgcode files #6

Closed garethky closed 7 months ago

garethky commented 7 months ago

The new version of Pruse Slicer emits a new format to the MK4, XL and Mini ('Buddy' firmware) called bgcode. Reference implementation in C: https://github.com/prusa3d/libbgcode/blob/main/doc/bgcode.md

This is annoying because you have to turn this option off every time you want to use the Pressure Advance tool. You cant even change the file extension in the export dialog back to .gcode, this just gets you bgcode in a gcode file. So it would be a usability improvement if users didn't have to go through this step.

One of the GCode encoding options for meatpack drops comments. This is a deal breaker for us if that includes the post-gcode comment blocks with the slicer settings. So step 1 is to take some bgcode output and validate that decoding it results in the comment blocks we need still being in there.

Then we could investigate using emscripten to compile the bgcode tool to WebAssembly so a complete re-write in TypeScript isn't necessary. https://developer.mozilla.org/en-US/docs/WebAssembly/C_to_Wasm

garethky commented 7 months ago

Slicer Metadata is its own block type in the spec: https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#slicer-metadata So the slicer metadata in preserved.

And the project actually provided an emscripten example already: https://github.com/prusa3d/libbgcode/blob/main/src/LibBGCode/wasm/

And their github actions actually build the WASM target, it cam be found int he build artifacts of the latest build: e.g. https://github.com/prusa3d/libbgcode/actions/runs/6891784314 (they haven't yet put out a release to the releases tab with artifacts though)

garethky commented 7 months ago

Support added. Closed by: https://github.com/garethky/PrusaSlicerPressureAdvanceCalibration/commit/427cffe9fe4fa70b5eccc54cc61b183668a0f5d9