Skip to content

Commit

Permalink
Logging and Door Panel Hotfix
Browse files Browse the repository at this point in the history
Logging and Door Panel Hotfix
  • Loading branch information
rootiest committed Jun 7, 2023
2 parents 5a8cdca + 9bea8dd commit 55a22c6
Show file tree
Hide file tree
Showing 18 changed files with 456 additions and 239 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!--
#####################################
## Printcfg Documentation ##
## Version 4.0.0 2023-6-1 ##
## Version 4.0.0 2023-6-5 ##
#####################################
-->

Expand Down
2 changes: 1 addition & 1 deletion print_debug.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#####################################
## Print Debugging ##
## Version 4.0.0 2023-6-1 ##
## Version 4.0.0 2023-6-5 ##
#####################################

## This file contains optional macros
Expand Down
2 changes: 1 addition & 1 deletion print_extras.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#####################################
## Print Extras ##
## Version 4.0.0 2023-6-1 ##
## Version 4.0.0 2023-6-5 ##
#####################################

## This file contains optional config
Expand Down
88 changes: 45 additions & 43 deletions print_macros.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#####################################
## Print Macros ##
## Version 4.0.0 2023-6-1 ##
## Version 4.0.0 2023-6-5 ##
#####################################

[include logging.cfg]
Expand Down Expand Up @@ -1506,56 +1506,58 @@ gcode:
description: Door is opened
variable_door: 0
gcode:
{% set doorcfg = printer['gcode_macro _door_cfg'] %} ; get doorcfg variables
{% set printcfg = printer['gcode_macro _printcfg'] %} ; get printcfg variables
{% set door = params.DOOR|default(0) %} ; get door number
{% set door_name = printcfg['door' + door] %} ; set door name
SET_GCODE_VARIABLE MACRO=_open_door VARIABLE=door VALUE={door} ; store door
{% if doorcfg.debounce == 0 %} ; check debounce
M{printcfg.output|int} Door {door_name}: Open ; status output
{printcfg.status_door_open} ; open door LEDs
{% if custom_macro == True %} ; check for custom macro
{printer['gcode_macro _printcfg'][door_macro]} ; run custom macro
{% endif %}
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=debounce VALUE=1 ; set debounce state
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=state VALUE=1 ; set door state
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=bounce VALUE=1 ; set door bounce
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=last_door VALUE={door} ; set last door
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=last_state VALUE=open ; set last state
UPDATE_DELAYED_GCODE ID=door_debounce DURATION={(printcfg.door_debounce / 1000)|float} ; set debounce timer
{% else %} ; bounced
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=bounce VALUE=1 ; set door bounce
{% set doorcfg = printer['gcode_macro _door_cfg'] %} ; get doorcfg variables
{% set printcfg = printer['gcode_macro _printcfg'] %} ; get printcfg variables
{% set door = params.DOOR|default(0) %} ; get door number
{% set door_name = printcfg['door' + door + '_name'] %} ; set door name
SET_GCODE_VARIABLE MACRO=_open_door VARIABLE=door VALUE={door} ; store door
logger title=Doors msg="Door: {door_name} opened" ; log door open
{% if doorcfg.debounce == 0 %} ; check debounce
M{printcfg.output|int} Door: {door_name} opened ; status output
{printcfg.status_door_open} ; open door LEDs
{% if custom_macro == True %} ; check for custom macro
{printer['gcode_macro _printcfg'][door_macro]} ; run custom macro
{% endif %}
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=state VALUE=1 ; set door state
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=last_door VALUE={door} ; set last door
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=last_state VALUE="'open'" ; set last state
# SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=debounce VALUE=1 ; set debounce state
# SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=bounce VALUE=1 ; set door bounce
# UPDATE_DELAYED_GCODE ID=door_debounce DURATION={(printcfg.door_debounce / 1000)|float} ; set debounce timer
#{% else %} ; bounced
# SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=bounce VALUE=1 ; set door bounce
{% endif %}

