bed_mesh.cfg modified - 18/04/25 - 09:41:09
This commit is contained in:
1 parent
436e4a986c
commit
b9c1340344
1 file changed
@@ -0,0 +1,27 @@
|
||||
[gcode_macro EVENING_DAYLIGHT]
|
||||
description: Fade in daylight between 4:30pm and 6:00pm, only respond if brightness changes
|
||||
variable_last_brightness: -1.0
|
||||
gcode:
|
||||
{% set hour = now().hour %}
|
||||
{% set minute = now().minute %}
|
||||
{% set total_minutes = hour * 60 + minute %}
|
||||
{% set fade_start = 16 * 60 + 30 %}
|
||||
{% set fade_end = 18 * 60 %}
|
||||
|
||||
{% if total_minutes < fade_start %}
|
||||
{% set target = 0.0 %}
|
||||
{% elif total_minutes >= fade_end %}
|
||||
{% set target = 1.0 %}
|
||||
{% else %}
|
||||
{% set target = ((total_minutes - fade_start) / (fade_end - fade_start)) %}
|
||||
{% endif %}
|
||||
|
||||
{% set rounded_target = (target * 100)|int / 100.0 %}
|
||||
{% if rounded_target != last_brightness %}
|
||||
SET_PIN PIN=daylight VALUE={{ rounded_target }}
|
||||
SET_GCODE_VARIABLE MACRO=EVENING_DAYLIGHT VARIABLE=last_brightness VALUE={{ rounded_target }}
|
||||
|
||||
{% set time_display = hour|string ~ ":" ~ ("%02d"|format(minute)) %}
|
||||
{% set fade_msg = "🌗 Daylight: " ~ (rounded_target * 100)|int|string ~ "% (" ~ time_display ~ ")" %}
|
||||
RESPOND MSG="{fade_msg}"
|
||||
{% endif %}
|
||||
Reference in new issue
Block a user