BBL P1S organized start and end gcode

The code is exactly the same as of the one in the stock profile in an organized way.

Try to copy and paste it in plain text editor first and then you copy to your slicer.

Yeah, I imported it into notepad before putting it into the profile. I’ve done a few of them this way and not had a problem.
Seems odd that it only came up with those 2 errors if it is a formatting issue. I look forward to trying it though if you can work out what the cause is.

1 Like

What version of OrcaSlicer are you using? Mine is the 1.8.0.

This is a very weird error because I did not include any gocde to it, I only separated it in blocks of codes for easy reading and understanding.

I contacted Bambu Lab to provide me some sort of instruction manual for the machine specific gcodes and they refused to do so with some BS about IP protection (isn’t it ironic? :rofl:). All I asked was a list of the gcodes and what they do, and if possible, along with the correct syntaxes.

Unfortunately, we will need to rely on the community to dig deeper and learn more about the printer as we go.

By-the-way… I try to spend some time on the revised gocde on a daily basis after observing the printer moves.

One thing is for sure. BBL created a great machine but they were lazy enough to not create a machine specific firmware. You can tell this by some of X1C moves that the P1S does. (ie. slow move of the print head on the lower left corner to read the QR Code on the bed. The problem is that the P1S does not read anything so it is just a waste of time).

Also, I noticed that the printer makes way too many up/down bed moves which seems completely unnecessary to me like here:

; ========== reset machine status ==========
G380 S2 Z30 F300
G380 S2 Z-25 F300
G1 Z5 F300

Original code says G380 is like G38, but Marlin only has G38.X (Probe target | Marlin Firmware) which seems appropriate here but, obviously was modified by BBL.

If that is somewhat related, why the bed goes down 30mm, then up 25mm and down again by 5mm? Honestly I am not really sure.

If anyone has any ideas or more information, that would be great.

Apparently I have reached the max number of editing my original post… (wait, what?!)

I cannot change it anymore.

Yes, the OP of the Bambu X1 Deficiencies thread had to have their post unlocked in order add more edits as the edit window times out.

6 Likes

Revision 1, 20231230
.
.
.
Hey Folks,

I worked a little to make a more logic and fast start code for the P1S Combo and here it is :slight_smile:
Up to now I tested it only with different PLA and only Orca Slicer. There will be a warning, if the max filament temperature in your profile is below 250°C
I needed to prefill the nozzle at the end to have a good first line. Please check if you need this.
There is one unnecessary move in the start (head goes in front and back before purging). This is from the AMS GCODE and I cannot change.

Feel free to use and improve it!

DONE:

  • Logical order
  • Delete X1 commands
  • Complete heat up and homing at first
  • Delete unnecessary moves
  • Switch on fans on a low value
  • no vibration test
  • only one extruder temperature change

OPEN POINT:

  • Check and complete display messages (I don´t care about the messages, I deleted a lot of them for my tests)
Start gcode

;===== machine: P1S =====
;===== date: 20231226 =====
; ===== Rev. 1, 20231230 =====
;===== Start Code by Schmudi =====
;===== !!! Use at your own risk !!! =====
;****************************************
;===== reset machine status =================
G90
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 protential logic problem
G29.1 Z{+0.0} ; clear z-trim value first
M204 S10000 ; init ACC set to 10m/s^2

;=============turn on fans =================
M106 P1 S125 ; Part fan
M106 P2 S50 ; AUX Fan - minimum allowed by Bambu is 20 percent
M106 P3 S125 ; Chamber Fan
M710 A1 S255; MC-board fan automatic

;===== preheat and homing ====================
M140 S[bed_temperature_initial_layer_single] ;set bed temp
M104 S[nozzle_temperature_initial_layer] ;set extruder temp
M190 S[bed_temperature_initial_layer_single] ;wait bed temp
G28 P0 T300; home with low precision, permit 300deg temperature

;===== prepare purging ==========
M109 S250; set purge temp
G91
G0 Z10 F1200
G90
M975 S1 ; turn on mech mode supression
G1 X67 F12000
G1 Y240
G1 Y265 F3000

