Bambu Lab X1 Specific G-Code

Thanks John! You win the internets today!

have g code for estep x y z ?

(I miss-posted while referencing this thread)

@mowcius Thanks for compiling this list!


Hello has anyone figured out what M620 and M621 do ? Is this filament change start and end?

Is one of those a typo or is there some subtle difference between them?

I always comment out or delete this M620 in Machine End:

; pull back filament to AMS
M620 S255

The result is the filament is never unloaded at end of print. I could probably delete a few more lines (the toolhead still moves to the cutting position but never actually does the cut) but just dropping that M620 does the trick. Faster start next time, less wear and tear. In case I start a new print with a different filament, the printer handles it correctly. There are no downside to this that I can imagine, I can’t see why it defaults to unloading.

The only downside i can think of is if you want to replace that spool with another. Only downside is time, since you’ll have to hit unload and wait a few minutes to heat up and retract. A great idea for those that typically keep printing from the same filament.

What should I remove if I do not want te printer to purge every time it starts?

Not so sure it’s a good idea, but if you look in the “Machine start gcode” there’s a section starting (after a blank line) with “M109 S250 ;set nozzle to common flush temp”. A couple lines below there is a line “G1 E50 F200”. That is 50 mm of filament. And a few lines below it there’s another identical line, another 50 mm. Together those 100 mm is, I believe, 241 mm³ or a whopping 1.92 meters out the nozzle. You could experiment with decreasing those figures but I reckon Bambu didn’t pick them at random.

Are you sure about this? Marlin says M400 will wait for any moves already queued. So you’d issue a move, then M400 to wait until that move finished.

I’ve set mine all the way down to 40 total but there starts to be an issue where the filament doesn’t weight enough and flicks the flushed filament into the chamber much more often. I do 80 total. I’ve seen on youtube someone who had theirs at 15 and thats what they kept it at. I’d never go that low though.

Frustratingly with this being a wiki now, you can’t easily tag the person who actually added bits without hunting through edit history.

@mikeoxlong420, your addition is being queried

how would i modify the g-code to break up high volume flushes into smaller increments?

ie flush volume 800
flush 200 - wipe back and forth (filament goes down chute)
flush 200 - wipe back and forth (filament goes down chute)
flush 200 - wipe back and forth (filament goes down chute)
flush 200 - wipe back and forth (filament goes down chute)
(total 800)

resume print

im trying to use pla as support interface on petg prints and it clogs the chute with the high volume flush. it dropped it down the chute a few times it wouldn’t clog the chute

check the start g-code and look for the block under prepare print temperature and material
there are two lines of G1 E50 F200 there that do the purging. and you can find the movement G1 commands below

Hi guys. Does anybody knows if Bambu printers support M117 (display messages)? I’m away from home, and can’t test it right now.

I don’t have AMS bud sometimes do some multicolor printing manually changing the filament. I would like to edit the g-code when it pauses for a filament change, display a message with the filament color I need to add. With many filament color changes, I’ve already loaded the wrong one.

They do not. There’s no way to send arbitrary messages to the display.

You could send display messages that you code into specific colours as a bit of a workaround.

1 Like

Hi guys
Is there any pre-requisite for M400 U1 ? e.g. LAN mode? I can’t for the life of me get my P1S to pause and wait for user-input. The g-code looks OK but the printer will sail past the layer where it should pause.
Can I debug it somehow? I get the feeling there is some condition for it to pause and wait, which is not satisfied but I have no visibility other than checking the G-code before printing.

LAN mode or not doesn’t matter. Where exactly did you put it? Try just “Add Pause” at a layer instead, that ought to work. It will insert “M400 U1” at that layer, nothing more, nothing less.

Using Orcaslicer under advanced Printer/Nozzle settings
“Machine G-code” → “Change filament G-code” and “Pause G-code”
After exporting to Gcode I can see M400 U1 there.
I can try a simple pause (right-click at the layer → “add pause”?) instead.

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