|
@@ -0,0 +1,60 @@
|
|
1
|
+/**
|
|
2
|
+ * Marlin 3D Printer Firmware
|
|
3
|
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
4
|
+ *
|
|
5
|
+ * Based on Sprinter and grbl.
|
|
6
|
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
|
7
|
+ *
|
|
8
|
+ * This program is free software: you can redistribute it and/or modify
|
|
9
|
+ * it under the terms of the GNU General Public License as published by
|
|
10
|
+ * the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+ * (at your option) any later version.
|
|
12
|
+ *
|
|
13
|
+ * This program is distributed in the hope that it will be useful,
|
|
14
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+ * GNU General Public License for more details.
|
|
17
|
+ *
|
|
18
|
+ * You should have received a copy of the GNU General Public License
|
|
19
|
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+ *
|
|
21
|
+ */
|
|
22
|
+
|
|
23
|
+/**
|
|
24
|
+ * Marlin RGB LED general support
|
|
25
|
+ */
|
|
26
|
+
|
|
27
|
+#include "../../inc/MarlinConfig.h"
|
|
28
|
+
|
|
29
|
+#if ENABLED(TEMP_STAT_LEDS)
|
|
30
|
+
|
|
31
|
+#include "tempstat.h"
|
|
32
|
+#include "../../module/temperature.h"
|
|
33
|
+
|
|
34
|
+void handle_status_leds(void) {
|
|
35
|
+ static bool red_led = false;
|
|
36
|
+ static millis_t next_status_led_update_ms = 0;
|
|
37
|
+ if (ELAPSED(millis(), next_status_led_update_ms)) {
|
|
38
|
+ next_status_led_update_ms += 500; // Update every 0.5s
|
|
39
|
+ float max_temp = 0.0;
|
|
40
|
+ #if HAS_TEMP_BED
|
|
41
|
+ max_temp = MAX3(max_temp, thermalManager.degTargetBed(), thermalManager.degBed());
|
|
42
|
+ #endif
|
|
43
|
+ HOTEND_LOOP()
|
|
44
|
+ max_temp = MAX3(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e));
|
|
45
|
+ const bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led;
|
|
46
|
+ if (new_led != red_led) {
|
|
47
|
+ red_led = new_led;
|
|
48
|
+ #if PIN_EXISTS(STAT_LED_RED)
|
|
49
|
+ WRITE(STAT_LED_RED_PIN, new_led ? HIGH : LOW);
|
|
50
|
+ #if PIN_EXISTS(STAT_LED_BLUE)
|
|
51
|
+ WRITE(STAT_LED_BLUE_PIN, new_led ? LOW : HIGH);
|
|
52
|
+ #endif
|
|
53
|
+ #else
|
|
54
|
+ WRITE(STAT_LED_BLUE_PIN, new_led ? HIGH : LOW);
|
|
55
|
+ #endif
|
|
56
|
+ }
|
|
57
|
+ }
|
|
58
|
+}
|
|
59
|
+
|
|
60
|
+#endif // TEMP_STAT_LEDS
|