;===== prepare AMS ==========
M620 M
M620 S[initial_extruder]A ; switch material if AMS exist
G1 X120 F12000
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 extruder ==========
M412 S1 ;turn on filament runout detection
M104 S250 ;set nozzle to common flush temp
M106 P1 S0 ; Part fan off
G92 E0
G1 E40 F200; purge one
M400
M104 S[nozzle_temperature_initial_layer]
G92 E0
G1 E40 F200; purge two
M400
M106 P1 S255 ; Part fan full
M400 S3
G92 E0
G1 E-1.1 F300
M106 P1 S125
G1 X70 F9000
G1 X76 F15000
G1 X65 F15000
G1 X76 F15000
G1 X65 F15000; shake to put down garbage
G1 X80 F6000
G1 X95 F15000
G1 X80 F15000
G1 X165 F15000; wipe
M400
M106 P1 S125
G92 E0

;===== wipe nozzle ===============================
M1002 gcode_claim_action : 14
M975 S1
G1 X65 Y230 F18000
G1 Y264 F6000
G1 X100 F18000; first wipe
G29.2 S0 ; turn off ABL
G0 Z5 F20000
G1 X60 Y265
G1 X100 F5000; second wipeG1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X90 F5000
M400
G1 Z10
G29.2 S1 ; turn on ABL
M975 S1 ; turn on vibration supression

;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==
;curr_bed_type={curr_bed_type}
{if curr_bed_type==“Textured PEI Plate”}
G29.1 Z{-0.04} ; for Textured PEI Plate
{endif}
;======== wait extrude temperature and prefill nozzle =============
M1002 gcode_claim_action : 0
G29.2 S1
M190 S[bed_temperature_initial_layer_single] ;set and wait bed temp
M109 S[nozzle_temperature_initial_layer] ;set and wait extruder temp
M975 S1 ; turn on mech mode supression
G92 E0
G1 E0.2 F300; pre-fill nozzle CHECK if you need this
G92 E0

3 Likes

UPDATE

  • Updated the fan section with the MC-board cooling fan (switch on the fan as soon as a stepper is activated)
  • some other small changes

Switch off the fan in the end gcode by adding this line if you like:
M710 S0; MC-board fan off

UPDATE to V4
I had some trouble with melted Filament inside the extruder. It looks like there is little to much and/or to fast retract especially at the End G-Code.
So I reduced both values a little.
Raise the bed for textured plate a little more (Z-0.05) to be nearer to the nozzle.

UPDATE to V3
I had some time, so I finished Start and End G-Code.

  • Display Messages added
  • End G-Code adapted:
    – nozzle wipe included
    – added comments
    – put a 60 second cooling in (all 3 fans running high), please delete if you are printing a cooling sensitive filament (or if you just don´t like it :wink:). I did this also on my other printers to have an initial fast cool down especially for the nozzle/print head.
Start G-Code V4

;===== machine: P1S =====
;===== date: 20240101 =====
;===== Version 4 =====
;===== start G-Code by Schmudi =====
;===== !!! use at your own risk !!! =====
;===== P1S firmware: 1.04.02.00 =====
;===== AMS firmware: 00.00.06.40 =====
;===================================================
;===== reset machine status =================
G90
M17 X1.2 Y1.2 Z0.75 ; set 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 protential logic problem
G29.1 Z{+0.0} ; clear z-trim value first
M204 S10000 ; init ACC set to 10m/s^2

;=============turn on fans =================
M106 P1 S125 ; Part fan
M106 P2 S50 ; AUX Fan
M106 P3 S200 ; Chamber Fan
M710 A1 S216; MC-board fan automatic

;===== heatbed preheat and home ====================
M1002 gcode_claim_action : 2
M140 S[bed_temperature_initial_layer_single] ;set bed temp
M104 S[nozzle_temperature_initial_layer] ;set extruder temp
M190 S[bed_temperature_initial_layer_single] ;wait bed temp
M1002 gcode_claim_action : 13
G28 P0 T300; home with low precision,permit 300deg temperature

