c_evening_daylight.cfg modified - 19/04/25 - 10:33:41
This commit is contained in:
1 parent
d81223e886
commit
8bd84bbe94
1 file changed
+18
-14
@@ -3,11 +3,26 @@ command: sh /home/pi/printer_data/config/SCRIPTS/get_time.sh
|
|||||||
timeout: 0.05
|
timeout: 0.05
|
||||||
verbose: False
|
verbose: False
|
||||||
|
|
||||||
[gcode_macro process_time_output]
|
[gcode_macro FETCH_TIME]
|
||||||
gcode:
|
gcode:
|
||||||
{% set output = printer["gcode_shell_command GET_TIME"].output %}
|
RUN_SHELL_COMMAND CMD=GET_TIME
|
||||||
RESPOND MSG="{output}" # just prints raw output
|
|
||||||
|
|
||||||
|
[gcode_macro PROCESS_TIME_OUTPUT]
|
||||||
|
gcode:
|
||||||
|
G4 P250 # wait 250ms for shell to complete
|
||||||
|
{% set output = printer["shell_command"].output %}
|
||||||
|
{% set debug_msg = "✅ Shell output: " ~ output %}
|
||||||
|
RESPOND MSG="{debug_msg}"
|
||||||
|
{% set parts = output.split(" ") %}
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIME_STATE VARIABLE=hour VALUE={parts[0]|int}
|
||||||
|
SET_GCODE_VARIABLE MACRO=TIME_STATE VARIABLE=minute VALUE={parts[1]|int}
|
||||||
|
|
||||||
|
[gcode_macro CHECK_AND_FADE_LIGHT]
|
||||||
|
gcode:
|
||||||
|
FETCH_TIME
|
||||||
|
PROCESS_TIME_OUTPUT
|
||||||
|
EVENING_DAYLIGHT
|
||||||
|
|
||||||
[gcode_macro SHOW_LIGHT_TIME]
|
[gcode_macro SHOW_LIGHT_TIME]
|
||||||
gcode:
|
gcode:
|
||||||
{% set hour = printer["gcode_macro EVENING_DAYLIGHT"].hour %}
|
{% set hour = printer["gcode_macro EVENING_DAYLIGHT"].hour %}
|
||||||
@@ -15,17 +30,6 @@ gcode:
|
|||||||
{% set msg = "🕒 Stored time: " ~ hour|string ~ ":" ~ ("%02d"|format(minute)) %}
|
{% set msg = "🕒 Stored time: " ~ hour|string ~ ":" ~ ("%02d"|format(minute)) %}
|
||||||
RESPOND MSG="{msg}"
|
RESPOND MSG="{msg}"
|
||||||
|
|
||||||
[gcode_macro FETCH_TIME]
|
|
||||||
gcode:
|
|
||||||
RUN_SHELL_COMMAND CMD=GET_TIME
|
|
||||||
UPDATE_DELAYED_GCODE ID=process_time_output DURATION=0.25
|
|
||||||
|
|
||||||
[gcode_macro CHECK_AND_FADE_LIGHT]
|
|
||||||
gcode:
|
|
||||||
FETCH_TIME
|
|
||||||
G4 P0300 # wait 1.5s to ensure time vars are ready
|
|
||||||
EVENING_DAYLIGHT
|
|
||||||
|
|
||||||
[gcode_macro EVENING_DAYLIGHT]
|
[gcode_macro EVENING_DAYLIGHT]
|
||||||
variable_hour: 0
|
variable_hour: 0
|
||||||
variable_minute: 0
|
variable_minute: 0
|
||||||
|
|||||||
Reference in new issue
Block a user