Right now there’s no documentation from Bambu around what standard and non-standard G-code commands can be used on the X1 series of printers.
As for the standard commands, this Marlin cross reference is great but please note that Bambu doesn’t implement all of it, and some things that are implemented behave a bit different than stated there.
This will be a constantly evolving thread to document these until Bambu publishes some official documentation. Some things are certain, some things may be guesses/assumptions, so use the commands below at your own risk.
If you know any codes, or have any assumptions, please discuss these below and I’ll add them to this first message.
Hardware Control
Code | Description |
---|---|
M960 S0 P0 | Calibration lasers, and calibration head white LEDs off |
M960 S0 P1 | Calibration lasers, and calibration head white LEDs on |
M960 S1 P0 | Calibration Y axis 808nm (IR, visible only thru a/the camera) laser (vertical) off |
M960 S1 P1 | Calibration Y axis 808nm (IR, visible only thru a/the camera) laser (vertical) on |
M960 S2 P0 | Calibration X axis 405nm (purple) laser (horizontal) off |
M960 S2 P1 | Calibration X axis 405nm (purple) laser (horizontal) on |
M960 S3 P0/1 | Appears to be nothing at all, or I haven’t found what it is |
M960 S4 P0 | Calibration unit white LEDs off |
M960 S4 P1 | Calibration unit white LEDs on |
M960 S5 P0 | Bambu Lab toolhead logo light off |
M960 S5 P1 | Bambu Lab toolhead logo light on |
M17 X/Y/Z#.# | Set X/Y/Z Stepper Motor Current** |
M106 P1 S0-255 | Part cooling fan off-full*** |
M106 P2 S0-255 | Aux fan off-full*** |
M106 P3 S0-255 | Chamber fan off-full*** |
M710 A1 S0-255 | Motor Control (MC) Board fan off-full*** |
M220 S# | Set feed rate to percent of normal (default 100). “M220 S166” is the same as Ludicrous Speed. |
M221 | Can be used 2 ways**** |
M971 | Commands the built-in camera |
M977 S1 P60 | Described as “Register 1st layer scan”? No idea what this actually DOES, I’m thinking it sets a flag letting the printer know to perform a 1st layer scan once we’ve printed the 1st layer. That’s the only thing that makes any sense as this command is called in the gcode file WELL before any actual print commands have been sent (aside from the calibration stuff/purge lines) |
**Be EXTREMELY careful using this command as it is VERY EASY to cause hardware damage with it should you set it too high!!!
**Example: M17 Z0.4 sets Z stepper current to 0.4
***Example: M106 P3 S180 sets the chamber fan on at 70%
**** If using S# (ie. M221 S75) sets the flowrate to # (Default 100)
**** If using X0/1 Y0/1 or Z0/1 disables or enables the software endstop for that axis (ie. M221 X0 Y1 Z1 would disable the X software endstop and enable them on Y and Z)
Other
Display Message Codes
These commands cause messages to be displayed on printer’s LCD screen, and trigger the corresponding messages to be displayed within the app/slicer.
Code | LCD Message Displayed |
---|---|
M1002 gcode_claim_action : 0 | (Clear screen of messages?) |
M1002 gcode_claim_action : 1 | Auto bed levelling |
M1002 gcode_claim_action : 2 | Heatbed preheating |
M1002 gcode_claim_action : 3 | Sweeping XY mech mode |
M1002 gcode_claim_action : 4 | Changing filament |
M1002 gcode_claim_action : 5 | M400 pause |
M1002 gcode_claim_action : 6 | Paused due to filament runout |
M1002 gcode_claim_action : 7 | Heating hotend |
M1002 gcode_claim_action : 8 | Calibrating extrusion |
M1002 gcode_claim_action : 9 | Scanning bed surface |
M1002 gcode_claim_action : 10 | Inspecting first layer |
M1002 gcode_claim_action : 11 | Identifying build plate type |
M1002 gcode_claim_action : 12 | Calibrating Micro Lidar |
M1002 gcode_claim_action : 13 | Homing toolhead |
M1002 gcode_claim_action : 14 | Cleaning nozzle tip |
M1002 gcode_claim_action : 15 | Checking extruder temperature |
M1002 gcode_claim_action : 16 | Paused by the user |
M1002 gcode_claim_action : 17 | Pause due to the falling off of the tool head’s front cover |
M1002 gcode_claim_action : 18 | Calibrating the micro lidar |
M1002 gcode_claim_action : 19 | Calibrating extruder flow |
M1002 gcode_claim_action : 20 | Paused due to nozzle temperature malfunction |
M1002 gcode_claim_action : 21 | Paused due to heat bed temperature malfunction |
Software Control
Code | Description |
---|---|
G29.2 S0 | Disable bed leveling compensation (ABL) |
G29.2 S1 | Enable bed leveling compensation |
M205 X#.## Y#.## Z#.## E#.## | Sets the jerk limits to #.## mm/sec |
G29.1 Z#.## | Set Z-trim value to # (0 to clear). Example: “G29.1 Z-0.04” is used for Textured PEI |
M900 K#.## | Set Pressure Advance, also known as K-value. Eg. “M900 K0.023” |
M400 | Pause - Can be used 3 ways* |
Pause Method 1 Example/Description:
Including S# with the M400 command pauses for # seconds
M400 S30
G1 Z100
G1 X100 Y100
Explanation: Pause for 30 seconds, then start moving towards Z100, and move to X100 Y100 (regardless of whether we’ve arrived at Z100 yet or not)
Pause Method 2 Example/Description:
Use M400 by itself to pause until the previous command completes
G1 Z100
M400
G1 X100 Y100
Explanation: Pause until we arrive at Z100, then move to X100 Y100
Pause Method 3 Example/Description:
M400 U1 ; pause for user intervention
Using U1 with M400 behaves just like when printer is paused from touch screen (or app): The toolhead is parked at the waste chute and printer waits indefinitely for manual resume.
Skew Correction
( Reference post )
Print and measure the Square Calibration STL
M1005 X##.#Y##.# ; input values from printed calibration stl
M500 ; save the values
Add the above Gcode to the last line of the “Machine start Gcode” and only run it once otherwise the compensation will compound each time it is run. Remove the Gcode and reprint the Square Calibration STL and verify the measurements. Iterate as required.
The compensation value can be reset by using the below Gcode.
M1005 I0 ; reset the compensation value
M500 ; save the value