New backup from 18/04/25 - 08:36:31

This commit is contained in:
pi committed 2025-04-18 08:36:31 +01:00
1 parent 4b8cb5e9ec
commit 776f43b3f4
14 files changed
+2458

No files matched your search

+132
View File
@@ -0,0 +1,132 @@
[bed_mesh]
mesh_min = 15, 25
mesh_max = 330, 330
speed = 300
horizontal_move_z = 2
probe_count = 30,30
algorithm = bicubic
split_delta_z = 0.0125
scan_overshoot: 5
zero_reference_position: 176.00,179.50
fade_start: 1.0
fade_end: 10.0
fade_target: 0.0
##[(7x7)-1] / 2 = 24
##[(5x5)-1] / 2 = 12
##[(9x9)-1] / 2 = 40
#relative_reference_index: 40
#relative_reference_index: 15
[gcode_macro QUAD_GANTRY_LEVEL]
rename_existing: _QUAD_GANTRY_LEVEL
gcode:
STATUS_LEVELING
SAVE_GCODE_STATE NAME=STATE_QGL
BED_MESH_CLEAR
# If QGL has not been done yet, correct for any major skew first
# at 8mm height
{% if not printer.quad_gantry_level.applied %}
_QUAD_GANTRY_LEVEL horizontal_move_z=8 retry_tolerance=1
{% endif %}
# Compelte with a full QGL at the configured height
_QUAD_GANTRY_LEVEL
RESTORE_GCODE_STATE NAME=STATE_QGL
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: _BED_MESH_CALIBRATE
gcode:
{% set TARGET_TEMP = printer.heater_bed.target %}
M140 S0
_BED_MESH_CALIBRATE {rawparams}
M140 S{TARGET_TEMP}
[gcode_macro CARTOGRAPHER_TOUCH]
rename_existing: _CARTOGRAPHER_TOUCH
gcode:
{% set TARGET_TEMP = printer.heater_bed.target %}
M140 S0
_CARTOGRAPHER_TOUCH {rawparams}
M140 S{TARGET_TEMP}
#####################################################################
# Macros
#####################################################################
## customize BED MESH CALIBRATE gcode
## use BED_MESH_STORE -> generate MESH and save immediately and park in the middle
## use BED_MESH_STORE PARK=false -> generate MESH and save immediately
## use BED_MESH_STORE SAVE=false -> generate MESH and save it later
## use BED_MESH_STORE SAVE=false PARK=false -> would be most likely be used in your macros
[gcode_macro BED_MESH_STORE]
description: Generate a mesh, name it and run save_config if requested
variable_save_at_end: 'false'
gcode:
##### set default parameter value #####
{% set save = params.SAVE|default('true') %}
{% set park = params.PARK|default('true') %}
############# Get user defines #############
{% set center = printer["gcode_macro _USER_VARIABLE"].center %}
{% set z_hop = printer["gcode_macro _USER_VARIABLE"].z_hop %}
{% set bed_temp = printer.heater_bed.target|int %}
##### define plate name: Voron (default) or flexplate name #####
{% set plate_name = 'Voron' %}
{% if 'save_variables' in printer.configfile.config %}
{% if printer.save_variables.variables.plate_array is defined %}
{% set plate_index = printer.save_variables.variables.plate_index|int %}
{% set plate_name = printer.save_variables.variables.plate_array[plate_index][0] %}
{% endif %}
{% endif %}
##### join everything to a single mesh name #####
{% set mesh_name = "Voron-Bed_Temp-" + bed_temp|string + "C" %}
##### end of definitions #####
BED_MESH_CALIBRATE
BED_MESH_PROFILE SAVE={mesh_name}
BED_MESH_PROFILE REMOVE=default
{% if park|lower == 'true' %}
G90 ; set absolute
G0 Z{z_hop} F1800 ; move nozzle to z high first
G0 X{center[0]} Y{center[1]} F18000 ; home to get toolhead in the middle
{% endif %}
{% if save|lower == 'true' %}
_PRINT_AR T="BED_MESH: Save Config!"
SAVE_CONFIG
{% else %}
_PRINT_AR T="BED_MESH: Save Config after print done"
SET_GCODE_VARIABLE MACRO=BED_MESH_STORE VARIABLE=save_at_end VALUE='"true"'
{% endif %}
## use BED_MESH_LOAD -> load an existing MESH
## use BED_MESH_LOAD AUTO=true -> load an existing MESH or generate a new one and prepare it to be saved after print end
[gcode_macro BED_MESH_LOAD]
description: Load an existing mesh or generate a new one
gcode:
##### set default parameter value #####
{% set auto = params.AUTO|default('false') %}
{% set bed_temp = printer.heater_bed.target|int %}
##### join everything to a single mesh name #####
{% set mesh_name = "Voron-Bed_Temp-" + bed_temp|string + "C" %}
##### end of definitions #####
{% if printer.configfile.config["bed_mesh " + mesh_name] is defined %}
BED_MESH_CLEAR
BED_MESH_PROFILE LOAD={mesh_name}
_PRINT_AR T="{"BED_MESH: " + mesh_name + " loaded"}"
{% else %}
{% if auto|lower == 'true' %}
_PRINT_AR T="{"BED_MESH: " + mesh_name + " needs to be generated"}"
BED_MESH_STORE SAVE=false PARK=false
{% else %}
_PRINT_AR T="{"BED_MESH ERROR: " + mesh_name + " not defined"}"
{% endif %}
{% endif %}
## add this to your PRINT_END to save a mesh if needed 10 seconds after print ended
## UPDATE_DELAYED_GCODE ID=_BED_MESH_SAVE DURATION=10
[delayed_gcode _BED_MESH_SAVE]
gcode:
{% if printer["gcode_macro BED_MESH_STORE"].save_at_end == 'true' %}
_PRINT_AR T="BED_MESH: Save Config!"
SAVE_CONFIG
{% endif %}
+95
View File
@@ -0,0 +1,95 @@
# Note you may need to add the following to your printer.cfg somewhere (without the comments of course) for the Kinematic position stuff below to work.
#[force_move]
#enable_force_move: True
#[safe_z_home]
#home_xy_position: 175, 175
#speed: 150.0
#z_hop: 2
#z_hop_speed: 15.0
#move_to_previous: False
[gcode_macro _HOME_X]
gcode:
# Home
{% set RUN_CURRENT_X = printer.configfile.settings['tmc2209 stepper_x'].run_current|float %}
{% set RUN_CURRENT_Y = printer.configfile.settings['tmc2209 stepper_y'].run_current|float %}
{% set HOME_CURRENT = 0.49 %}
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CURRENT}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CURRENT}
SET_KINEMATIC_POSITION X=5
G91
G1 X-5 F1200
#G4 P2000
#M400 to finish all pending moves/process the buffer
M400
G28 X
# Move away
G91
G1 X-5 F1200
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y}
[gcode_macro _HOME_Y]
gcode:
{% set RUN_CURRENT_X = printer.configfile.settings['tmc2209 stepper_x'].run_current|float %}
{% set RUN_CURRENT_Y = printer.configfile.settings['tmc2209 stepper_y'].run_current|float %}
{% set HOME_CURRENT = 0.49 %}
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CURRENT}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CURRENT}
SET_KINEMATIC_POSITION Y=5
G91
G1 Y-5 F1200
#G4 P2000
#M400 to finish all pending moves/process the buffer
M400
# Home
G28 Y
# Move away
G91
G1 Y-5 F1200
# Wait just a second… (give StallGuard registers time to clear)
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y}
[homing_override]
axes: xyz
gcode:
{% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}
SET_KINEMATIC_POSITION Z=0
G1 Z5 F1200
{% if home_all or 'X' in params %}
_HOME_X
{% endif %}
{% if home_all or 'Y' in params %}
_HOME_Y
{% endif %}
{% if home_all or 'Z' in params %}
G90
G1 X{ printer.toolhead.axis_maximum.x/2 } Y{ printer.toolhead.axis_maximum.y/2 } F4500
G28 Z
G1 Z10 F1500
{% endif %}
[gcode_macro _CG28]
description: Homing only if necessary
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
+696
View File
@@ -0,0 +1,696 @@
[gcode_macro SET_MATERIAL]
description: Dynamically adjust chamber temps, fans, and behavior based on material
# === OVERVIEW ===
# This macro sets print parameters based on the selected filament type.
# It includes logic for fan control, pressure advance tuning, and chamber temperature management.
# Each material is uniquely handled with comments, proper defaults, and warnings where applicable.
#
# === WHY USE THIS ===
# - Ensures consistent print settings per material
# - Automatically adjusts temperature and environment conditions
# - Reduces manual tuning between material changes
# - Helps enforce safety (drying warnings, chamber heat warnings, etc.)
#
# === HOW TO USE ===
# Call the macro with:
# SET_MATERIAL MATERIAL=<your_material>
#
# Example:
# SET_MATERIAL MATERIAL=ABS
#
# === SETUP REQUIREMENTS ===
# You MUST configure:
# - A chamber temperature sensor (e.g., temperature_sensor chamber_combined_mean)
# - A bed heater (e.g., heater_bed)
# - Optionally, a chamber heater (e.g., heater_generic chamber_heater)
# - A chamber circulation fan (e.g., nevermore_fan)
#
# === PARAMETERS ===
# MATERIAL: Name of the filament material preset to apply
# Supported: PLA, ABS, PETG, ASA, PC, PA, PEEK, PEK, TPU, etc.
# Extended support for exotic blends like ESD-ABS, PVDF, MetalFill, Foam PLA
#
# === NOTES ===
# - Each material includes chamber temp, fan speed, PA, and smoothing settings
# - Some materials apply Z offset compensation or recommend special nozzle/hardware
# - Certain blocks include warnings (e.g., "dry before use" or "use hardened nozzle")
# - If you do not have a chamber heater, set `ACTIVE_CHAMBER_HEATING = False`
# - You can expand this macro to include more materials as needed
# - Unknown materials fall back to a safe PLA-like default
#
# === ADVANCED ===
# This macro can be tied into slicer startup G-code or multi-material toolchanging macros.
# You can also use it in combination with filament sensors or manual menu macros.
gcode:
{% set CHAMBER_SENSOR = "temperature_sensor chamber_combined_mean" %}
{% set BED_HEATER = "heater_bed" %}
{% set BED_FAN = "nevermore_fan" %}
{% set ACTIVE_CHAMBER_HEATING = False %} # Set to True if you have a dedicated chamber heater configured
{% set CHAMBER_HEATER = "chamber_heater" if ACTIVE_CHAMBER_HEATING else "" %}
{% set MATERIAL = params.MATERIAL|default("PLA")|string %}
SET_HEATER_TEMPERATURE HEATER={BED_HEATER} TARGET=0
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=0
{% if MATERIAL in ['PLA', 'PLA-CF', 'PE', 'PE-CF'] %}
# PLA: Easy to print, low warping, no chamber needed. CF = carbon fiber, stiffer and more abrasive.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.035 | Chamber: 25°C" %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.035 SMOOTH=0.04
{% elif MATERIAL in ['PLA+', 'SILK-PLA'] %}
# PLA+: Stronger, tougher PLA. Silk PLA has glossy finish but may string more.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.038 | Chamber: 25°C" %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.038 SMOOTH=0.04
{% elif MATERIAL in ['PVDF', 'PVDF-CF', 'PVDF-GF'] %}
# PVDF: Chemical-resistant and strong. Requires high chamber temps and dry storage.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.055 | Chamber: 90°C | ⚠️ Moisture-sensitive. Dry before use." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET=90 SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.045
{% elif MATERIAL in ['ESD-PLA', 'ESD-ABS', 'ESD-PC', 'ESD-PEEK'] %}
# ESD-safe filaments for sensitive electronics. Can be brittle, dry before use.
{% set chamber_temp = 60 if 'PLA' in MATERIAL else 80 %}
{% set pa_val = 0.04 if 'PLA' in MATERIAL else 0.05 %}
{% set message = "Material: " ~ MATERIAL ~ " | PA: " ~ pa_val|string ~ " | Chamber: " ~ chamber_temp|string ~ "°C | ⚠️ Dry before use for best performance." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={chamber_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA={pa_val} SMOOTH=0.045
{% elif MATERIAL == 'LW-PLA' %}
# LW-PLA: Lightweight PLA expands with heat. MUST reduce flow to ~65% manually.
{% set message = "Material: LW-PLA | PA: 0.03 | Chamber: 25°C | Reminder: Set flow to ~65%" %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.2
SET_PA PA=0.03 SMOOTH=0.04
{% elif MATERIAL == 'PLA-FOAM' %}
# PLA-FOAM: Similar to LW-PLA, foams up at extrusion temps. Lower flow ~60%.
{% set message = "Material: PLA-FOAM | PA: 0.03 | Chamber: 25°C | Reminder: Set flow to ~60%" %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.3
SET_PA PA=0.03 SMOOTH=0.04
{% elif MATERIAL in ['PETG', 'PETG-GF', 'PETG-CF', 'PET-CF'] %}
# PETG: Good strength/flexibility, more durable than PLA. May string. CF/GF are abrasive.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.03 | Chamber: 40°C" %}
RESPOND MSG="{message}"
M141 S40
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.03 SMOOTH=0.05
SET_GCODE_OFFSET Z=0.02 # PETG can be sticky; lift Z slightly to prevent nozzle drag
{% elif MATERIAL in ['ABS', 'ABS+', 'ABS-GF', 'ABS-CF'] %}
# ABS: Tough and heat-resistant, good for functional parts. Warps easily—requires enclosed chamber.
# CF (Carbon Fiber) / GF (Glass Fiber) versions are more rigid and very abrasive.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.05 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.05 SMOOTH=0.045
{% elif MATERIAL in ['ASA', 'ASA+', 'ASA-GF', 'ASA-CF', 'ASA-Aero'] %}
# ASA: UV-resistant alternative to ABS. Great for outdoor parts. Needs similar chamber temps to ABS.
# ASA-GF and ASA-CF are even more rigid and more abrasive.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.05 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.05 SMOOTH=0.045
{% elif MATERIAL == 'HIPS' %}
# HIPS: Used primarily as a dissolvable support for ABS. Requires similar chamber temps.
# ⚠️ Requires limonene bath for dissolution. Keep dry. May warp without chamber.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: HIPS | PA: 0.045 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Dissolves in limonene. Keep dry." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.045 SMOOTH=0.045
{% elif MATERIAL == 'BVOH' %}
# BVOH: Superior water-soluble support material. Less stringy than PVA but still moisture sensitive.
# ⚠️ Store in drybox. Dissolves faster in warm water. Do not overcool during print.
{% set message = "Material: BVOH | PA: 0.035 | Chamber: 25°C | ⚠️ Store dry. Dissolves in water." %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.2
SET_PA PA=0.035 SMOOTH=0.04
{% elif MATERIAL == 'PP' %}
# PP: Light and chemical-resistant. Warps easily and has poor adhesion. Needs chamber and special bed surface.
# ⚠️ Use PP-specific bed surface. Avoid cooling drafts. May require brim or raft.
{% set target_temp = 55 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PP | PA: 0.04 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Warps easily. PP bed surface recommended." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.04 SMOOTH=0.045
{% elif MATERIAL == 'PPSU' %}
# PPSU: High-performance thermoplastic. Chemical and heat-resistant. Needs very hot chamber and drying.
# ⚠️ Print with hardened nozzle. Needs chamber and high temps. Store dry.
{% set target_temp = 100 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PPSU | PA: 0.055 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Needs high temp & dry storage" %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.045
{% elif MATERIAL == 'ULTEM' or MATERIAL == 'PEI' %}
# ULTEM / PEI: Extremely strong. High temp aerospace/engineering plastic. Needs chamber + hardened nozzle.
# ⚠️ Only for high-end printers. Dry thoroughly. Print hot.
{% set target_temp = 120 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: ULTEM/PEI | PA: 0.06 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Industrial use only. Dry & hot." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.06 SMOOTH=0.05
{% elif MATERIAL == 'POLYMAX-PC' %}
# Polymaker PolyMax PC: Easier-to-print Polycarbonate blend. Good strength and clarity. Less prone to warping.
# ⚠️ Still requires chamber and hardened nozzle for long-term use.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PolyMax PC | PA: 0.05 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Tough and clear. Handle like PC." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.05 SMOOTH=0.045
{% elif MATERIAL == 'ULTRAFUSE-PAHT-CF15' %}
# BASF Ultrafuse PAHT CF15: High-temp nylon, 15% carbon fiber. Stiff, light, durable.
# ⚠️ Dry thoroughly. Use hardened nozzle. Requires chamber.
{% set target_temp = 70 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: Ultrafuse PAHT CF15 | PA: 0.06 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ High strength & very abrasive." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.06 SMOOTH=0.045
{% elif MATERIAL == 'PRUSAMENT-PETG-CF' %}
# Prusament PETG CF: Stiffer than normal PETG, reduced warping, excellent layer adhesion.
# ⚠️ Abrasive. Use hardened nozzle. Watch for brittle breakages if overcooled.
{% set message = "Material: Prusament PETG-CF | PA: 0.04 | Chamber: 45°C | ⚠️ Abrasive. Great dimensional stability." %}
RESPOND MSG="{message}"
M141 S45
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.4
SET_PA PA=0.04 SMOOTH=0.045
{% elif MATERIAL == 'PRUSAMENT-PLA-TOUGH' %}
# Prusament PLA Tough: Improved impact resistance vs. standard PLA. Still easy to print.
{% set message = "Material: Prusament PLA Tough | PA: 0.038 | Chamber: 25°C | Tougher than normal PLA." %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.038 SMOOTH=0.04
{% elif MATERIAL in ['TPU-SOFT', 'TPU-85A'] %}
# TPU-Soft: Ultra-flexible variant. Requires extremely slow printing and short retractions.
# ⚠️ Direct drive required. Reduce speed to <20mm/s. Keep dry to avoid stringing.
{% set message = "Material: TPU-SOFT | PA: 0.055 | Chamber: 30°C | ⚠️ Print very slowly. Direct drive only." %}
RESPOND MSG="{message}"
M141 S30
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.3
SET_PA PA=0.055 SMOOTH=0.035
SET_GCODE_OFFSET Z=0.02
{% elif MATERIAL == 'PA12-GF' %}
# PA12-GF: Glass-fiber filled Nylon 12. High strength, dimensional stability, very abrasive.
# ⚠️ Requires dry storage. Use hardened nozzle. Enclosure strongly recommended.
{% set target_temp = 70 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PA12-GF | PA: 0.06 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Dry thoroughly, very abrasive." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.06 SMOOTH=0.045
{% elif MATERIAL == 'BREAKAWAY' %}
# Breakaway: Rigid support material that peels away instead of dissolving. Great with ABS, ASA, PETG.
# ⚠️ Store dry. Avoid excessive cooling. Easy to print, good layer adhesion.
{% set message = "Material: Breakaway | PA: 0.035 | Chamber: 35°C | ⚠️ Peel-away support. Store dry." %}
RESPOND MSG="{message}"
M141 S35
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.3
SET_PA PA=0.035 SMOOTH=0.045
{% elif MATERIAL == 'NGEN' %}
# ColorFabb nGen: Easy-to-print PETG-like with smoother finish and less stringing. Based on Amphora AM3300.
{% set message = "Material: nGen | PA: 0.035 | Chamber: 30°C | Smoother than PETG, low stringing." %}
RESPOND MSG="{message}"
M141 S30
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.035 SMOOTH=0.045
{% elif MATERIAL == 'COLORFABB-HT' %}
# ColorFabb HT: High-temp, semi-crystalline Amphora-based copolyester. Tough and heat-resistant.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: ColorFabb HT | PA: 0.045 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | Tough and heat-tolerant. Dry before use." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.045 SMOOTH=0.045
{% elif MATERIAL == 'PPS' %}
# PPS: Exceptional chemical resistance, dimensional stability, and flame retardance. Used in automotive/aerospace.
{% set target_temp = 95 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PPS | PA: 0.06 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Industrial. Dry thoroughly. Print hot." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.06 SMOOTH=0.05
{% elif MATERIAL in ['PVDF-BLEND', 'KYNAR', 'SOLEF'] %}
# PVDF Blend: Enhanced versions of PVDF for strength/flexibility. Used in semiconductors, chemical labs.
{% set target_temp = 85 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PVDF Blend | PA: 0.055 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Chemical resistant. Dry required." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.045
{% elif MATERIAL == 'CARBONX-PC' %}
# CarbonX CFR-PC+: Carbon fiber-reinforced PC with excellent stiffness and heat performance.
# ⚠️ Use hardened nozzle. Dry before use. Requires enclosure.
{% set target_temp = 65 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: CarbonX PC+ | PA: 0.055 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ High stiffness, abrasive." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.045
{% elif MATERIAL == 'ESUN-ABS+' %}
# eSun ABS+: Modified ABS with lower warping and easier layer adhesion. Still benefits from chamber heat.
{% set target_temp = 55 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: eSun ABS+ | PA: 0.045 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | Easier than regular ABS." %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.045 SMOOTH=0.045
{% elif MATERIAL == 'RAISE3D-PLA+' %}
# Raise3D PLA+: Tougher PLA variant optimized for layer adhesion and strength.
{% set message = "Material: Raise3D PLA+ | PA: 0.038 | Chamber: 25°C | Tougher PLA with good printability." %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.038 SMOOTH=0.04
{% elif MATERIAL in ['PA', 'PA-GF', 'PA-CF', 'PAHT-CF', 'PA12-CF'] %}
# Nylon (PA): Strong, flexible, and wear-resistant. Extremely moisture-sensitive — dry before printing!
# CF = Carbon Fiber, GF = Glass Fiber, PAHT = high-temp nylon. Abrasive: use a hardened nozzle.
{% set target_temp = 65 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.06 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Dry thoroughly before use" %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.06 SMOOTH=0.045
{% elif MATERIAL in ['PC', 'PC-CF', 'PCTG'] %}
# PC (Polycarbonate): Very strong and heat resistant. Needs hot chamber. Tends to warp and absorb moisture.
# PC-CF is stiffer and more rigid. PCTG is a more forgiving blend.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.055 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.045
{% elif MATERIAL in ['PC-ABS', 'PCABS'] %}
# PC-ABS: Blend of PC and ABS. Easier to print than pure PC. Still wants a hot chamber and enclosure.
{% set target_temp = 70 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.055 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.045
{% elif MATERIAL == 'PEEK' %}
# PEEK: Ultra high-performance. Requires extremely hot chamber (110°C+). Dry thoroughly before use.
# Used in aerospace, medical, and industrial applications. Hardened nozzle & all-metal hotend required.
{% set target_temp = 110 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PEEK | PA: 0.06 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL %}
RESPOND MSG="{message}"{% set message = "⏳ Waiting on heat | Chamber: " ~ chamber_waiting|string ~ " | Bed: " ~ bed_waiting|string %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.06 SMOOTH=0.05
{% elif MATERIAL == 'PEK' %}
# PEK: Slightly lower-temp cousin of PEEK. Still high performance and needs special hardware.
{% set target_temp = 90 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PEK | PA: 0.055 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.055 SMOOTH=0.05
{% elif MATERIAL == 'TPU' %}
# TPU: Flexible filament. Needs slow print speed. Watch for oozing. Can stretch during retraction.
# ⚠️ Tips: Print very slowly (15-30mm/s). Use direct drive. Avoid long Bowden tubes. Dry before use if soft or stringy.
{% set message = "Material: TPU | PA: 0.055 | Chamber: 35°C | ⚠️ Go slow, direct drive recommended" %}
RESPOND MSG="{message}"
M141 S35
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.055 SMOOTH=0.04
SET_GCODE_OFFSET Z=0.02
{% elif MATERIAL == 'TPE' %}
# TPE: Very soft rubber-like filament. Print slowly. Use direct drive extruder.
# ⚠️ Tips: Reduce retraction. Very flexible – print <25mm/s. May require increased nozzle temp. Dry before use.
{% set message = "Material: TPE | PA: 0.05 | Chamber: 30°C | ⚠️ Slow speed, direct drive only" %}
RESPOND MSG="{message}"
M141 S30
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.05 SMOOTH=0.04
SET_GCODE_OFFSET Z=0.02
{% elif MATERIAL in ['NINJAFLEX', 'NINJA-FLEX'] %}
# NinjaFlex: Ultra-flexible. Print extremely slow. Hard to control extrusion. Direct drive required.
# ⚠️ Tips: Dry well. No retraction if possible. Tight filament path. Print 10–20mm/s.
{% set message = "Material: Ninjaflex | PA: 0.045 | Chamber: 30°C | ⚠️ Print <20mm/s. No Bowden setups." %}
RESPOND MSG="{message}"
M141 S30
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.3
SET_PA PA=0.045 SMOOTH=0.035
SET_GCODE_OFFSET Z=0.02
{% elif MATERIAL in ['METALFILL', 'BRONZEFILL', 'COPPERFILL'] %}
# MetalFill: PLA blended with metal powder. Heavy, beautiful finish. Extremely abrasive—use hardened nozzle.
# ⚠️ Tips: Slower speed, hardened nozzle, check for settling in filament spool.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.04 | Chamber: 35°C | ⚠️ Abrasive – use hardened nozzle" %}
RESPOND MSG="{message}"
M141 S35
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.04 SMOOTH=0.045
{% elif MATERIAL in ['IRONFILL', 'MAGNETICFILL'] %}
# Magnetic/iron PLA: Similar to MetalFill but can rust. Very abrasive. Hardened steel nozzle recommended.
# ⚠️ Store dry to avoid rust. May interfere with inductive sensors.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.04 | Chamber: 35°C | ⚠️ Abrasive. Keep dry." %}
RESPOND MSG="{message}"
M141 S35
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.04 SMOOTH=0.045
{% elif MATERIAL in ['WOODFILL', 'CARBONFILL', 'KEVLARFILL'] %}
# Filled composites: Can clog if retracted too much. Lower print speeds. Use wider nozzle (0.6mm+) and hardened tip.
# ⚠️ Avoid retraction-heavy prints. Watch for clogs. WoodFill can scorch – keep nozzle temp moderate.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.045 | Chamber: 40°C | ⚠️ Composite: Use 0.6mm+ hardened nozzle" %}
RESPOND MSG="{message}"
M141 S40
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.045 SMOOTH=0.045
{% elif MATERIAL in ['MOLDLAY', 'CASTFIL', 'CASTING'] %}
# MoldLay: Used for casting. Can be melted out like wax. Brittle and needs low chamber temps.
# ⚠️ Avoid excessive cooling. Brittle at room temp. Supports should be minimal.
{% set message = "Material: " ~ MATERIAL ~ " | PA: 0.035 | Chamber: 25°C | ⚠️ Brittle – handle gently post-print" %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.035 SMOOTH=0.04
{% elif MATERIAL in ['PVA', 'SUPPORT-PVA'] %}
# PVA: Water-soluble support material. Store in airtight container. Extremely moisture-sensitive.
{% set message = "Material: PVA | PA: 0.035 | Chamber: 25°C | ⚠️ Water Soluble & Moisture Sensitive" %}
RESPOND MSG="{message}"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.0 # No fan to avoid drafts/drying out
SET_PA PA=0.035 SMOOTH=0.04
{% elif MATERIAL in ['PMMA', 'ACRYLIC'] %}
# PMMA: Transparent, acrylic-like. Shrinks a lot—needs chamber. Often cracks if too cold. Store dry.
{% set target_temp = 60 %}
{% set passive_wait = target_temp - 25 %}
{% set CHAMBER_LABEL = "(active heater)" if ACTIVE_CHAMBER_HEATING else "(passive via bed, will start at ≥" ~ passive_wait|string ~ "°C)" %}
{% set message = "Material: PMMA | PA: 0.04 | Chamber: " ~ target_temp|string ~ "°C " ~ CHAMBER_LABEL ~ " | ⚠️ Brittle when moist, dry thoroughly" %}
RESPOND MSG="{message}"
SET_CHAMBER_HEAT TARGET={target_temp} SENSOR="{CHAMBER_SENSOR}" HEATER={CHAMBER_HEATER} BED_HEATER={BED_HEATER} FAN={BED_FAN} ACTIVE={ACTIVE_CHAMBER_HEATING}
SET_PA PA=0.04 SMOOTH=0.045
{% else %}
# Default fallback for unknown materials
RESPOND MSG="Material: Unknown | Default PA: 0.04 | Chamber: 25°C"
M141 S25
SET_FAN_SPEED FAN={BED_FAN} SPEED=0.5
SET_PA PA=0.04 SMOOTH=0.045
{% endif %}
[gcode_macro SET_PA]
description: Set Pressure Advance with automatic nozzle and flow-based scaling
variable_pa: 0.04
# === OVERVIEW ===
# Dynamically adjusts Pressure Advance (PA) based on:
# - Configured nozzle size (from printer.cfg)
# - Actual print flow vs max flow (defaults to 10/15 mm³/s)
#
# === HOW TO USE ===
# SET_PA PA=<base_value> [FLOW=<actual_mm3/s>] [MAX_FLOW=<max_mm3/s>] [SMOOTH=<smoothing>]
#
# Example:
# SET_PA PA=0.05
# SET_PA PA=0.05 FLOW=35 MAX_FLOW=70
#
# === PARAMETERS ===
# PA : Base PA for 100% flow (required)
# FLOW : Actual flow rate in mm³/s (default: 10)
# MAX_FLOW : Max hotend flow in mm³/s (default: 15)
# SMOOTH : Optional smoothing (default: 0.045)
gcode:
{% set base_pa = params.PA|float %}
{% set smooth = params.SMOOTH|default(0.045)|float %}
{% set nozzle = printer.extruder.nozzle_diameter|float %}
{% set flow = params.FLOW|default(30.0)|float %}
{% set max_flow = params.MAX_FLOW|default(70.0)|float %}
# === Nozzle-based scaling ===
{% if nozzle <= 0.2 %}
{% set nozzle_scale = 1.8 %}
{% elif nozzle <= 0.3 %}
{% set nozzle_scale = 1.4 %}
{% elif nozzle <= 0.4 %}
{% set nozzle_scale = 1.0 %}
{% elif nozzle <= 0.6 %}
{% set nozzle_scale = 0.75 %}
{% elif nozzle <= 0.8 %}
{% set nozzle_scale = 0.5 %}
{% else %}
{% set nozzle_scale = 0.4 %}
{% endif %}
{% set scaled_pa = base_pa * nozzle_scale %}
# === Flow-based scaling (square root of flow ratio) ===
{% if max_flow > 0 %}
{% set flow_ratio = flow / max_flow %}
{% set flow_scale = flow_ratio ** 0.5 %}
{% set adjusted_pa = scaled_pa * flow_scale %}
{% else %}
{% set adjusted_pa = scaled_pa %}
{% endif %}
# === Set PA and store variable ===
SET_PRESSURE_ADVANCE ADVANCE={adjusted_pa} SMOOTH_TIME={smooth}
SET_GCODE_VARIABLE MACRO=SET_PA VARIABLE=pa VALUE={adjusted_pa}
# === Output status ===
{% set msg = "📐 PA scaled for nozzle " ~ nozzle|string ~ "mm | Base: " ~ base_pa|string ~
" ➜ x" ~ nozzle_scale|string ~ " (nozzle) ➜ x" ~ flow_scale|string ~ " (flow) = " ~ adjusted_pa|string ~
" | Smooth: " ~ smooth|string %}
RESPOND MSG="{msg}"
[gcode_macro SET_CHAMBER_HEAT]
description: Modular chamber heating logic with active/passive support, includes safety checks and debug output
# === OVERVIEW ===
# This macro heats the chamber to a target temperature using either:
# 1. An active heater (like a dedicated chamber heater), or
# 2. Passive heating (using the bed heater).
# It controls the bed heater, an optional chamber heater, and a circulation fan.
# It will block until the target temperature is reached.
# === SAFETY WARNINGS ===
# - Ensure your chamber temperature sensor is correctly installed and reporting.
# - Watch your printer during the first few uses of this macro.
# - Passive mode may take a long time to reach temperature.
# - Don't overheat your enclosure — check max safe temps for your printer!
# === PARAMETERS ===
# TARGET : (required) Target chamber temperature in °C.
# SENSOR : (optional) Temperature sensor name (default: temperature_sensor chamber_combined_mean).
# HEATER : (optional) Chamber heater name (used only if ACTIVE=True).
# BED_HEATER : (optional) Bed heater name (default: heater_bed).
# FAN : (optional) Circulation fan name (default: nevermore_fan).
# ACTIVE : (optional) If True, uses a dedicated heater; otherwise uses passive heating.
# === USAGE ===
# SET_CHAMBER_HEAT TARGET=60 ACTIVE=True HEATER="heater_generic chamber_heater"
# SET_CHAMBER_HEAT TARGET=60 ACTIVE=False
# === OVERVIEW ===
# Heats the chamber using:
# 🔥 Active: Chamber heater + bed + fan
# ❄️ Passive: Bed heater only
# ✅ Blocks until desired temperature is reached
gcode:
# === 🎛️ Parse Parameters ===
{% set target = params.TARGET|int %}
{% set sensor = params.SENSOR|default('temperature_sensor chamber_combined_mean') %}
{% set heater = params.HEATER|default('') %}
{% set bed_heater = params.BED_HEATER|default('heater_bed') %}
{% set bed_fan = params.FAN|default('nevermore_fan') %}
{% set active = params.ACTIVE|default("false")|lower == 'true' %}
{% set wait_temp = target if active else target - 25 %}
{% set msg = "🧰 [CHAMBER HEAT] Init | Target: " ~ target ~ "°C | Wait until: " ~ wait_temp ~ "°C | Mode: " ~ ("🔥 Active" if active else "❄️ Passive") %}
RESPOND MSG="{msg}"
M141 S{target} # Set virtual chamber temp for slicers
# === 🔥 ACTIVE MODE ===
{% if active %}
{% set msg = "🔥 [CHAMBER HEAT] Enabling active mode: chamber heater + bed + fan at full speed!" %}
RESPOND MSG="{msg}"
{% if heater|length > 0 %}
{% set msg = "🛠️ [CHAMBER HEAT] Chamber heater '" ~ heater ~ "' → " ~ target|string ~ "°C" %}
RESPOND MSG="{msg}"
SET_HEATER_TEMPERATURE HEATER={heater} TARGET={target}
{% endif %}
{% set msg = "🛏️ [CHAMBER HEAT] Bed heater '" ~ bed_heater ~ "' → " ~ target|string ~ "°C (support heat)" %}
RESPOND MSG="{msg}"
SET_HEATER_TEMPERATURE HEATER={bed_heater} TARGET={target}
{% set msg = "🌀 [CHAMBER HEAT] Fan '" ~ bed_fan ~ "' → speed = 100%" %}
RESPOND MSG="{msg}"
SET_FAN_SPEED FAN={bed_fan} SPEED=1.0
# === ❄️ PASSIVE MODE ===
{% else %}
{% if printer[sensor].temperature < wait_temp %}
{% set msg = "❄️ [CHAMBER HEAT] Chamber is cool (" ~ printer[sensor].temperature|round(1) ~ "°C) — warming with bed only!" %}
RESPOND MSG="{msg}"
{% set msg = "🌀 [CHAMBER HEAT] Fan '" ~ bed_fan ~ "' → speed = 50% (gentle circulation)" %}
RESPOND MSG="{msg}"
SET_FAN_SPEED FAN={bed_fan} SPEED=0.5
{% set msg = "🛏️ [CHAMBER HEAT] Bed heater '" ~ bed_heater ~ "' → 120°C (passive heating boost)" %}
RESPOND MSG="{msg}"
SET_HEATER_TEMPERATURE HEATER={bed_heater} TARGET=120
{% set msg = "⏳ [CHAMBER HEAT] Waiting for bed to reach 120°C..." %}
RESPOND MSG="{msg}"
TEMPERATURE_WAIT SENSOR="{bed_heater}" MINIMUM=120
{% else %}
{% set msg = "✅ [CHAMBER HEAT] Chamber already warm (" ~ printer[sensor].temperature|round(1) ~ "°C), skipping passive heat!" %}
RESPOND MSG="{msg}"
{% endif %}
{% set msg = "🌀 [CHAMBER HEAT] Fan '" ~ bed_fan ~ "' → speed = 100%" %}
RESPOND MSG="{msg}"
SET_FAN_SPEED FAN={bed_fan} SPEED=1.0
{% endif %}
# === ⏳ FINAL BLOCKING WAIT ===
{% set msg = "⏳ [CHAMBER HEAT] Waiting for chamber sensor '" ~ sensor ~ "' ≥ " ~ wait_temp ~ "°C..." %}
RESPOND MSG="{msg}"
TEMPERATURE_WAIT SENSOR="{sensor}" MINIMUM={wait_temp}
{% set msg = "🎉 [CHAMBER HEAT] Chamber ready! Final temp: " ~ printer[sensor].temperature|round(1) ~ "°C" %}
RESPOND MSG="{msg}"
[gcode_macro M106]
rename_existing: G106
description: Compresses fan speeds into 10–30% range if bed temp ≥ 70°C
# === OVERVIEW ===
# This macro overrides the default M106 behavior to apply a thermal-aware fan speed limiter.
# When the bed temperature is at or above 70°C, it compresses the part cooling fan speed range
# into a safer 10–30% range (i.e., 26–76 PWM) to reduce warping or delamination in high-temp materials.
#
# === WHY USE THIS ===
# - Prevents excessive part cooling when printing materials like ABS, ASA, or PC.
# - Helps maintain stable chamber temperatures and reduce thermal shock.
# - Minimizes curling or layer splitting due to sudden cooling on hot beds.
#
# === HOW TO USE ===
# Simply use M106 S<value> as usual in your G-code or slicer.
# The macro will automatically adjust the fan speed if needed based on bed temperature.
#
# === NOTES ===
# - This logic only applies when the bed temperature is 70°C or higher.
# - Below 70°C, full-range fan control is allowed.
# - You can customize the input/output compression range if needed.
# === PARAMETERS ===
# S: Standard fan speed in 0–255 (required by M106)
# Internal constants:
# min_input = 26 (10% of 255)
# max_input = 255 (100%)
# min_output = 26 (10%)
# max_output = 76 (30%)
gcode:
{% set fan_speed = params.S|default(0)|int %}
{% set bed_temp = printer["heater_bed"].temperature %}
{% set min_input = 26 %}
{% set max_input = 255 %}
{% set min_output = 26 %}
{% set max_output = 76 %}
{% if bed_temp >= 70 %}
# If below threshold, limit fan to the lower compressed range (10–30%)
{% if fan_speed < min_input %}
{% set compressed_speed = min_output %}
{% else %}
{% set compressed_speed = (min_output + ((fan_speed - min_input) * (max_output - min_output) / (max_input - min_input)))|int %}
{% endif %}
G106 S{compressed_speed}
{% else %}
# Below threshold, allow full fan speed as requested
G106 S{fan_speed}
{% endif %}
@@ -0,0 +1,54 @@
[thermistor Trianglelab-NTC100K-B3950]
temperature1: 25
resistance1: 103180
temperature2: 150
resistance2: 1366.2
temperature3: 250
resistance3: 168.6
[temperature_sensor _chamber_1]
sensor_type: Trianglelab-NTC100K-B3950
sensor_pin: PF4
min_temp: 0
max_temp: 80
gcode_id: CH1
[temperature_sensor _chamber_2]
sensor_type: Trianglelab-NTC100K-B3950
sensor_pin: PF5
min_temp: 0
max_temp: 80
gcode_id: CH2
[temperature_sensor _chamber_3]
sensor_type: Trianglelab-NTC100K-B3950
sensor_pin: PF6
min_temp: 0
max_temp: 80
gcode_id: CH3
[temperature_sensor _chamber_4]
sensor_type: Trianglelab-NTC100K-B3950
sensor_pin: PF7
min_temp: 0
max_temp: 80
gcode_id: CH4
#[temperature_sensor chamber_combined_floor]
#sensor_type: temperature_combined
#sensor_list: temperature_sensor _chamber_1,temperature_sensor _chamber_2,temperature_sensor _chamber_3,temperature_sensor _chamber_4
#combination_method: min
#maximum_deviation: 999
[temperature_sensor chamber_combined_mean]
sensor_type: temperature_combined
sensor_list: temperature_sensor _chamber_1,temperature_sensor _chamber_2,temperature_sensor _chamber_3,temperature_sensor _chamber_4
combination_method: mean
maximum_deviation: 999
#[temperature_sensor chamber_combined_ceiling]
#sensor_type: temperature_combined
#sensor_list: temperature_sensor _chamber_1,temperature_sensor _chamber_2,temperature_sensor _chamber_3,temperature_sensor _chamber_4
#combination_method: max
#maximum_deviation: 999