Bambu Lab X1 Specific G-Code

Right-click, Add Pause at layer sometimes caused a layer shift on my X1C.

Right-click, Add custom G-code, with the following code works reliably:

M400 U1 ;pause
G28 X ;home

There have been several firmware changes since I started using the G-code, so it may not be needed any longer, but I haven’t risked a test.

1 Like

I work on a code for a “filament drying” feature for the P1S. This code works well

G28 X ; re-home XY
M106 P3 S180 ; set chamber fan to 70%
M190 S90 ; wait for bed temp
;M400 U1
M106 P3 S104 ; set chamber fan to 40%
G4 P360000 ; wait 360.000 ms - 5 minutes
M106 P3 S0 ; set chamber fan to 0
M107 P3 ; set chamber fan off
M140 S0 ; set bed temp off

I wanted to use M400 U1, to notify the user to insert a spool, after bed and head are relyably homed and bed is heated. When I activate this, some strange things happen:

  1. The code execution seems to stop (pause message on LCD). OK
  2. From the moment the pause message appeares, the hotend starts to heat up to 90°C, which is not part of my gcode. Why?
  3. On user input the hot end stops heating up, regardless whether 90°C are reached, or not.
  4. Though user input restarted the print process, the next command (here: set fan speed) is executed about 120 seconds after user input.

Can anybody explain this behavior?

The “P” parameter is for milliseconds. It’s better to use the “S” parameter for seconds as it keeps the parameter number smaller.

Better yet you might instead try using
M400 S300 ; (pause for 5 minutes)

Regarding playing a sound it will be interesting to see if the P series printers ever gets the Sound/Midi function that the A series has.

4 Likes

The extension board for the P1P does support a buzzer.
https://wiki.bambulab.com/en/p1/manual/extension-board-gcode-reference

Interesting and good to know but it seem the extension board is vaporware?

4 Likes

Hi mowcius,
This is the Bambu Lab Wiki Team.
May we have your permission to share your post on our Wiki? We believe it would provide valuable information to our readers, and we will attach the link to this post in our Wiki with your attribution.
Once we receive your approval, we will provide you with the link we added.

Thank you for considering our request.

Best regards,
Bambu Lab Wiki Team

Now im confused,nothing happened back then?

The post was converted to a community wiki at that time ( Regular members can edit it) It sounds like Bambu is asking to use it in the formal Bambu Wiki.

3 Likes

Hey @BambuLabWikiTeam, while I’m flattered that you’d want to put this post on your official wiki, I was rather hoping that at some point someone from the Bambu Lab team would create a wiki page to make this obsolete.

The codes that myself and others have come up with have been from investigation and trial and error, and I have a whole spreadsheet full of guesses around what certain G-code does on these printers.

By all means copy and paste the bits from the top of this forum thread that are true and make sense, but please don’t just leave it at that.

We need an official resource that lists the codes Bambu uses, how they function, and how the might differ from the codes as people would expect from looking at the Marlin pages.

As an example, here’s Prusa’s page: Prusa firmware-specific G-code commands | Prusa Knowledge Base

5 Likes

Hi mowcius,
Thank you for permitting us.
Please check it here:Wiki Page Link
Also, we appreciate your feedback and information, we will forward your request to our appropriate personnel for future Wiki content update consideration.

Best regards,
Bambu Lab Wiki Team

But there is a “HELP”. at the top of the status bar

Hold on a second, aren’t the community doing this whole thread because we don’t have access to check the code to see which specific G-codes are enabled? Why don’t you just talk to the printer team and list literally every single G-code that is enabled and specific to the printer, and save us a whole bunch of time?

3 Likes

I and others reported this user as spam.

Hi asdfgasdfg1, thanks for this feedback. We will forward your request to our appropriate personnel for future Wiki content update consideration.

1 Like

Hey, whats actually turning on the light inside the printer?
Its not like in “stock” marlin Firmwares / M355 Case Light Control | Marlin Firmware
At least, i found a way to turn off the toolhead on the X1:

M960 S5 P0 ; turn off logo lamp

Thats an interesting comment in the “machine start G-Code”:

;========turn off light and wait extrude temperature =============
M1002 gcode_claim_action : 0
M973 S4 ; turn off scanner
M400 ; wait all motion done before implement the emprical L parameters
;M900 L500.0 ; Empirical parameters
M109 S[nozzle_temperature_initial_layer]
M960 S1 P0 ; turn off laser
M960 S2 P0 ; turn off laser
M106 S0 ; turn off fan
M106 P2 S0 ; turn off big fan
M106 P3 S0 ; turn off chamber fan
M975 S1 ; turn on mech mode supression
G90
M83
T1000
G1 E{-retraction_length[initial_no_support_extruder]} F1800
G1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position
G1 E{retraction_length[initial_no_support_extruder]} F1800
M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}
G0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}
G0 Y128 E6.4
G0 X252.5
G0 Y252.5 E6.4
G0 X128 E6.4
1 Like

XY Skew Compensation in Bambu Firmware

Y
 ^     B-------C
 |    /       /
 |   /       /
 |  A-------D
 +-------------->X
 XY SKEW FACTOR

M1005 X<AC> Y<BD>

(1) e.g. you print a 100mm square and measure AC as 141.53 and BD as 141.31

(2) using these values add this gcode to the end of the Machine start G-code:

M1005 X141.53 Y141.31
M500

(M500 will save the compensation factor to EEPROM)

(3) Print the square again and measure the diagonals.
(4) If ok delete the gcode from the Machine start G-code.
(5) Print another square to check the compensation factor has been saved.

After step (3) if there is still significant skew you can repeat steps (1)-(3) with the new measurements. A new factor will be applied to the compensation already saved in the firmware.
When satisfied with the result proceed to steps (4)&(5). (Remember to delete the gcode you added to the start G-code or it will continue to apply a new correction factor with each print!).

If you need to reset the compensation value:

M1005 I0
M500

See this post on Reddit for the source of this information which was originally provided by Bambu Lab tech support. The post includes instructions from Bambu Lab and a calibration stl file for printing the square:

Bambu’s M1005 applies a different format for skew correction than Marlin’s M852 but it may also incorporate XZ and YZ correction which could be determined by experimentation.

See also this post on this forum.

11 Likes

M1005 [In]

M1005 can also be used with the [In] parameter to apply a skew correction factor (in radians) for the XY axes.

See my recent post in this forum for details.

3 Likes

Some further information on the M1005 gcode:

M500 does not retain the skew compensation setting when the printer is powered off.

See this thread for a discussion of this problem and a solution using the M1005 [In] format of the command.

4 Likes

Does anyone know if these commands work on the A series?

I need to adjust z offset 29.1 but if put in like 29.1 Z9.9, it clearly is not going up 9mm.

any idea’s? gcode confirms the line is there

Just to make sure you put in
G29.1 Z9.9
But nothing happens, right?