;===== prepare print temperature and material ==========
M1002 gcode_claim_action : 7
M109 S250; set purge temp
G91
G0 Z10 F1200
G90
M975 S1 ; turn on mech mode supression
G1 X67 F12000
G1 Y240
G1 Y265 F3000

;===== prepare AMS ==========
M1002 gcode_claim_action : 4
M620 M
M620 S[initial_extruder]A ; switch material if AMS exist
G1 X120 F12000
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 extruder and nozzle ==========
M1002 gcode_claim_action : 14
M412 S1 ;turn on filament runout detection
M104 S250 ;set nozzle to common flush temp
M106 P1 S0 ; Part fan off
G92 E0
G1 E40 F200
M400
M104 S[nozzle_temperature_initial_layer]
G92 E0
G1 E40 F200
M400
M106 P1 S255 ; Part fan full
M400 S4
G92 E0
G1 E-0.8 F300
M106 P1 S125
G1 X70 F9000
G1 X76 F15000
G1 X65 F15000
G1 X76 F15000
G1 X65 F15000; shake to put down garbage
G1 X80 F6000
G1 X95 F15000
G1 X80 F15000
G1 X165 F15000
M400
M106 P1 S125
G92 E0

;===== wipe nozzle ===============================
M1002 gcode_claim_action : 14
M975 S1
M106 S255
G1 X65 Y230 F18000
G1 Y264 F6000
G1 X100 F18000 ; first wipe mouth
G29.2 S0 ; turn off ABL
G0 Z5 F12000
G1 X60 Y265
G1 X100 F5000; second wipe mouth
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X90 F5000
M400
G1 Z10
G29.2 S1 ; turn on ABL
M975 S1 ; turn on vibration supression
M106 P1 S125 ; Part fan on
M1002 gcode_claim_action : 0

;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==
;curr_bed_type={curr_bed_type}
{if curr_bed_type==“Textured PEI Plate”}
G29.1 Z{-0.05} ; for Textured PEI Plate
{endif}

;======== wait extrude temperature and prefill =============
M106 P3 S220 ; Chamber Fan
M1002 gcode_claim_action : 0
G29.2 S1
M1002 gcode_claim_action : 2
M190 S[bed_temperature_initial_layer_single] ;set bed temp
M1002 gcode_claim_action : 7
M109 S[nozzle_temperature_initial_layer] ;set extruder temp
M1002 gcode_claim_action : 0
M975 S1 ; turn on mech mode supression
G92 E0
G1 E0.2 F300; pre-fill nozzle
G92 E0

End G-Code V3

;===== machine: P1S =====
;===== date: 20240101 =====
;===== Version 3 =====
;===== End G-Code by Schmudi =====
;===== !!! Use at your own risk !!! =====
;===================================================
;===== Preparation =====
M1002 gcode_claim_action : 0
M400 ; wait for buffer to clear
M1002 set_gcode_claim_speed_level : 5
;===== Retract filament =====
G92 E0 ; zero the extruder
G1 E-0.4 F300 ; retract
G1 Z{max_layer_z + 5} F900 ; lower z a little
G1 X65 Y255 F12000 ; move to safe pos
M400 S3; wait
G1 E-0.8 F300 ; retract
M400 S3; wait
G92 E0 ; zero the extruder
;===== 1st Wipe =====
G1 Y265 F3000
M140 S0 ; turn off bed
G1 X100 F12000 ; wipe
M1002 gcode_claim_action : 4
M620 S255; pull back filament to AMS

;====== cut filament =======
G1 X20 Y50 F12000
G1 Y-3
T255
G1 X65 F12000
G1 Y265

