c_evening_daylight.cfg modified - 19/04/25 - 09:56:10

This commit is contained in:
pi committed 2025-04-19 09:56:14 +10:00
1 parent 226d29c711
commit d2cfe66fa4
1 file changed
+9 -5
@@ -1,23 +1,27 @@
[gcode_shell_command GET_TIME]
command: sh /home/pi/printer_data/config/SCRIPTS/get_time.sh
timeout: 1.5
timeout: 0.3
[delayed_gcode process_time_output]
initial_duration: 1
initial_duration: 0.25
gcode:
{% set parts = printer["shell_command"].output.split(" ") %}
{% set output = printer["gcode_shell_command GET_TIME"].output %}
{% set debug_msg = "⏱ shell output: " ~ output %}
RESPOND MSG="{debug_msg}"
{% set parts = output.split(" ") %}
SET_GCODE_VARIABLE MACRO=EVENING_DAYLIGHT VARIABLE=hour VALUE={parts[0]|int}
SET_GCODE_VARIABLE MACRO=EVENING_DAYLIGHT VARIABLE=minute VALUE={parts[1]|int}
[gcode_macro FETCH_TIME]
gcode:
RUN_SHELL_COMMAND CMD=GET_TIME
UPDATE_DELAYED_GCODE ID=process_time_output DURATION=1
UPDATE_DELAYED_GCODE ID=process_time_output DURATION=0.25
[gcode_macro CHECK_AND_FADE_LIGHT]
gcode:
FETCH_TIME
G4 P1500 # wait 1.5s to ensure time vars are ready
G4 P0300 # wait 1.5s to ensure time vars are ready
EVENING_DAYLIGHT
[gcode_macro EVENING_DAYLIGHT]