Skip to content

Commit

Permalink
conditional include for the M190/M109 patch and optional bed heater
Browse files Browse the repository at this point in the history
  • Loading branch information
Frix-x committed May 22, 2023
1 parent c7d8b2b commit f20f395
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 37 deletions.
8 changes: 7 additions & 1 deletion config/hardware/extruder/cw1.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[gcode_macro _USER_VARIABLES]
variable_extruder_enabled: True
gcode:


[extruder]
# BMG Gear Ratio
# new_rd = previous_rd * mesured_distance / requested_distance
Expand All @@ -18,5 +23,6 @@ min_extrude_temp: 172
pressure_advance: 0.0475
pressure_advance_smooth_time: 0.040

# We also include the default wiring from here to avoid duplicating
# We also include the default wiring and low thermal hotend patch
[include default_wiring.cfg]
[include ../../../macros/helpers/hotend_heater_ctrl.cfg]
8 changes: 7 additions & 1 deletion config/hardware/extruder/cw2.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[gcode_macro _USER_VARIABLES]
variable_extruder_enabled: True
gcode:


[extruder]
# BMG Gear Ratio
# new_rd = previous_rd * mesured_distance / requested_distance
Expand All @@ -18,5 +23,6 @@ min_extrude_temp: 172
pressure_advance: 0.0475
pressure_advance_smooth_time: 0.040

# We also include the default wiring from here to avoid duplicating
# We also include the default wiring and low thermal hotend patch
[include default_wiring.cfg]
[include ../../../macros/helpers/hotend_heater_ctrl.cfg]
8 changes: 7 additions & 1 deletion config/hardware/extruder/galileo.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[gcode_macro _USER_VARIABLES]
variable_extruder_enabled: True
gcode:


[extruder]
# Galileo Gear Ratio
# new_rd = previous_rd * mesured_distance / requested_distance
Expand All @@ -18,5 +23,6 @@ min_extrude_temp: 172
pressure_advance: 0.0475
pressure_advance_smooth_time: 0.040

# We also include the default wiring from here to avoid duplicating
# We also include the default wiring and low thermal hotend patch
[include default_wiring.cfg]
[include ../../../macros/helpers/hotend_heater_ctrl.cfg]
8 changes: 7 additions & 1 deletion config/hardware/extruder/lgx_heavy.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[gcode_macro _USER_VARIABLES]
variable_extruder_enabled: True
gcode:


[extruder]
# Bontech LGX
# new_rd = previous_rd * mesured_distance / requested_distance
Expand All @@ -18,5 +23,6 @@ min_extrude_temp: 172
pressure_advance: 0.0475
pressure_advance_smooth_time: 0.040

# We also include the default wiring from here to avoid duplicating
# We also include the default wiring and low thermal hotend patch
[include default_wiring.cfg]
[include ../../../macros/helpers/hotend_heater_ctrl.cfg]
8 changes: 7 additions & 1 deletion config/hardware/extruder/lgx_lite.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[gcode_macro _USER_VARIABLES]
variable_extruder_enabled: True
gcode:


[extruder]
# Bontech LGX Lite
# new_rd = previous_rd * mesured_distance / requested_distance
Expand All @@ -18,5 +23,6 @@ min_extrude_temp: 172
pressure_advance: 0.0475
pressure_advance_smooth_time: 0.040

# We also include the default wiring from here to avoid duplicating
# We also include the default wiring and low thermal hotend patch
[include default_wiring.cfg]
[include ../../../macros/helpers/hotend_heater_ctrl.cfg]
8 changes: 7 additions & 1 deletion config/hardware/extruder/orbiter2.0.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[gcode_macro _USER_VARIABLES]
variable_extruder_enabled: True
gcode:


[extruder]
# Orbiter 2.0 Gear Ratio
# new_rd = previous_rd * mesured_distance / requested_distance
Expand All @@ -18,5 +23,6 @@ min_extrude_temp: 172
pressure_advance: 0.0475
pressure_advance_smooth_time: 0.040

# We also include the default wiring from here to avoid duplicating
# We also include the default wiring and low thermal hotend patch
[include default_wiring.cfg]
[include ../../../macros/helpers/hotend_heater_ctrl.cfg]
8 changes: 8 additions & 0 deletions config/hardware/heated_bed.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
[gcode_macro _USER_VARIABLES]
variable_heaterbed_enabled: True
gcode:


