Turn function that allows prints to start when bed temp is 'target - 1' into a param in _globals.

This commit is contained in:
Bassam Husain
2025-05-19 16:40:56 -04:00
parent 9ae483ebb4
commit 9e1cf53dc6
3 changed files with 39 additions and 13 deletions

14
.vscode/settings.json vendored
View File

@@ -70,4 +70,18 @@
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.color": "#512e0a"
// "[html][jinja][jinja-html]": {
// "editor.formatOnSave": false,
// "editor.defaultFormatter": "monosans.djlint",
// "editor.detectIndentation": true,
// "editor.linkedEditing": true,
// "editor.tabSize": 4,
// "djlint.enableLinting": true,
// "djlint.profile": "jinja"
// },
// "djlint.showInstallError": true,
// "djlint.useVenv": false,
// "djlint.pythonPath": "/home/bassam/.local/share/uv/tools",
// "djlint.formatLanguages": ["django-html", "jinja", "jinja-html"]
}

View File

@@ -354,11 +354,13 @@ Edit the relevant file according to your needs.
| ---------------------- | ------------------------ |
| `cfgs/misc-macros.cfg` | `[gcode_macro _globals]` |
| Variable | Disable | Enable | Notes |
| ---------------------------------- | ------------- | ------------- | ---------------------------------------------- |
| `variable_beeping_enabled` | `0` | `1` (default) |
| `variable_filament_sensor_enabled` | `0` (default) | `1` |
| `variable_kamp_enable` | `0` (default) | `1` | See [here](#what-do-i-need-to-know-about-kamp) |
| Variable | Disable | Enable | Notes |
| ---------------------------------- | ------------- | -------------- | ---------------------------------------------- |
| `variable_beeping_enabled` | `0` | `1` (default) |
| `variable_filament_sensor_enabled` | `0` (default) | `1` |
| `variable_kamp_enable` | `0` (default) | `1` | See [here](#what-do-i-need-to-know-about-kamp) |
| `variable_bed_temp_over` | `0` | `10` (default) | Speeds up print start |
| `variable_bed_temp_not_exact` | `0` | `1` (default) | Speeds up print start |
### How do I import a configuration bundle into SuperSlicer/PrusaSlicer?

View File

@@ -29,9 +29,11 @@ gcode:
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0
[gcode_macro _globals]
# NOTE 0 = false; 1 = true
variable_filament_sensor_enabled: 0 # NOTE Enable(1) or disable(0) the filament sensor, if one is connected
variable_beeping_enabled: 1 # NOTE Enable(1) or disable(0) beeping everywhere except during gantry calibration
variable_bed_temp_over: 10 # NOTE Start print if bed temperature is over by this amount, otherwise wait for temperature drop
variable_bed_temp_over: 10 # NOTE Start print if bed temperature is over by this amount. Set to 0 to disable, meaning, wait for temperature to drop
variable_bed_temp_not_exact: 1 # NOTE Start print if bed temperature is `target temperature - 1` (but continue to heat until target is reached)
variable_kamp_enable: 0 # NOTE Enable(1) or disable(0) KAMP (adaptive mesh)
variable_pre_purge_prime_length: 1.40
gcode:
@@ -75,12 +77,20 @@ gcode:
[gcode_macro M190]
rename_existing: M99190
gcode:
#Parameters
# Global variables/settings
{% set bedtempNotExact = printer["gcode_macro _globals"].bed_temp_not_exact|default(1)|int %}
# Parameters
{% set s = params.S|float %}
M140 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} ; Set bed temp
{% if s != 0 %}
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={s} MAXIMUM={s+1} ; Wait for bed temp (within 1 degree)
{% if bedtempNotExact == 1 %}
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={s-1} MAXIMUM={s+1} ; set & wait for bed temp (within -1 or +1 degree)
M140 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} ; set & don't wait for bed temp
{% else %}
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={s} MAXIMUM={s+1} ; Wait for bed temp (within +1 degree)
{% endif %}
{% endif %}
[gcode_macro PURGE_LINE]
@@ -97,7 +107,7 @@ gcode:
# Set safe speeds
{% set maxVelocity = printer.configfile.settings.printer.max_velocity|default(200)|int %}
{% set maxVelocityAdjusted = (0.95 * maxVelocity * 60)|int %}
{% set maxVelocityAdjusted = (0.95 * maxVelocity * 60)|int %}
G92 E0.0 ; reset extruder
G90 ; Absolute positioning
@@ -132,7 +142,7 @@ gcode:
{% set bedtempSlicer = bedtemp %}
{% set bedtempOver = printer["gcode_macro _globals"].bed_temp_over|default(0)|int %}
{% set maxVelocity = printer.configfile.settings.printer.max_velocity|default(200)|int %}
{% set maxVelocityAdjusted = (0.90 * maxVelocity * 60)|int %}
{% set maxVelocityAdjusted = (0.90 * maxVelocity * 60)|int %}
{% set kampEnabled=printer["gcode_macro _globals"].kamp_enable|default(0)|int %}
{% if printer.configfile.settings.safe_z_home %}
@@ -195,8 +205,8 @@ gcode:
# Set safe speeds
{% set zVelocity = printer.configfile.settings.printer.max_z_velocity|default(15)|int %}
{% set maxVelocity = printer.configfile.settings.printer.max_velocity|default(200)|int %}
{% set zVelocityAdjusted = (0.95 * zVelocity * 60)|int %}
{% set maxVelocityAdjusted = (0.95 * maxVelocity * 60)|int %}
{% set zVelocityAdjusted = (0.95 * zVelocity * 60)|int %}
{% set maxVelocityAdjusted = (0.95 * maxVelocity * 60)|int %}
# Get Boundaries
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
@@ -326,4 +336,4 @@ gcode:
G4 P{dur}
SET_PIN PIN=beeper VALUE=0
G4 P{dur}
{% endfor %}
{% endfor %}