Another thing that would be useful to have, which I haven’t seen: a list of all variables used by the machine, such as “bed_temperature_initial_layer_single.” I want to build into my machine start script a wait-until-chamber-temp, as OrcaSlicer doesn’t seem to be able to tell the printer to do that, and the printer doesn’t have a dedicated G or M code for that operation.
Many slicer parameters’ placeholders can be seen by looking at the tooltip:
In this case, the placeholder is
temperature_vitrification
. There are many!
Alas, the current chamber temp isn’t a slicer parameter, so you wont find it. Bambu really need to implement G-Codes for it.
Is there a Github repository with the current recommended start/end gcode for various Bambu printers?
Just curious as one starts to modify gcode for their own purposes, would be nice to merge in future changes/recommendations to other parts.
Nope. Not from what I know, but don’t let this stop you in creating one.
Yes there is, in the Bambu Studio repo. From the base directory of it, try
git grep -l machine_start_gcode
It’s there as a single line in a json file though. Here’s a hack to show one:
$ grep machine_end "resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json" | sed -r 's/.*: "//; s/"[^"]*$//; s/\\n/\n/g'
;===== date: 20240528 =====================
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-0.8 F1800 ; retract
G1 Z{max_layer_z + 0.5} F900 ; lower z a little
G1 X65 Y245 F12000 ; move to safe pos
G1 Y265 F3000
G1 X65 Y245 F12000
G1 Y265 F3000
M140 S0 ; turn off bed
M106 S0 ; turn off fan
M106 P2 S0 ; turn off remote part cooling fan
M106 P3 S0 ; turn off chamber cooling fan
(...)
Hi! Do you have some info on this? I think it’s an essential thing to have in the wiki, to let users know the machine and make it do what they want it to do…
Well, there’s a few more ways they use M221:
- M221 S (no numbers) is commented as “push soft endstop status” in the P1S start gcode
- M221 R is commented as “pop softend status” in the same start gcode
I’m not sure what exactly they do, but as It never explicitly enables them with M221 X1 Y1 Z1, I assume they somehow turn them on that way, even though I don’t really see how given my understanding of stacks:
The M221 commands in that gcode in sequence:
- M221 S100 ;reset flowrate
- M221 X0 Y0 Z0 ;turn off endstops
- M221 S ;push soft endstop status (?)
- M221 Z0 ;turn off Z endstop (again?)
- M221 R ;pop softend status (?) (restores endstops?)
shouldn’t push write x0y0z0 to the stack and pop then restore x0y0z0? Or does R just stand for “R-eset the endstop status”? But what does S by itself do then?
Hi all, I’m using some custom gcode to perform manual filament changes on my A1 (without AMS). However, with more than 2 colors it’s hard to know what the next color should be!
Is there a way to adjust the Filament Change gcode to:
- know which color we’re switching to (or even which filament number, as shown in the slicer UI).
- show a custom message on the LCD screen indicating which color/number to load.
Thanks for any help
M400 has another use in this format:
M400 P300
It’s within the “layer change” GCode when there’s a timelapse with wipe tower.
; layer num/total_layer_count: {layer_num+1}/[total_layer_count]
M622.1 S1 ; for prev firware, default turned on
M1002 judge_flag timelapse_record_flag
M622 J1
{if timelapse_type == 0} ; timelapse without wipe tower
M971 S11 C10 O0
{elsif timelapse_type == 1} ; timelapse with wipe tower
G92 E0
G1 E-[retraction_length] F1800
G17
G2 Z{layer_z + 0.4} I0.86 J0.86 P1 F20000 ; spiral lift a little
G1 X65 Y245 F20000 ; move to safe pos
G17
G2 Z{layer_z} I0.86 J0.86 P1 F20000
G1 Y265 F3000
M400 P300
M971 S11 C10 O0
G92 E0
G1 E[retraction_length] F300
G1 X100 F5000
G1 Y255 F20000
{endif}
M623
; update layer progress
M73 L{layer_num+1}
M991 S0 P{layer_num} ;notify layer change
need help. i add M220 S166 and M1002 set_gcode_claim_speed_level : 7
into gcode. but though screamshows Ludicrous Speed ,it shows speed is100% and it print an100%speed .seems M220 S166 just cant work
Where did you add the M220 S166
? My first guess would be that the standard G-code overwrites your figures. Try putting it as the very end of “Machine Start G-code”, if you didn’t already.
i tryed start and layerchange,both not work with my p1
Hi there,
I’ve been asking in a few places on a few threads if it might be possible to write a script that turns off the toolhead Bambu LED off after either cancelling a print or after those prints that do not do this as part of their printing process to no avail so far.
I believe the command I need to send to the printer is;
M960 S5 P0 Bambu Lab toolhead logo light off
But how do I send this to the printer?
I either use Bambu Studio on PC/Mac or Bambu Handy for iOS to control my printer and did notice somewhere the ability to send commands to the printer but I have just looked for it and can’t see it. Not even sure if that might have done the trick or not without incorporating it as part of the original GCode before anything is sent to the printer?
There is also the SD Card in the printer so maybe I could just write a script and save to to the card and then navigate to that folder, select the icon for the script and elect to print? Would that do the job?
Would there have to be any other text in the script to set it up or close it down cleanly?
And what if I wanted to shut the LED off remotely via computer or phone? Is that even possible? Is any of this possible?
Thanks & kind regards,
-=Glyn=-
Slice a small cube or similar. Open gcode file in a text editor. Add your line of code in a suitable location. Save the file. Send the edited file to the printer. Check if the change has taken place.
For direct control from computer or phone, you can (unless you upgrade) use MQTT.
I am also curius about that since I experienced similar issues.
Regarding number 4: Please check if the next command (here: fan speed) is executed when a specific temp of the nozzle is reached.
Here’s why: I have noticed that my nozzle also heats up, and the next command is executed when the nozzle cools down to 60°C.
So please check if your “120 seconds wait time” are just coincidence. The real trigger could be nozzle=60°C.
This doesnt solve the problem entirely but maybe will lead to a better understanding of the root cause and therefore fix.
Does anyone know where the ‘check build plate’ code is?
I want it to check this first before it does anything else.
You would never guess what Bambu calls the plate check.
Near the end of the Machine start G-code there is a section labelled “check scanner clarity”. It can safely be moved up to run just after “reset machine status”.
`;===== new location- check scanner clarity (correct plate?)=========
G1 X128 Y128 F24000
G28 Z P0
M972 S5 P0
G1 X230 Y15 F24000
;===== check scanner clarity end =======================`
Nice! Yep, wouldn’t have guessed this one.
I will give it a try.
I’m not sure if it’s just my X1C, but it routinely has issues of not being able to read the plate type markers reliably. I experimented in the “check scanner clarity” section and cleaned it up so it’s more reliable.
Here is what I worked out:
;===== check scanner clarity ===========================
G28
M972 S5 P0
G1 X230 Y15 F24000
;===== check scanner clarity end =======================
I too moved it up higher in the Machine start G-code so it verifies the build plate before it starts heating the bed.
P.S.
If you want to edit the nozzle json files directly here is cleaned up code:
\n;===== check scanner clarity ===========================\nG28\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n
P.S.
On a windows system, you can find the nozzle .json files at:
%userprofile%\AppData\Roaming\BambuStudio\system\BBL\machine
(Just copy/paste the above into file explorer. A lot easier than diving down the directories)