[gcode_macro _close_door]
description: Door is closed
variable_door: 0
gcode:
{% set doorcfg = printer['gcode_macro _door_cfg'] %} ; get doorcfg variables
{% set printcfg = printer['gcode_macro _printcfg'] %} ; get printcfg variables
{% set door = params.DOOR|default(0) %} ; get door number
{% set door_name = printcfg['door' + door] %} ; set door name
SET_GCODE_VARIABLE MACRO=_close_door VARIABLE=door VALUE={door} ; store door
{% set doorcfg = printer['gcode_macro _door_cfg'] %} ; get doorcfg variables
{% set printcfg = printer['gcode_macro _printcfg'] %} ; get printcfg variables
{% set door = params.DOOR|default(0) %} ; get door number
{% set door_name = printcfg['door' + door + '_name'] %} ; set door name
SET_GCODE_VARIABLE MACRO=_close_door VARIABLE=door VALUE={door} ; store door
logger title=Doors msg="Door: {door_name} closed" ; log door close
{% set door_macro = "door" + door|string + "_closed" %}
{% set custom_macro = True if printer['gcode_macro _printcfg'][door_macro] is defined else False %}
{% if doorcfg.debounce == 0 %} ; check debounce
M{printcfg.output|int} Door {door}: Closed ; status output
{% if printer.virtual_sdcard.is_active == True %} ; printing state
{printcfg.status_printing} ; closed door printing LEDs
{% else %} ; idle state
{printcfg.status_ready} ; closed door idle LEDs
{% if doorcfg.debounce == 0 %} ; check debounce
M{printcfg.output|int} Door: {door_name} closed ; status output
{% if printer.virtual_sdcard.is_active == True %} ; printing state
{printcfg.status_printing} ; closed door printing LEDs
{% else %} ; idle state
{printcfg.status_ready} ; closed door idle LEDs
{% endif %}
{% if custom_macro == True %} ; check for custom macro
{printer['gcode_macro _printcfg'][door_macro]} ; run custom macro
{% if custom_macro == True %} ; check for custom macro
{printer['gcode_macro _printcfg'][door_macro]} ; run custom macro
{% endif %}
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=debounce VALUE=1 ; set debounce state
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=state VALUE=0 ; set door state
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=bounce VALUE=0 ; set door bounce
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=last_door VALUE={door} ; set last door
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=last_state VALUE=closed ; set last state
UPDATE_DELAYED_GCODE ID=door_debounce DURATION={(printcfg.door_debounce / 1000)|float} ; set debounce timer
{% else %} ; bounced
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=bounce VALUE=0 ; set door bounce
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=state VALUE=0 ; set door state
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=last_door VALUE={door} ; set last door
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=last_state VALUE="'closed'" ; set last state
# SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=debounce VALUE=1 ; set debounce state
# SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=bounce VALUE=0 ; set door bounce
# UPDATE_DELAYED_GCODE ID=door_debounce DURATION={(printcfg.door_debounce / 1000)|float} ; set debounce timer
#{% else %} ; bounced
# SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=bounce VALUE=0 ; set door bounce
{% endif %}


Expand All @@ -1570,7 +1572,7 @@ gcode:
{% if doorcfg.bounce == 1 %} ; bounced open
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=state VALUE=1 ; set door state
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=bounce VALUE=1 ; set door bounce
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=last_state VALUE=open ; set last state
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=last_state VALUE="'open'" ; set last state
M{printcfg.output|int} Door Open ; status output
{printcfg.status_door_open} ; open door LEDs
{% if custom_macro == True %} ; check for custom macro
Expand All @@ -1579,7 +1581,7 @@ gcode:
{% else %} ; bounced closed
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=state VALUE=0 ; set door state
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=bounce VALUE=0 ; set door bounce
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=last_state VALUE=closed ; set last state
SET_GCODE_VARIABLE MACRO=_door_cfg VARIABLE=last_state VALUE="'closed'" ; set last state
M{printcfg.output|int} Door Closed ; status output
{% if printer.virtual_sdcard.is_active == True %} ; printing state
{printcfg.status_printing} ; closed door printing LEDs
Expand Down
2 changes: 1 addition & 1 deletion profiles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!--
#####################################
## Profiles Index ##
## Version 4.0.0 2023-6-1 ##
## Version 4.0.0 2023-6-5 ##
#####################################
-->

Expand Down
2 changes: 1 addition & 1 deletion profiles/default/config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#####################################
## Print Configuration ##
## Version 4.0.0 2023-6-1 ##
## Version 4.0.0 2023-6-5 ##
#####################################
# Profile:default
# Patch:4.0.0
Expand Down
2 changes: 1 addition & 1 deletion profiles/default/variables.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#####################################
## User Profile ##
## Version 4.0.0 2023-6-1 ##
## Version 4.0.0 2023-6-5 ##
#####################################
# Profile:default
# Patch:4.0.0
Expand Down
Loading

0 comments on commit 55a22c6

Please sign in to comment.