Hello everyone~
I have been trying to understand how the printer works with its BBL specific gocde and I did some cleaning / optimization on the stock profile start and end gcodes:
I am still trying to get a list of the commands from BBL, but until then, I think this should help.
Enjoy!
; ========== machine: P1S ==========
; ========== date: 20231130 ==========
; ========== start gcode modified by mmoraes80 ==========
; ========== BBL P1S Auto Control for Machine Control Board Fan ==========
M710 A1 S255; MCB fan will turn on automatically if hot end temp >=50C
; ========== reset machine status ==========
M290 X40 Y40 Z2.666666 6
G91; use relative coordinates
M17 Z0.4; lower the z-motor current
G380 S2 Z30 F300
G380 S2 Z-25 F300
G1 Z5 F300
G90; use absolute coordinates
M17 X1.2 Y1.2 Z0.75; reset motor current to default
M220 S100; Reset Feedrate
M221 S100; Reset Flowrate
M73.2 R1.0; Reset left time magnitude
M1002 set_gcode_claim_speed_level : 5
M221 X0 Y0 Z0; turn off soft endstop to prevent potential logic problem
G29.1 Z{+0.0}; clear z-trim value first
M204 S10000; ste starting acceleration to 10m/s^2
; ========== filament runout detection ==========
M412 S1; Enable (and reset) filament runout detection
; ========== preheat tool head ==========
; Display meesage âHeating hotendâ on Bambu Handy App & Slicer plugin
M1002 gcode_claim_action : 7
M104 S75; set extruder temp to 75C to turn MC board fan on
; ========== preheat build plate ==========
; Display meesage âHeatbed preheatingâ on Bambu Handy App & Slicer plugin
M1002 gcode_claim_action : 2
M140 S[bed_temperature_initial_layer_single]; set bed temp
M190 S[bed_temperature_initial_layer_single]; wait for bed temp
; ========== prepare printer ==========
M104 S[nozzle_temperature_initial_layer]; set extruder to printing temp
G91; use relative coordinates
G0 Z10 F1200
G90; use absolute coordinates
G28 X
M975 S1; turn on vibration suppression
G1 X60 F12000
G1 Y245
G1 Y265 F3000
; ========== switch material if AMS exists ==========
M620 M
M620 S[initial_extruder]A
M109 S[nozzle_temperature_initial_layer]
G1 X120 F12000
G1 X20 Y50 F12000
G1 Y-3
T[initial_extruder]
G1 X54 F12000
G1 Y265
M400
M621 S[initial_extruder]A
M620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}
; ========== purge nozzle and remove poop ==========
; Display meesage âHeating hotendâ on Bambu Handy App & Slicer plugin
M1002 gcode_claim_action : 7
M109 S[nozzle_temperature_initial_layer]
M400
M104 S[nozzle_temperature_initial_layer]
M106 P1 S0
G92 E0
G1 E20 F200; purge 20mm of filament (useful for different previous color)
M400
G92 E0
G1 E10 F200; purge 10mm of filament
M400
M106 P1 S255; ; turn part cooling fan on to cool extruded filament
G92 E0
G1 E5 F300
M109 S{nozzle_temperature_initial_layer[initial_extruder]-20}; drop nozzle temp by 20C
G92 E0
G1 E-1.0 F300; retract 1mm of filament to reduce oozing
G1 X70 F9000
G1 X76 F15000
G1 X65 F15000
G1 X76 F15000
G1 X65 F15000
G1 X80 F6000
G1 X95 F15000
G1 X80 F15000
G1 X165 F15000
M400
M106 P1 S0; turn part cooling fan off
; ========== wipe nozzle tip ==========
; Display meesage âCleaning nozzle tipâ on Bambu Handy App & Slicer plugin
M1002 gcode_claim_action : 14
M975 S1; turn on vibration suppression
M106 P1 S255
G1 X65 Y230 F18000
G1 Y264 F6000
M109 S{nozzle_temperature_initial_layer[initial_extruder]-20}
G1 X100 F18000
G0 X135 Y253 F20000
G28 Z P0 T300; home z with low precision, allow 300C nozzle temperature
G29.2 S0; turn off ABL
G0 Z5 F20000
G1 X60 Y265
G92 E0
G1 E-0.5 F300
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X90 F5000
G0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle
M104 S140; set build plate temp down to 140C for probing
M106 P1 S255; turn on fan (G28 turned fan off)
M221 S; push soft endstop status
M221 Z0; turn off Z axis endstop
G0 Z0.5 F20000
G0 X125 Y259.5 Z-1.01
G0 X131 F211
G0 X124
G0 Z0.5 F20000
G0 X125 Y262.5
G0 Z-1.01
G0 X131 F211
G0 X124
G0 Z0.5 F20000
G0 X125 Y260.0
G0 Z-1.01
G0 X131 F211
G0 X124
G0 Z0.5 F20000
G0 X125 Y262.0
G0 Z-1.01
G0 X131 F211
G0 X124
G0 Z0.5 F20000
G0 X125 Y260.5
G0 Z-1.01
G0 X131 F211
G0 X124
G0 Z0.5 F20000
G0 X125 Y261.5
G0 Z-1.01
G0 X131 F211
G0 X124
G0 Z0.5 F20000
G0 X125 Y261.0
G0 Z-1.01
G0 X131 F211
G0 X124
G0 X128
G2 I0.5 J0 F300
G2 I0.5 J0 F300
G2 I0.5 J0 F300
G2 I0.5 J0 F300
M109 S140
G2 I0.5 J0 F3000
G2 I0.5 J0 F3000
G2 I0.5 J0 F3000
G2 I0.5 J0 F3000
M221 R; pop softend status
G1 Z10 F1200
M400
G1 Z10
G1 F30000
G1 X230 Y15
G29.2 S1; turn on ABL
M106 P1 S0; turn off fan
; ========== bed leveling ==========
M1002 judge_flag g29_before_print_flag
M622 J1
; Display meesage âAuto bed levelingâ on Bambu Handy App & Slicer plugin
M1002 gcode_claim_action : 1
G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}
M400
M500; save calibration data
M623
; Clear meesage on Bambu Handy App & Slicer plugin
M1002 gcode_claim_action : 0
; ========== home tool head after wiping nozzle ==========
M1002 judge_flag g29_before_print_flag
M622 J0
; Display meesage âHoming toolheadâ on Bambu Handy App & Slicer plugin
M1002 gcode_claim_action : 13
G28
M623
M975 S1; turn on vibration suppression
; ========== turn on fans to prevent loaded PLA heat creep ==========
{if filament_type[initial_extruder]==âPLAâ}
{if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}
M106 P2 S100; turn on AUX fan ,to cool down toolhead
M106 P3 S180
{elsif (bed_temperature[initial_extruder] >60)||(bed_temperature_initial_layer[initial_extruder] >60)}
M106 P2 S100; turn on AUX fan ,to cool down toolhead
M106 P3 S255
{endif}
{endif}
M104 S{nozzle_temperature_initial_layer[initial_extruder]}; set extrude temp earlier, to reduce wait time
; ========== mech mode fast check ==========
G1 X128 Y128 Z10 F20000
M400 P200
M970.3 Q1 A7 B30 C80 H15 K0
M974 Q1 S2 P0
G1 X128 Y128 Z10 F20000
M400 P200
M970.3 Q0 A7 B30 C90 Q0 H15 K0
M974 Q0 S2 P0
M975 S1
G1 F30000
G1 X230 Y15
; Display meesage âHoming toolheadâ on Bambu Handy App & Slicer plugin
M1002 gcode_claim_action : 13
G28 X
; ========== prime noozle before print ==========
M975 S1; turn on vibration suppression
G90
M83
T1000
G1 X18.0 Y1.0 Z0.8 F18000;Move to start position
M109 S{nozzle_temperature_initial_layer[initial_extruder]}
G1 Z0.2
G0 E2 F300
G0 X240 E15 F{outer_wall_volumetric_speed/(0.30.5) * 60}
G0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.30.5)/ 4 * 60}
G0 X239.5
G0 E0.2
G0 Y1.5 E0.700
G0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}
M400
; ========== Textured PEI Plate ==========
;curr_bed_type={curr_bed_type}
{if curr_bed_type==âTextured PEI Plateâ}
G29.1 Z{-0.04}; lower the nozzle as it was touching topmost of the texture when homing
{endif}
; ========== turn off fans ==========
; Clear meesage on Bambu Handy App & Slicer plugin
M1002 gcode_claim_action : 0
M106 P1 S0; turn off fan
M106 P2 S0; turn off AUX fan
M106 P3 S0; turn off Chamber fan
M975 S1; turn on vibration suppression
; ========== end of start gcode ==========
; ========== date: 20231129 ==========
; ========== end gcode modified by mmoraes80 ==========
; ========== move toolhead up and back ==========
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-0.8 F1800 ; retract
{if max_layer_z < max_print_height}G1 Z{z_offset+min(max_layer_z+1, max_print_height)} F900 ; Move print head up{endif}
G1 X65 Y245 F12000; park toolhead
G1 Y265 F3000
M140 S0 ; turn off build plate heater
M106 P1 S0 ; turn off part cooling fan
M106 P2 S0 ; turn off AUX cooling fan
M106 P3 S0 ; turn off chamber cooling fan
G1 X100 F12000 ; remove oozed filament
;========== if AMS exists ==========
M620 S255; pull back filament to AMS
G1 X20 Y50 F12000
G1 Y-3
T255
;========== wipe nozzle ==========
G1 X65 F12000
G1 Y265
G1 X100 F12000 ; wipe nozzle
M621 S255
M104 S0 ; turn off hotend
;========== finish timelapse ==========
M622.1 S1 ; for previous firmware, default is ON
M1002 judge_flag timelapse_record_flag
M622 J1
M400; wait all motion done
M991 S0 P-1 ;end smooth timelapse at safe pos
M400 S3 ;wait for last picture to be taken
M623; end of âtimelapse_record_flagâ
;========== lower build plate ==========
M400; wait all motion done
M17 S
M17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom
{if (max_layer_z + 100.0) < 250}
G1 Z{max_layer_z + 100.0} F600
G1 Z{max_layer_z + 98.0}
{else}
G1 Z250 F600
G1 Z248
{endif}
M400 P100
M17 R ; restore z current
;========== move toolhead to middle back position ==========
G90; use absolute coordinates
G1 X128 Y250 F3600
;========== reset printer parameters ==========
M220 S100; Reset feedrate magnitude
M201.2 K1.0; Reset acc magnitude
M73.2 R1.0; Reset left time magnitude
M1002 set_gcode_claim_speed_level : 0
M17 X0.8 Y0.8 Z0.5 ; lower XY motor current to 45% power
;========== end of end gcode ==========