[heater_bed]
heater_pin: BED_HEATER
sensor_type: NTC 100K MGB18-104F39050L32
sensor_pin: BED_TEMPERATURE
max_power: 1
min_temp: 0
max_temp: 120

# We also include the "no wait too much for temperature" patch
[include ../../macros/helpers/bed_heater_ctrl.cfg]
1 change: 0 additions & 1 deletion config/machine.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ resolution: 0.1
[include ../macros/calibration/calib*.cfg]

[include ../macros/helpers/filament_swap.cfg]
[include ../macros/helpers/heaters_ctrl.cfg]
[include ../macros/helpers/heatsoak.cfg]
[include ../macros/helpers/nozzle_cleaning.cfg]
[include ../macros/helpers/temp_check.cfg]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
# This file add two specific overrides to fix the PID controller bad behavior
# This file add a specific override to fix the PID controller bad behavior
# on low thermal inertia devices such as the BambuLabs hotend. This allows a
# shunt of the "waiting time" during temperature settle in case there is some problems

[gcode_macro M109]
rename_existing: M109.1
gcode:
{% set S = params.S|float %}

{% set fix_heaters_temperature_settle = printer["gcode_macro _USER_VARIABLES"].fix_heaters_temperature_settle %}

{% if fix_heaters_temperature_settle %}
M104 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={S}
{% else %}
M109.1 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %}
{% endif %}


[gcode_macro M190]
rename_existing: M190.1
gcode:
Expand Down
36 changes: 22 additions & 14 deletions macros/helpers/heatsoak.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,30 @@ gcode:
{% set TIME = params.SOAKTIME|default(8)|int %}

{% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %}
{% set heaterbed_enabled = printer["gcode_macro _USER_VARIABLES"].heaterbed_enabled %}

{% if verbose %}
RESPOND MSG="Heating up bed..."
{% endif %}
{% if heaterbed_enabled %}
{% if verbose %}
RESPOND MSG="Heating up bed..."
{% endif %}

M190 S{SETPOINT_TEMP}
M190 S{SETPOINT_TEMP}

{% if TIME > 0 %}
{% for i in range(0, TIME) %}
RESPOND MSG="Heatsoak bed, {TIME-i}mn left..."
G4 P{60000 * 1}
{% endfor %}
{% else %}
RESPOND MSG="No heatsoak needed, continue"
{% endif %}
{% if TIME > 0 %}
{% for i in range(0, TIME) %}
RESPOND MSG="Heatsoak bed, {TIME-i}mn left..."
G4 P{60000 * 1}
{% endfor %}
{% else %}
RESPOND MSG="No heatsoak needed, continue"
{% endif %}

{% if verbose %}
RESPOND MSG="Bed temperature OK"
{% if verbose %}
RESPOND MSG="Bed temperature OK"
{% endif %}

{% else %}
{% if verbose %}
RESPOND MSG="No bed heater defined: nothing to do, continuing..."
{% endif %}
{% endif %}
17 changes: 17 additions & 0 deletions macros/helpers/hotend_heater_ctrl.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file add a specific override to fix the PID controller bad behavior
# on low thermal inertia devices such as the BambuLabs hotend. This allows a
# shunt of the "waiting time" during temperature settle in case there is some problems

[gcode_macro M109]
rename_existing: M109.1
gcode:
{% set S = params.S|float %}

{% set fix_heaters_temperature_settle = printer["gcode_macro _USER_VARIABLES"].fix_heaters_temperature_settle %}

{% if fix_heaters_temperature_settle %}
M104 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={S}
{% else %}
M109.1 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %}
{% endif %}
6 changes: 6 additions & 0 deletions macros/miscs/startup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ gcode:
# Dump the MCU version to the console for the Klippy log
_INIT_MCU_VER

# Check if there is an extruder set
{% set extruder_enabled = printer["gcode_macro _USER_VARIABLES"].extruder_enabled %}
{% if not extruder_enabled %}
{ action_raise_error("Klippain need to have an extruder defined to work properly. Check your printer.cfg includes!") }
{% endif %}

# Check the probe configuration and compatibility with current includes
_INIT_CHECKPROBECONF

Expand Down

0 comments on commit f20f395

Please sign in to comment.