;===== wipe =======
M1002 gcode_claim_action : 14
G1 X100 F18000 ; first wipe
G29.2 S0 ; turn off ABL
G1 X60 Y265
G1 X100 F5000; second wipe mouth
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X90 F5000
M400
G29.2 S1 ; turn on ABL
M975 S1 ; turn on vibration supression
M400
M1002 gcode_claim_action : 0
;===== AMS =====
M621 S255; something for AMS
M104 S0 ; turn off hotend
M622.1 S1 ; for prev firmware, default turned on
;===== timelapse (camera) =====
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”
;===== Move Z down =====
M400
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 Z249 F600
G1 Z247
{endif}
M400 P100
;===== Move to park position and reset printer=====
G90
G1 X128 Y250 F3600
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

;===== fast cool down ==========
M106 P1 S200; part cooling fan
M106 P2 S200; Aux fan
M106 P3 S256; Chamber fan
M400 S60; 60 seconds fast cool down time
M106 P1 S0; part cooling fan off
M106 P2 S0; Aux fan off
M106 P3 S0; Chamber fan off
M710 S0; MC-board fan off

M17 X0.8 Y0.8 Z0.5 ; lower motor current

Any comments are very welcome
Have fun!!!

I would also like to point out that the filament change code is also in progress. Thx @DzzD for this :+1:

2 Likes

interesting code. i am going to give it a try and see how it works. seems alot faster to start printing already. is the bed leveling gone? thanks

Thx and yes, bed leveling is gone. You can do it manualy if needed.

Startcode UPDATE to V5

  • Added setting for Noctua exhaust (Chamber) fan. If you build in a Noctua fan, you cannot change the speed because the RPM is different from the Bambu fan. But you can put in 10% to have at least something in your display. Still don´t found a solution for this.
  • Purge temperature change: Now it is 5°C more than the maximum of the filament (find it in filament settings)
  • Purge procedure changed to 2 x 40mm
  • Retract now 2 times a liitle with some cool and leaking time in between
  • Offset for smooth PEI plate added. You can write an offset in the gcode for your smooth plate if you need, actually it is set to Z-0.02
  • No more prefill at the end of start code
  • First homing in high precission. I faced some problems with inadequate hight. Looks like the fast himing is sometimes not exact enough.

Endcode UPDATE to V4

  • Added setting for Noctua exhaust fan
  • Cool down time split into to ranges: First 30 seconds with high fans, then 120 seconds with medium fans
  • better nozzle wipe

Endcode UPDATE to V4.1

  • made a little fault, so AMS is not unloading. Repaired it with in 4.1.
Start G-Code V5

;===== machine: P1S =====
;===== date: 20240112 =====
;===== Version 5 =====
;===== start G-Code by Schmudi =====
;===== !!! use at your own risk !!! =====
;===== P1S firmware: 1.05.01.00 =====
;===== AMS firmware: 00.00.06.40 =====
;===================================================
;===== reset machine status =================
G90
M17 X1.2 Y1.2 Z0.75 ; set 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 protential logic problem
G29.1 Z{+0.0} ; clear z-trim value
M204 S10000 ; init ACC set to 10m/s^2

;=============turn on fans =================
M106 P1 S125 ; Part fan
M106 P2 S50 ; AUX Fan
M106 P3 S25; Chamber fan NOCTUA
; M106 P3 S125; Chamber fan BAMBU
M710 A1 S255; MC-board fan automatic

;===== heatbed preheat and home ====================
M1002 gcode_claim_action : 2
M140 S[bed_temperature_initial_layer_single] ;set bed temp
M104 S{nozzle_temperature_range_high[initial_extruder]} ;set extruder temp
M190 S[bed_temperature_initial_layer_single] ;wait bed temp
M1002 gcode_claim_action : 13
G28 T300; home XY first - permit 300deg temperature

;===== prepare print temperature and material ==========
M1002 gcode_claim_action : 7
; M109 S250; set purge temp - only use if different type of filament in use (ABS/PLA/ASA/…)
M104 S{nozzle_temperature_range_high[initial_extruder]} ;set extruder temp
G91
G0 Z10 F1200
G90
M975 S1 ; turn on mech mode supression
G1 X67 F12000
G1 Y240
G1 Y265 F3000

