Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Aug 1, 2023
2 parents e9528c1 + fcf0d44 commit 45a0438
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 19 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This is the new location of the macros and settings provided by the Fluidd team.
- Additional custom variables for stuff like extra retract at CANCEL_PRINT.
- "Pause at next Layer" and "Pause at Layer #"
- Different idle_timeout value when entering PAUSE
- Supports printer.cfg without any extruder e.g. cnc

### Why have we decided to use a dedicated repo?

Expand Down Expand Up @@ -221,6 +222,21 @@ gcode:
{% endif %}
```

**Update:** Some users reporting that this feature interferes with their workflow. Therefore, we improved it by:

- The temperature is only restored if you come out of idle_timeout
- PAUSE gets a new paramter RESTORE [0/1]
- 1: Thats the default and enables the restore of temperature when comming out of idle_timeout.
- 0: The temperature will not restored.

That is helpfull if you use it in e.g a M600 macro where you want to insure that the temperature is never restored.

```ini
[gcode_macro M600]
description: Filament change
gcode: PAUSE X=10 Y=10 Z_MIN=50 RESTORE=0
```

### New Feature: change idle_timeout when going in PAUSE

Many users falling in the trap of idle_timeout. This module is always activated an will shut down heaters and motors after 10 minutes if the printer is idle.
Expand Down
47 changes: 28 additions & 19 deletions client.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ on_error_gcode: CANCEL_PRINT

[display_status]

[respond]

[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
Expand Down Expand Up @@ -83,8 +85,10 @@ gcode:
##### get user parameters or use default #####
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% set idle_timeout = client.idle_timeout | default(0) %}
{% set temp = printer[printer.toolhead.extruder].target if printer.toolhead.extruder != '' else 0 %}
{% set restore = printer.toolhead.extruder != '' and params.RESTORE | default(1) | int == 1 %}
##### end of definitions #####
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=last_extruder_temp VALUE={printer[printer.toolhead.extruder].target}
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=last_extruder_temp VALUE="{{'restore': restore, 'temp': temp}}"
# set a new idle_timeout value
{% if idle_timeout > 0 %}
SET_GCODE_VARIABLE MACRO=PAUSE VARIABLE=restore_idle_timeout VALUE={printer.configfile.settings.idle_timeout.timeout}
Expand All @@ -96,7 +100,7 @@ gcode:
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
variable_last_extruder_temp: 0
variable_last_extruder_temp: {'restore': False, 'temp': 0}
gcode:
##### get user parameters or use default #####
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
Expand All @@ -107,7 +111,9 @@ gcode:
{% if printer['gcode_macro PAUSE'].restore_idle_timeout > 0 %}
SET_IDLE_TIMEOUT TIMEOUT={printer['gcode_macro PAUSE'].restore_idle_timeout}
{% endif %}
M109 S{last_extruder_temp}
{% if printer.idle_timeout.state | upper == "IDLE" and last_extruder_temp.restore %}
M109 S{last_extruder_temp.temp}
{% endif %}
_CLIENT_EXTRUDE
RESUME_BASE VELOCITY={params.VELOCITY | default(sp_move)}

Expand Down Expand Up @@ -139,11 +145,11 @@ variable_pause_next_layer: { 'enable': False, 'call': "PAUSE" }
variable_pause_at_layer : { 'enable': False, 'layer': 0, 'call': "PAUSE" }
gcode:
{% if pause_next_layer.enable %}
{action_respond_info("%s, forced by pause_next_layer" % pause_next_layer.call)}
RESPOND TYPE=echo MSG='{"%s, forced by pause_next_layer" % pause_next_layer.call}'
{pause_next_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE
SET_PAUSE_NEXT_LAYER ENABLE=0
{% elif pause_at_layer.enable and params.CURRENT_LAYER is defined and params.CURRENT_LAYER | int == pause_at_layer.layer %}
{action_respond_info("%s, forced by pause_at_layer [%d]" % (pause_at_layer.call, pause_at_layer.layer))}
RESPOND TYPE=echo MSG='{"%s, forced by pause_at_layer [%d]" % (pause_at_layer.call, pause_at_layer.layer)}'
{pause_at_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE
SET_PAUSE_AT_LAYER ENABLE=0
{% endif %}
Expand Down Expand Up @@ -189,34 +195,37 @@ gcode:
G1 X{x_park} Y{y_park} F{sp_move}
{% if not printer.gcode_move.absolute_coordinates %} G91 {% endif %}
{% else %}
{action_respond_info("Printer not homed")}
RESPOND TYPE=echo MSG='Printer not homed'
{% endif %}

[gcode_macro _CLIENT_EXTRUDE]
description: Extrudes, if the extruder is hot enough
gcode:
##### get user parameters or use default #####
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% set use_fw_retract = (client.use_fw_retract | default(false) | lower == 'true') and (printer.firmware_retraction is defined) %}
{% set length = params.LENGTH | default(client.unretract) | default(1.0) | float %}
{% set speed = params.SPEED | default(client.speed_unretract) | default(35) %}
{% set absolute_extrude = printer.gcode_move.absolute_extrude %}

{% if printer.extruder.can_extrude %}
{% if use_fw_retract %}
{% if length < 0 %}
G10
##### end of definitions #####
{% if printer.toolhead.extruder != '' %}
{% if printer[printer.toolhead.extruder].can_extrude %}
{% if use_fw_retract %}
{% if length < 0 %}
G10
{% else %}
G11
{% endif %}
{% else %}
G11
M83
G1 E{length} F{(speed | float | abs) * 60}
{% if absolute_extrude %}
M82
{% endif %}
{% endif %}
{% else %}
M83
G1 E{length} F{(speed | float | abs) * 60}
{% if absolute_extrude %}
M82
{% endif %}
RESPOND TYPE=echo MSG='Extruder not hot enough'
{% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}

[gcode_macro _CLIENT_RETRACT]
Expand Down

0 comments on commit 45a0438

Please sign in to comment.