I thought the issue with pauses (hold, filament runout, clogged nozzle, etc.) during printing was resolved, but it still persists. When attempting to resume, the head makes one movement over the purge bucket, then returns and starts oozing filament. At that point, turning the printer off and back on helps—when it asks whether to resume printing, simply confirm, and it continues. Unfortunately, I don’t have an idea on how to fix this yet, but I’m thinking about it constantly. For now, if you are printing a large, multi-hour project, it’s better to use the original code. I made mine for less time-consuming parts and quick repetitions—it works perfectly there.
We have it! I think there is a breakthrough regarding resuming after a print is paused and restarted
I tested it in various ways with and without flow calibration. In both cases, the print resumed after about 40 seconds. And most importantly—the start of the print is still after about 1.5 minutes, and if we do flow calibration, the time increases to about 2 minutes and 30 seconds—recommended for the first print after turning on the printer, subsequent prints can be done without calibration. Of course, it would also be good to calibrate the bed at the beginning, but I must admit that for small parts I rarely do it, and they still look very nice
Test it and let me know if anything doesn’t work. Oh, I cut out the section that cleans the nozzle tip—it kind of irritates me (you can add it on your own based on my previous codes), and the resonance test is only done when the bed is being leveled.
;======== P2S quick start printing GCODE (V7.8) ==========
;
; Author of the modification: SylwekK
; Verified and tested but use at your own responsibility
; Not tested with AMS
M140 S[bed_temperature_initial_layer_single] ; Heat heatbed first (Code 2)
M993 A0 B0 C0
M400
M17
M620 M ;enable remap
G389
;===== avoid end stop =================
G91
G380 S2 Z22 F1200
G380 S2 Z-12 F1200
G90
;===== reset machine status =================
M204 S10000
M630 S0 P1
G90
M17 D ; reset motor current to default
M960 S5 P1 ; turn on logo lamp
G90
M220 S100 ; Reset Feedrate
M1002 set_gcode_claim_speed_level: 5
M221 S100 ;Reset Flowrate
M73.2 R1.0 ;Reset left time magnitude
G29.1 Z{+0.0} ; clear z-trim value first
M983.1 M1
M982.2 S1 ; turn on cog noise reduction
M983.4 S0
;==== set airduct mode ====
;==== if Chamber Cooling is necessary ====
{if (overall_chamber_temperature >= 40)}
M145 P1 ; set airduct mode to heating mode for heating
M106 P2 S255 ; turn on filter fan
{else}
{if (min_vitrification_temperature <= 50)}
M145 P0 ; set airduct mode to cooling mode for cooling
M106 P2 S255 ; turn on auxiliary fan for cooling
M106 P3 S127 ; turn on chamber fan for cooling
M1002 gcode_claim_action : 29
M191 S0 ; wait for chamber temp
M106 P2 S102 ; turn on chamber cooling fan
M106 P10 S0 ; turn off left aux fan
M142 P6 R30 S40 U0.3 V0.8 ; set PETG exhaust chamber autocooling
{else}
M145 P1 ; set airduct mode to heating mode for heating
M106 P2 S127 ; turn on 50% filter fan
M142 P6 R30 S40 U0.3 V0.8 ; set PLA/TPU exhaust chamber autocooling
{endif}
{endif}
;==== heating to 140C and XY homing ====
M1002 gcode_claim_action : 2
M1002 set_filament_type:{filament_type[initial_no_support_extruder]}
M104 S140 A
G29.2 S0 ; avoid invalid abl data
G28 X T300 ; homing XY
G150.3
;===== Nozzle cleaning at 140C =====
M1002 gcode_claim_action : 14 ; Status: Cleaning nozzle tip
G150.3
M109 S140 A ; wait for 140C target to soften residue
G150.1 F8000 ; Wipe
G150.1 F8000 ; Wipe repeat
G150.3
M400
;===== Z homing =====
M1002 gcode_claim_action : 13 ; Status: Homing (Z-axis Homing)
M972 S24 P0
M972 S26 P0 C0
M972 S42 P0 T5000
G90
G1 X128 Y128 F20000
G28 Z P0 T400
M400
;===== detection start =====
M1002 gcode_claim_action : 11
M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-80} A ; rise temp in advance
M972 S19 P0 T5000 ;plate type detection
;=====
M211 X0 Y0 Z0 ;turn off soft endstop
M975 S1 ; turn on input shaping
;===== Optional Auto Bed Leveling (ABL) & Mech mode resonance sweep chceck =====
M1002 judge_flag g29_before_print_flag
M622 J1
G29.2 S0 ; avoid invalid abl data
; ===== Mech mode resonance sweep check =======
M1002 gcode_claim_action : 3 ; Status: Vibration Compensation
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
M1002 gcode_claim_action : 1 ; Status: Auto Bed Leveling
M190 S[bed_temperature_initial_layer_single]
M109 S140 A
M106 S0 ; turn off fan , too noisy
{if hold_chamber_temp_for_flat_print}
G29 H
{else}
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]}
{endif}
M400
M500 ; save cali data
G90
G1 X128 Y128 F20000
G29.2 S1 ; Enable ABL compensation
G28 Z P0 T400
G1 Z10 F1200
M623
;===== Optional Flow calibration =====
G150.3
M1002 judge_flag extrude_cali_flag
M622 J0
M983.3 F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4} A0.4 ; cali dynamic extrusion compensation
M623
M622 J1
M1002 gcode_claim_action : 8 ; Status: Extrusion Calibration
{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.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
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
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]}
M109 S{nozzle_temperature[initial_no_support_extruder]}
G90
M83
M983.3 F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4} A0.4 ; Flow calibration pattern
M400
M106 P1 S255
M400 S5
M106 P1 S0
G150.3
;--
G150.2
G150.1 F8000
G91
G1 Y-16 F12000 ; move away from the trash bin
G90
M400
;--
M623
M622 J2
M983.3 F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4} A0.4 ; cali dynamic extrusion compensation
M623
;=====
{if hold_chamber_temp_for_flat_print}
M1002 gcode_claim_action : 58
M104 S{first_layer_temperature[initial_no_support_extruder]}
{if bed_temperature_initial_layer_single > 89}
M1030 S1800
{else}
M1030 S300
{endif}
M1030 C
{endif}
{if filament_type[current_extruder] == "TPU" || filament_type[current_extruder] == "PVA"}
{else}
M83
G1 E-3 F1800
M400 P500
{endif}
;=====
M985.1 U0 E2
M985.1 U1 E2
;===== Final heating before printing ==========
M1002 gcode_claim_action : 7 ; Status: Nozzle heating
M104 S[nozzle_temperature_initial_layer] A
G150.3
M190 S[bed_temperature_initial_layer_single]
;========turn off light and fans =============
; M960 S1 P0 ; turn off laser
; M960 S2 P0 ; turn off laser
M106 S0 ; turn off cooling fan
;===== wait temperature reaching the reference value =======
M1002 gcode_claim_action : 255
M400
M975 S1 ; turn on mech mode supression
;============switch again==================
M211 X0 Y0 Z0 ;turn off soft endstop
G91
G1 Z6 F1200
G90
M1002 set_filament_type:{filament_type[initial_no_support_extruder]}
M620 S[initial_no_support_extruder]A
M400
T[initial_no_support_extruder]
M400
; M628 S0
; M629
G92 E0 ; Zeruje licznik ekstrudera (Naprawia rzyganie przy Resume!)
M83 ; Wymusza tryb relatywny
M400
M621 S[initial_no_support_extruder]A
;===== Z-OFFSET correction (Bed type dependent) =====
{if bed_temperature_initial_layer_single > 89}
{if curr_bed_type=="Textured PEI Plate"}
G29.1 Z{-0.02} ; for Textured PEI Plate
{else}
G29.1 Z{0.0}
{endif}
{else}
{if curr_bed_type=="Textured PEI Plate"}
G29.1 Z{0.01} ; for Textured PEI Plate
{else}
G29.1 Z{0.03}
{endif}
{endif}
;===== nozzle load line ===============================
M1002 gcode_claim_action : 51 ; Status: Printing calibration lines
G29.2 S1 ; ensure z comp turn on
G90
M83
M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}
G0 X100 Y0 F24000
M400
;G130 O0 X100 Y-0.4 Z0.8 F{filament_max_volumetric_speed[initial_no_support_extruder]/2/2.4053} L40 E20 D5
G130 O0 X100 Y-0.2 Z0.6 F{filament_max_volumetric_speed[initial_no_support_extruder]/2/2.4053} L40 E12 D4
G90
M83
G1 Z0.5
M400
;===== Activate all safety sensors =====
M1002 gcode_claim_action : 0
G29.99
{if (filament_type[initial_no_support_extruder] == "TPU") ||
(filament_type[initial_no_support_extruder] == "PLA") || (filament_type[initial_no_support_extruder] == "PETG")}
M1015.3 S1 H[nozzle_diameter];enable tpu, pla and petg clog detect
{else}
M1015.3 S0;disable clog detect
{endif}
{if (filament_type[initial_no_support_extruder] == "PLA") || (filament_type[initial_no_support_extruder] == "PETG")
|| (filament_type[initial_no_support_extruder] == "PLA-CF") || (filament_type[initial_no_support_extruder] == "PETG-CF")}
M1015.4 S1 K1 H[nozzle_diameter] ;enable E air printing detect
{else}
M1015.4 S0 K0 H[nozzle_diameter] ;disable E air printing detect
{endif}
M620.6 I[initial_no_support_extruder] W1 ;enable ams air printing detect
M1010 Q0 B0.023 S0.01
M1010 Q1 B0.005 S0.01
M1010.1 S1
;======== END GCODE ==========
A very strange situation. I tested the above G-code all evening yesterday, and it worked correctly every single time, meaning it resumed after a pause. Today, after turning it on, I wanted to check the exact same print again, so I paused the printing—unfortunately, resuming didn’t work again. Please check how it works for you, because I’m losing my mind here. I don’t understand why this isn’t repeatable for me—sometimes it works, sometimes it doesn’t. Do I have some kind of issue with the printer’s memory???
on my journey trying to optimize my own starting code i found this topic. today i was printing and having the same issue, after pausing it wont resume but rather wont stop extruding into the waste bin. i studied various codes from all places all day and noticed, that your code is missing “M500” (saving to eeprom??) . cant tell for sure if my code was missing it also…. the original code is using “M500 D1” although there is no explanation anywhere to find what D1 stands for. and confusingly the M500 D1 is located in “nozzle load line” (search for vxip-code/bambu-p2s-optimized @github). I inserted now M500 as well as M500 D1 near the end but since its already late today, i wont print anything to test it. i will try to test it tomorrow or in the next few days, but maybe you are faster than me or do you have already a different solution???
I’m glad I’m not the only one looking for interesting solutions for the P2S. For now, I’ve solved the problem, although it adds about 1–1.5 minutes to the print startup process. During that time, before printing the calibration line, the printer simply extrudes about 20 cm of filament (which it already does in the original code anyway), but then it resumes printing without any issues (tested). I use this when printing longer jobs.
I’ve created two print profiles:
-
Print without resume
-
Print with resume
Depending on what I need, I just select the appropriate profile.
Hi SylwekK,
thank you for your fast reply. I noticed today, that i was maybe just too impatient. after waiting for more than 3 (!) minutes the print finally resumed (after pause by layer). while this 3+ minutes it extrudes non stop… what a pain in my … wallet. i am now considering creating a timed pause with custom code insertion or some trash tower or secondary object.
also at my test print i wanted to refill “on the run” since my spool went empty. maybe i didnt put enough pressure on it or was just too slow, but printer went INTO PAUSE again
… just to extrude another 3+ minutes of filament while “purging old filament”. to put the cherry on top, the printer reduced nozzle temp by 30 degrees, because why not. so when it FINALLY resumed this nerve killing print, it continued to run the print with too low temp. had to manually set it back to correct it. it is mind boggling