Mentals Temperature Reactive Leds
Author: mental
Description:
Increases the brightness from black to bright red based on extruder temperature. Shows green when extruder is safe to touch.
This macro uses a gcode override on the M105 gcode to call this macro every time M105 is called. It is important to call the overridden gcode M105.1 somewhere in the macro so that the base functionality of the command is not lost. A jinja template is then evaluated based on the temperature parameters. After the template is applied, the gcode that is actually output is one only two lines of gcode containing
1
M105.1
2
SET_LED LED=temp_leds RED=*VAL* GREEN=0 BLUE=0 INDEX=0 TRANSMIT=1
Copied!
1
[neopixel temp_leds]
2
pin: P1.18
3
chain_count: 1
4
5
[gcode_macro M105]
6
rename_existing: M105.1
7
gcode:
8
9
M105.1
10
11
#if the extruder is off
12
{% if printer.extruder.target == 0 %}
13
14
#Set the LED to red if the extruder is off but is still hot, otherwise
15
# set the color to green
16
{% if printer.extruder.temperature > 60.0 %}
17
SET_LED LED=temp_leds RED=1 GREEN=0 BLUE=0 INDEX=0 TRANSMIT=1
18
{% else %}
19
SET_LED LED=temp_leds RED=0 GREEN=1 BLUE=0 INDEX=0 TRANSMIT=1
20
{% endif %}
21
22
{% else %}
23
24
#if the extruder temp is at target temperature
25
{% if printer.extruder.temperature >= printer.extruder.target - 4.0 %}
26
SET_LED LED=temp_leds RED=1 GREEN=0 BLUE=0 INDEX=0 TRANSMIT=1
27
28
#if the extruder is still heating
29
{% else %}
30
{% set scaler = printer.extruder.temperature|float / printer.extruder.target|float %}
31
SET_LED LED=temp_leds RED={ scaler|float * 1 } GREEN=0 BLUE=0 INDEX=0 TRANSMIT=1
32
{% endif %}
33
34
{% endif %}
Copied!
Last modified 1yr ago
Copy link