-
-
Notifications
You must be signed in to change notification settings - Fork 2
How P1S GCODE Works
P1S-GCODE replaces the machine preparation and shutdown sections generated by the slicer.
Before the model begins, the selected start profile initializes the printer, begins heating, homes the axes, prepares filament, purges and wipes the nozzle, handles adaptive probing where applicable, and primes near the front of the build plate.
After the model finishes, the selected end profile retracts and clears the print, cleans the nozzle, handles filament unloading, turns off the heaters, lowers the bed, parks the toolhead, and completes the final ventilation stage.
The model toolpath remains controlled by the slicer.
- Choose S, L-Lite, L, or XL according to which you prefer.
- Use L as the balanced everyday profile.
- Keep Bed Leveling enabled for L-Lite, L, and XL.
- Use the same profile files with an AMS or the external spool.
- Continue selecting print, filament, and quality settings normally in the slicer.
- Slice the model again whenever the machine profile changes.
- Initialize: set positioning, extrusion, motor-current, feed, and flow state.
- Enable: activate filament runout detection and resonance compensation.
- Heat: begin bed and nozzle heating.
- Home: establish the printer’s machine position.
- Prepare filament: enter the Bambu material-system sequence.
- Purge: establish filament flow at the rear purge area.
- Wipe: clean the nozzle using the profile-specific movement sequence.
- Probe: L-Lite, L, and XL can probe the first-layer print area.
- Compensate: enable bed-level compensation.
- Prime: prepare flow near the front of the plate.
- Print: hand control to the slicer-generated model toolpath.
- Finish: allow the remaining model moves to complete.
- Clear: retract and raise above the printed model.
- Clean: move to the purge area and run the selected cleaning sequence.
- Unload: complete AMS unloading when an AMS is present.
- Switch off: set nozzle and bed heater targets to zero.
- Wipe: complete the final nozzle-cleaning movement.
- Restore: re-enable bed compensation and resonance control.
- Park: lower the bed and move the toolhead to its final position.
- Ventilate: run the profile-specific fan stage.
- Idle: turn off the profile-controlled fans and reduce holding current.
| Property | S | L-Lite | L | XL |
|---|---|---|---|---|
| Adaptive probing block | No | Conditional | Conditional | Conditional |
| Rear purge | Minimal | Reduced | Moderate | Extended |
| Wiping | Short | Moderate | Moderate | Extended |
| Front priming | Stationary | Short segment | Full line | Full staged line |
| Relative sequence | Shortest | Shorter | Balanced | Longest |
| Property | S | L | XL |
|---|---|---|---|
| Cleaning | Short purge and minimal wiping | Retraction and moderate wiping | Extended purge and wiping |
| Bed lowering | Up to 80 mm | Up to 100 mm | Up to 100 mm |
| Final ventilation | 10 seconds | 30 seconds | 60 seconds |
| Relative sequence | Shortest | Balanced | Longest |
The profiles use values supplied by the active slicer configuration.
Examples include:
[bed_temperature_initial_layer]
[nozzle_temperature_initial_layer]
[initial_extruder]The slicer replaces these expressions when the model is generated.
The scripts also use information derived from the model:
{first_layer_print_min[0]}
{first_layer_print_size[1]}
{max_layer_z + 2}This allows the probing area and final clearance move to follow the current print.
The start profiles begin with commands such as:
G90
M83
M17 X1.2 Y1.2 Z0.75
M220 S100
M221 S100These establish absolute XYZ positioning, relative extrusion, the profile motor-current state, and normal feed and flow multipliers.
Runout detection and resonance compensation are then enabled before heating and homing begin.
The custom profiles start bed and nozzle heating early:
M140 S[bed_temperature_initial_layer]
M104 S[nozzle_temperature_initial_layer]This allows heating to continue while the printer completes the remaining preparation stages.
The nozzle is later brought to its required target with M109 before extrusion.
The stock reference sequence uses an explicit M190 bed wait. The custom profiles use a different preparation order in which bed heating overlaps with the rest of the start routine.
The profiles use the same Bambu material-system block structure found in the stock P1S machine G-code:
M620 ...
...
M621 ...With an AMS, the printer uses these blocks for material selection, loading, cutting, and unloading.
With the external spool, the AMS-specific operation is not performed. The surrounding start and end sequence remains unchanged.
L-Lite, L, and XL contain:
M1002 judge_flag g29_before_print_flag
M622 J1
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]}
M500
M623
G29.2 S1The g29_before_print_flag controls entry into the probing block. When the block runs, G29 A probes the first-layer print area, and G29.2 S1 enables compensation afterward.
S omits the probing block and enables compensation directly.
The two video examples in the README show these two observed paths: the conditional block being skipped and the block being entered. The custom script does not contain a separate mesh-scoring algorithm.
S uses a 2 mm initial prime, an 8 mm rear purge, a short wipe sequence, and a 4 mm front prime. It does not draw a full purge line.
L-Lite uses a reduced rear purge, a moderate wipe sequence, adaptive probing support, and a short front purge segment.
Its purpose is to reduce startup material use relative to standard L. A strong material or color transition may remain more visible at the beginning of the print.
L uses a 4 mm initial prime, a 36 mm rear purge, moderate wiping, adaptive probing support, and a full front purge line.
This is the balanced profile.
XL adds staged temperatures, additional purge, an extended wipe sequence, adaptive probing support, and a full staged front purge line.
This is the most extensive start profile.
S uses a short purge and minimal wipe sequence, lowers the bed by up to 80 mm, and finishes with 10 seconds of ventilation.
L uses retraction and moderate wiping. Its positive extrusion inside the material-system block positions filament during cutting and unloading rather than acting as a separate nozzle purge.
It lowers the bed by up to 100 mm and finishes with 30 seconds of ventilation.
XL uses the longest purge, wipe, unloading, and ventilation sequence.
It lowers the bed by up to 100 mm and finishes with 60 seconds of ventilation.
All end profiles set the nozzle and bed targets to zero:
M104 S0
M140 S0They temporarily disable bed compensation for part of the final wipe and then restore it.
All profiles turn off the part, auxiliary, and chamber fans after ventilation. S and XL also issue M710 S0; the equivalent line is commented in L, leaving that controller-fan state to the firmware.
| Area | Project file |
|---|---|
| Short start profile | S-START G-code |
| Reduced-purge start profile | L-START-LITE G-code |
| Balanced start profile | L-START G-code |
| Extended start profile | XL-START G-code |
| Short end profile | S-END G-code |
| Balanced end profile | L-END G-code |
| Extended end profile | XL-END G-code |
| Stock comparison |
STOCK-START and STOCK-END
|
P1S-GCODE
Start here
Understand the profiles
Help