;===== bed leveling ====================
;M1002 gcode_claim_action : 7
;M1002 judge_flag g29_before_print_flag
;M622 J1
; 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 cali data
;M623

;===== prepare AMS ==========
M1002 gcode_claim_action : 4
M620 M
M620 S[initial_extruder]A ; switch material if AMS exist
G1 X120 F12000
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 extruder and nozzle ==========
M1002 gcode_claim_action : 14
M412 S1 ;turn on filament runout detection
; M104 S250 ;set nozzle to common flush temp - only for different materials
M109 S{nozzle_temperature_range_high[initial_extruder]}+5 ;set extruder temp+5
M106 P1 S0 ; Part fan off
G92 E0
G1 E40 F200 ; clean 40mm
M400
M104 S[nozzle_temperature_initial_layer]
G92 E0
G1 E40 F200 ; clean 50mm
M400
M106 P1 S255 ; Part fan full
M400 S4
G92 E0
G1 E-0.5 F300
M106 P1 S200
M400 S2
G92 E0
G1 E-0.3 F300
G92 E0
M400 S2
G1 X70 F9000
G1 X76 F15000
G1 X65 F15000
G1 X76 F15000
G1 X65 F15000; shake to put down garbage
G1 X80 F6000
G1 X95 F15000
G1 X80 F15000
G1 X165 F15000
M400
M106 P1 S255
G92 E0

;===== wipe nozzle ===============================
M1002 gcode_claim_action : 14
M975 S1
M106 P1 S255
G1 X65 Y230 F18000
G1 Y264 F6000
G1 X100 F18000 ; first wipe mouth
G29.2 S0 ; turn off ABL
G0 Z5 F12000
G1 X60 Y265
G1 X100 F5000; second wipe mouth
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X90 F5000
M400
G1 Z10
G29.2 S1 ; turn on ABL
M975 S1 ; turn on vibration supression
M106 P1 S125 ; Part fan on
M1002 gcode_claim_action : 0

;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==
curr_bed_type={curr_bed_type}
{if curr_bed_type==“Textured PEI Plate”}
G29.1 Z{-0.05} ; for Textured PEI Plate; personal PEI plate - corrct value to your own plate
{endif}
{if curr_bed_type==“High Temp Plate”}
G29.1 Z{-0.02} ; for smooth PEI-plate
{endif}

;======== wait extrude temperature and prefill =============
;M106 P3 S220 ; Chamber Fan BAMBU
M106 P3 S25 ; Chamber Fan NOCTUA
G29.2 S1
M1002 gcode_claim_action : 2
M190 S[bed_temperature_initial_layer_single] ;set bed temp
M1002 gcode_claim_action : 7
M109 S[nozzle_temperature_initial_layer] ;set extruder temp
M1002 gcode_claim_action : 0
M975 S1 ; turn on mech mode supression
G92 E0

End G-Code V4.1

;===== machine: P1S =====
;===== date: 20240117 =====
;===== Version 4.1 =====
;===== End G-Code by Schmudi =====
;===== !!! Use at your own risk !!! =====
;===================================================
M400 ; wait for buffer to clear
M17 X1.2 Y1.2 Z0.75 ; set motor current to default
M204 S10000 ; init ACC set to 10m/s^2
M1002 set_gcode_claim_speed_level : 5
G92 E0 ; zero the extruder
G1 E-0.2 F200 ; retract, 0,8mm retract is done automatically by Slicer
G1 Z{max_layer_z + 5} F900 ; lower z a little
G1 X65 Y255 F12000 ; move to safe pos
M400 S8; wait
G92 E0 ; zero the extruder
G1 Y265 F3000
M140 S0 ; turn off bed
G1 X100 F12000 ; wipe
M1002 gcode_claim_action : 4

;====== cut filament =======
M620 S255
G1 X20 Y50 F12000
G1 Y-3
T255
G1 X65 F12000
G1 Y265
M621 S255; pull back filament to AMS

