Bambu Lab P2S print starts after 1.5 minutes!

Some details regarding the calibration were bothering me, as it seemed to pass through them a bit too quickly. I looked into it again and introduced some changes that I believe turned out to be very useful. In the process, I tidied up the program a bit, and overall, I am very satisfied with the result. Currently, for the first print with a new filament, I run the flow calibration option (which takes about 2-3 minutes in total), and subsequent copies are printed without calibration, allowing them to start in about 1.5 minutes.

;======== P2S quick start printing GCODE (V7.1) ==========
;
; Author of the modification: SylwekK
;
; G-code start sequence tested with a non-AMS printer
; Quick start: Printing begins around 1,5 minutes after selecting the model
; Features: Optional flow calibration and bed leveling active
; Verified and tested but use at your own responsibility
;

M140 S[bed_temperature_initial_layer_single] ; heat heatbed first
M993 A0 B0 C0 ; nozzle cam detection not allowed.
M17
M620 M ; enable remap/monitoring
G389

;===== initial safety Z-axis drop =====
G91 ; relative mode
G1 Z10 F1200 ; drop bed by 10mm for safety before XY homing
G90 ; back to absolute mode

;===== reset machine status =================
M204 S10000
M630 S0 P1
G90
M17 D ; reset motor current to default
M220 S100 ; Reset Feedrate
M1002 set_gcode_claim_speed_level: 5
G29.1 Z{+0.0} ; clear z-trim value first
M983.1 M1
M982.2 S1 ; turn on cog noise reduction
M983.4 S0
;===== reset machine status =================

;==== heating to 140C and XY homing ====
M1002 gcode_claim_action : 2
M104 S140 A
G28 X T300 ; homing XY while heating up to 140C
G29.2 S0 ; avoid invalid abl data

;===== filament sensor arming (now it won’t block heating) =====
M620 S[initial_no_support_extruder]A ; switch material
T[initial_no_support_extruder]
M621 S[initial_no_support_extruder]A ; arm runout sensor
G389 ; collision detection

;===== nozzle cleaning at 140C =====
M1002 gcode_claim_action : 13
G150.3 ; position above the cutter
M109 S140 A ; wait for 140C target to soften residue
G150.1 F8000 ; wipe standard
G150.1 F8000 ; repeat
M400

;===== Z homing =====
G1 X128 Y128 F30000
G28 Z P0 T400
;G150.3 ; Return to purge bucket immediately
M400

;===== optional auto bed leveling (ABL) (NOW AFTER FLOW) =====
M1002 judge_flag g29_before_print_flag
M622 J1
M1002 gcode_claim_action : 1
; G150.3
M190 S[bed_temperature_initial_layer_single]
M109 S140 A ; Cool down to 140 for safe ABL
G29 A1 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 cali data
; G150.3 ; Return to purge bucket after ABL
G1 Z10 F1200
M623

;===== mech mode resonance sweep =====
M1002 gcode_claim_action : 3
G90
G1 X128 Y128 F20000
G1 Z5 F1200
M400 P200
M970.3 Q1 A5 K0 O1
M970.2 Q1 K1 W74 Z0.01
M974 Q1 S2 P0
M970.3 Q0 A7 K0 O1
M970.2 Q0 K1 W74 Z0.01
M974 Q0 S2 P0
M400

;===== optional Flow calibration =====
M975 S1
M1002 judge_flag extrude_cali_flag
M622 J1
M400
M211 X0 Y0 Z0 ;turn off soft endstop
M975 S1 ; turn on input shaping

G29.2 S0 ; avoid invalid abl data
G150.3
{if ((filament_type[initial_no_support_extruder] == “PLA”) || (filament_type[initial_no_support_extruder] == “PLA-CF”) || (filament_type[initial_no_support_extruder] == “PETG”)) && (nozzle_diameter[initial_no_support_extruder] == 0.2)}
M620.10 A0 F74.8347 H{nozzle_diameter[initial_no_support_extruder]} T{flush_temperatures[initial_no_support_extruder]} P{nozzle_temperature_initial_layer[initial_no_support_extruder]} S1
M620.10 A1 F74.8347 H{nozzle_diameter[initial_no_support_extruder]} T{flush_temperatures[initial_no_support_extruder]} P{nozzle_temperature_initial_layer[initial_no_support_extruder]} S1
{else}
M620.10 A0 F{flush_volumetric_speeds[initial_no_support_extruder]/2.405360} H{nozzle_diameter[initial_no_support_extruder]} T{flush_temperatures[initial_no_support_extruder]} P{nozzle_temperature_initial_layer[initial_no_support_extruder]} S1
M620.10 A1 F{flush_volumetric_speeds[initial_no_support_extruder]/2.4053
60} H{nozzle_diameter[initial_no_support_extruder]} T{flush_temperatures[initial_no_support_extruder]} P{nozzle_temperature_initial_layer[initial_no_support_extruder]} S1
{endif}

M620.11 P0 L0 I[initial_no_support_extruder] E0
M620.11 K0 I[initial_no_support_extruder] R0

M620 S[initial_no_support_extruder]A ; switch material
M1002 gcode_claim_action : 8 ; Cali action
M1002 set_filament_type:UNKNOWN
M400
T[initial_no_support_extruder]
M400
M628 S0
M629 ; Cutter
M400
M1002 set_filament_type:{filament_type[initial_no_support_extruder]}
M621 S[initial_no_support_extruder]A
M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}
M400
M106 P1 S0
M400
G29.2 S1

M1002 set_filament_type:{filament_type[initial_no_support_extruder]}
M1002 gcode_claim_action : 8
G150.3
M109 S{nozzle_temperature[initial_no_support_extruder]}
G90
M83
M400 ; sync buffer
M983.3 F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4} A0.4 ; cali dynamic extrusion
M400
M106 P1 S255
M400 S5
M106 P1 S0
G150.3

M623

;===== final heating before printing ==========
G150.3 ; return above the cutter
M1002 gcode_claim_action : 14
M190 S[bed_temperature_initial_layer_single]
M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}
M400

;===== DOUBLE CUT AND WIPE BEFORE PURGE LINE =====
M629 ; First cut
M400 P200
M629 ; Second cut
M400 P200
G150.1 F8000 ; Wipe residue after cuts
M211 S1 ; restore soft endstops
G29.2 S1 ; activate ABL compensation
M400

;===== Z-OFFSET correction (User Verified) =====
{if curr_bed_type==“Textured PEI Plate”}
G29.1 Z{0.01}
{else}
G29.1 Z{0.03}
{endif}

;===== final vibration check and purge line start =====
M975 S1
M1002 gcode_claim_action : 51
G90
M83
G0 X100 Y0 F24000
G130 O0 X100 Y-0.2 Z0.6 F{filament_max_volumetric_speed[initial_no_support_extruder]/2/2.4053} L40 E12 D4
G1 Z0.5
M400

;===== ACTIVATE ALL SENSORS (FIX FOR DRY PRINTING) =====
M1015.3 S1 H[nozzle_diameter]
M1015.4 S1 K1 H[nozzle_diameter]
M620.6 I[initial_no_support_extruder] W1

M1002 gcode_claim_action : 0
G29.99

;— Load Cell Sensitivity & Monitoring —
M1010 Q0 B0.023 S0.01
M1010 Q1 B0.005 S0.01
M1010.1 S1

;======== END GCODE ==========