Skip to content

Commit

Permalink
shutdown: renamed command and fix for prompt staying up in fluidd and…
Browse files Browse the repository at this point in the history
… added missing command
  • Loading branch information
consp committed Mar 22, 2024
1 parent e7e3287 commit b0d004e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions printer_configs/macros.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ command: sh -c /usr/libexec/shutdown
timeout: 15
verbose: True

[gcode_shell_command shutdown-ad5m]
command: systemctl poweroff
timeout: 15
verbose: False

[gcode_macro SHUTDOWN]
gcode:
RESPOND TYPE=command MSG="action:prompt_begin Question"
Expand All @@ -329,9 +334,7 @@ gcode:
gcode:
SET_PIN PIN=_power_off VALUE=0

[gcode_macro M105]
# M105 is used in the ff firmware as shutdown command and is triggered by the button
rename_existing: M105.1
[gcode_macro _SHUTDOWN_BUTTON_TRIGGER]
variable_trigger_allowed: False
gcode:
{% if trigger_allowed %}
Expand All @@ -349,13 +352,15 @@ gcode:
# Guard is needed as the button might trigger 0-2 times on RESTART
initial_duration: 1
gcode:
SET_GCODE_VARIABLE MACRO=M105 VARIABLE=trigger_allowed VALUE=True
SET_GCODE_VARIABLE MACRO=_SHUTDOWN_BUTTON_TRIGGER VARIABLE=trigger_allowed VALUE=True


[gcode_macro _SHUTDOWN_STAGE]
gcode:
# remove promt as sometimes it gets stuck in fluidd
RESPOND TYPE=command MSG=action:prompt_end
RUN_SHELL_COMMAND CMD=stop-and-sync
# power off will not do anything on a adm5 non pro
# power off will not do anything on a ad5m non pro
_POWER_OFF
RUN_SHELL_COMMAND CMD=_SHUTDOWN_AD5
RUN_SHELL_COMMAND CMD=shutdown-ad5m

2 changes: 1 addition & 1 deletion printer_configs/printer.base.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pin:PB6
[gcode_button btn_power]
pin: !PC15
press_gcode:
M105
_SHUTDOWN_BUTTON_TRIGGER

[output_pin _power_off]
pin: PC14
Expand Down

0 comments on commit b0d004e

Please sign in to comment.