;===== wipe nozzle =======
M1002 gcode_claim_action : 14
G1 X100 F18000 ; first wipe
G29.2 S0 ; turn off ABL
G1 X60 Y265
G1 X100 F5000; second wipe mouth
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X90 F5000
M400
G29.2 S1 ; turn on ABL
M975 S1 ; turn on vibration supression
M400
M1002 gcode_claim_action : 0
M621 S255; AMS
M104 S0 ; turn off hotend

;===== stop camera =======
M622.1 S1 ; for prev firmware, default turned 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”
M400

;===== lower heatbed =======
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 Z249 F600
G1 Z247
{endif}
M400 P100
G90
G1 X128 Y250 F3600

;===== reset printer =======
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

;===== fast cool down chamber ==========
M106 P1 S200; part cooling fan
; M106 P3 S25; Chamber fan NOCTUA
M106 P3 S125; Chamber fan BAMBU
M400 S30; 30 seconds fast cool down time

;===== second cool down ==========
M106 P1 S50; part cooling fan
M106 P2 S100; Aux fan
; M106 P3 S25; Chamber fan NOCTUA
M106 P3 S125; Chamber fan BAMBU
M400 S120; 120 second cool down time

;===== switch off machine ==========
M106 P1 S0; part cooling fan off
M106 P2 S0; Aux fan off
M106 P3 S0; Chamber fan off
M710 S0; MC-board fan off
M17 X0.8 Y0.8 Z0.5 ; lower motor current

