Original and annotated versions of the default machine start (pre-print) G-code for the Bambu Lab P2S 3D printer, as shipped with Bambu Studio 2.5.0.66 (G-code version 2026/02/26).
machine_start.gcode— Original start G-codemachine_start_annotated.gcode— Annotated copy with documentation comments
- Every line is documented with a comment explaining what it does
- Only confirmed information is included, unknowns are marked with
TODO - Bambu's own inline comments are preserved as-is
- Slicer template syntax (
{if},{else},{endif},[variable]) is explained in context
- Standard Marlin G-codes (G0/G1, G28, G90/G91, M104/M109, M140/M190, M106, etc.)
- Bambu-proprietary commands (M1002, M620/M621, M960, M970/M974/M975, G150.x, G380, etc.)
- Slicer conditional logic and template variables
- LCD/app status messages (
M1002 gcode_claim_action) with display strings from BambuStudio source - AMS filament handling, flow dynamics calibration, vibration compensation, build plate detection
- P2S-specific commands not present on older models (G150.x wiper system, G130 purge line, M1010 load cell, G3811 obstacle detection)
As of G-code version 2026/02/26 there are two issues present in stock G-code, as documented by community members:
- Redundant homing: An unconditional
G28after the bed leveling block re-homes every print even when ABL already homed (source) - Noise reduction ordering:
M982.2 S1(cog noise reduction) is called beforeM975 S1(input shaping), but depends on it. Therefore it has no effect during the noisiest startup phases (source)
The G-code itself is authored by Bambu Lab and ships as part of Bambu Studio (AGPL-3.0), in resources/profiles/BBL/machine/. This repository only adds documentation comments and does not modify the original G-code. Bambu Lab is not affiliated with this project.
- OpenBambuAPI — G-code reference
- x1plus — Gcode.md
- Bambu Lab X1 Specific G-Code (forum)
- BBL P1S organized start and end gcode (forum)
- P2S quick start G-code by SylwekK (forum)
- P2S optimized start G-code by scoofz (GitHub)
- P2S quirks and firmware settings (Reddit)
- P2S single filament no-switch startup (GitHub Gist)
- BambuStudio source —
get_stage_string()in DeviceManager.cpp — LCD status message strings - OpenBambuAPI — MQTT reference
- Bambu Lab Wiki — MIDI to A1 mini User Guide — M1006 stepper motor music
- Bambu Lab Wiki — Flow Dynamics Calibration
- Bambu Lab Wiki — Filament Mapping Principles
- Bambu Lab Wiki — P2S Nozzle Purge Position Calibration
- Bambu Lab Wiki — P2S Visual Detection
- ha-bambulab Home Assistant integration — const.py — Stage ID mappings, airduct modes
- NineLizards — Plate Lab: ArUco codes and Bambu Lab plates
- OpenCV — ArUco Marker Detection