One notice for the “Improve filament gcode change speed (x2)”. Please check the gcode as well. There is a high retract inside (G1 E-20 or something like this). I needed to reduce it (its also commented) to avoid extruder blockage. It`s only a short distance between hard and melted filament in the hotend.

Any comments are very welcome
Have fun!!!

3 Likes

Working great so far, thanks!

1 Like

Hello everybody,

after small adjustments the Start- and Endcodes are running now a while, so here´s the final version :partying_face:
It is tested with actual firmware, without noise reduction mode and only with Orca-Slicer (05.03.24: tested only with 0.4mm nozzle)
The Bed Mesh will only be done, if its tagged.

image

At end of print the toolhead will move to the cutter position and wait there. Don’t be surprised, that’s exactly what I want.
During this time the filament is moved back and the toolhead is waiting to be safe the filament is depressured and cooled down.

STARTCODE V6 - FINAL
;===== machine: P1S =====
;===== date: 20240229 =====
;===== Version 6 - FINAL =====
;===== start G-Code by Schmudi =====
;===== !!! use at your own risk !!! =====
;===== P1S firmware: 1.05.02 =====
;===== AMS firmware: 00.00.06.40 =====
;===================================================
;===== reset machine status =================
G90
M17 X1.2 Y1.2 Z0.75 ; set motor current to default
M290 X40 Y40 Z2.6666666; Use Babystepping
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 protential logic problem
G29.1 Z{+0.0} ; clear z-trim value
M204 S10000 ; init ACC set to 10m/s^2

;=============turn on fans  =================
M106 P1 S125 ; Part fan
M106 P2 S50 ; AUX Fan
; M106 P3 S25; Chamber fan NOCTUA
M106 P3 S125; Chamber fan BAMBU
M710 A1 S255; MC-board fan automatic

;===== heatbed preheat and home ====================
M1002 gcode_claim_action : 2
M140 S[bed_temperature_initial_layer_single] ;set bed temp
M104 S100 ; set extruder temp - low value to avoid blobs while homing
M190 S[bed_temperature_initial_layer_single] ;wait bed temp
M1002 gcode_claim_action : 13
; G28 P0 T300; fast Homing - permit 300deg temperature
G28 T300; Homing - permit 300deg temperature
M400 ; wait for finish homing

;===== prepare print temperature and material ==========
M1002 gcode_claim_action : 7
; M109 S250; set purge temp - only use if different type of filament in use (ABS/PLA/ASA/...)
M104 S{nozzle_temperature_range_high[initial_extruder]} ;wait extruder temp
G91
G1 Z10 F1200
G90
M975 S1 ; turn on mech mode supression
G1 X67 F12000
G1 Y240
G1 Y265 F3000

;===== bed leveling ====================
M1002 judge_flag g29_before_print_flag
M622 J1

   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 cali data

M623

;===== prepare AMS ==========
M1002 gcode_claim_action : 4
M620 M
M620 S[initial_extruder]A   ; switch material if AMS exist
    G1 X120 F12000
    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 extruder and nozzle ==========
M1002 gcode_claim_action : 14
M412 S1 ;turn on filament runout detection
; M104 S250 ;set nozzle to common flush temp - only for different materials
M109 S{nozzle_temperature_range_high[initial_extruder]}+5 ;set extruder temp+5
M106 P1 S0 ; Part fan off
G92 E0
G1 E40 F200 ; clean 40mm
M400
G92 E0
G1 E-1.5 F300 ; retract
M104 S[nozzle_temperature_initial_layer]
G92 E0
G1 E50 F400 ; clean 50mm
M400
M106 P1 S255 ; Part fan full
M400 S4
G92 E0
G1 E-0.5 F300
M106 P1 S200
M400 S2
G92 E0
G1 E-0.3 F300
G92 E0
M400 S2
G1 X70 F9000
G1 X76 F15000
G1 X65 F15000
G1 X76 F15000
G1 X65 F15000; shake to put down garbage
G1 X80 F6000
G1 X95 F15000
G1 X80 F15000
G1 X165 F15000
M400
M106 P1 S255
G92 E0

;===== wipe nozzle ===============================
M1002 gcode_claim_action : 14
M975 S1
M106 P1 S255
G1 X65 Y230 F18000
G1 Y264 F6000
G1 X100 F18000 ; first wipe
G29.2 S0 ; turn off ABL
G0 Z5 F12000
G1 X60 Y265
G1 X100 F5000; second wipe
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X90 F5000
M400
G1 Z10
G29.2 S1 ; turn on ABL
M975 S1 ; turn on vibration supression
M106 P1 S125 ; Part fan on

;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==
curr_bed_type={curr_bed_type}
{if curr_bed_type=="Textured PEI Plate"}
G29.1 Z{-0.05} ; for Textured PEI Plate; personal PEI plate - corrct value to your own plate
{endif}
{if curr_bed_type=="High Temp Plate"}
G29.1 Z{-0.00} ; for smooth PEI-plate
{endif}

;======== wait extrude temperature and prefill =============
M106 P3 S220 ; Chamber Fan BAMBU
; M106 P3 S25 ; Chamber Fan NOCTUA
G29.2 S1
M1002 gcode_claim_action : 2
M190 S[bed_temperature_initial_layer_single] ;set bed temp
M1002 gcode_claim_action : 7
M109 S[nozzle_temperature_initial_layer] ;set extruder temp
M1002 gcode_claim_action : 0
M975 S1 ; turn on mech mode supression
G92 E0
G92 E0.2 F200
G92 E0
ENDCODE V6 - FINAL
;===== machine: P1S =====
;===== date: 20240229 =====
;===== Version 6.0 - FINAL =====
;===== End G-Code by Schmudi =====
;===== !!! Use at your own risk !!! =====
;===================================================
M400 ; wait for buffer to clear
M17 X1.2 Y1.2 Z0.75 ; set motor current to default
M204 S10000 ; init ACC set to 10m/s^2
M1002 set_gcode_claim_speed_level : 5
G92 E0 ; zero the extruder
G1 E-0.3 F600 ; retract, 0,8mm retract is done automatically by Slicer
M104 S175 ; Lower nozzle temp
G1 Z{max_layer_z + 5} F900 ; lower z a little
G1 X65 Y255 F12000 ; move to safe pos
M400 S5; wait
G92 E0 ; zero the extruder
G1 E-0.3 F700 ; retract
M400 S5; wait
G92 E0 ; zero the extruder
G1 Y265 F3000
M140 S0 ; turn off bed
G1 X100 F12000 ; wipe
M1002 gcode_claim_action : 4

;====== cut filament =======
M620 S255
G1 X20 Y50 F12000
G1 Y-3
T255
G1 X65 F12000
G1 Y265
M621 S255; pull back filament to AMS

;===== wipe nozzle =======
M104 S0 ; turn off hotend
M1002 gcode_claim_action : 14
G1 X100 F18000 ; first wipe
G29.2 S0 ; turn off ABL
G1 X60 Y265
G1 X100 F5000; second wipe
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X100 F5000
G1 X70 F15000
G1 X90 F5000
M400
G29.2 S1 ; turn on ABL
M975 S1 ; turn on vibration supression
M400
M1002 gcode_claim_action : 0
M621 S255; AMS
M104 S0 ; turn off hotend

;===== stop camera =======
M622.1 S1 ; for prev firmware, default turned 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”
M400

;===== lower heatbed =======
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 Z249 F600
G1 Z247
{endif}
M400 P100
G90
G1 X128 Y250 F3600

;===== reset printer =======
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

;===== fast cool down chamber ==========
M106 P1 S200; part cooling fan
M106 P2 S200; Aux fan
; M106 P3 S25; Chamber fan NOCTUA
M106 P3 S200; Chamber fan BAMBU
M400 S30; 30 seconds fast cool down time

;===== second cool down ==========
M106 P1 S100; part cooling fan
M106 P2 S100; Aux fan
; M106 P3 S25; Chamber fan NOCTUA
M106 P3 S125; Chamber fan BAMBU
M400 S120; 120 second cool down time

;===== switch off machine ==========
M106 P1 S0; part cooling fan off
M106 P2 S0; Aux fan off
M106 P3 S0; Chamber fan off
M710 S0; MC-board fan off
M17 X0.8 Y0.8 Z0.5 ; lower motor current
M1002 gcode_claim_action : 0

Make sure to optimize it to your own need.

Happy Printing

3 Likes

Just tried it, great changes. I’m really happy with it overall. Thanks a bunch! I’ll reach out if I see any issues or have suggestions that others may benefit from.

1 Like

I just found this thread and tried using your V6 start/end codes in the Machine G-code section of printer settings in Orca Slicer with my P1S using a 0.6mm nozzle and textured PEI plate but the first layer is printing way too high and not sticking to the bed, even with doing a bed leveling. I reverted back to the original gcodes and it’s working properly again.

Did I miss a step somewhere?

Hey,

You should adjust the Z Offset to your need in this section:

Its -0.05 for the textured plate and 0.0 for the smooth plate. To be honest I use -0.05 for all my plates smooth plate. You can check what’s value is in your original code and put it in the optimized code.
I forgot to inform, that I tested only with 0.4 nozzle.

As I wrote: optimize it to your own need :slight_smile:

There’s something i’ve been trying to figure out from the machine-start code. I’d like to have the exact coordinates where the nozzle touches the bed during bedleveling. I’d like to exclude them from the buildplate.

I’ve been trying to print some smallprint and then switching to another filament to zhop around the small print. Right now I’m gambling so the nozzle doesnt touch the letters during bedleveling. Ive been lucky , but if I had the coordinates I could exclude them from the plate and get a nice warning when I accidentally put something under there.

Before I continue trial and erroring till infinity, does anyone know the exact coordinates?

The right value here, for reference, seems to be -0.03 for Textured PEI. I did a few test color change prints with a 0.6mm ObXidian nozzle with the optimized start/end code and filament change code and -0.03 came out perfect.

1 Like

The coordinates are somewhere in the firmware. So I don’t know the positions. But you can print without bed leveling and even without homing if you don’t switch off the printer and be fast enough. There is a time in the firmware between end of print and switch off motors. I do it often with the 0.8mm nozzle because there is very likely a blob at the nozzle which prevents a good homing.