led.cpp

Sat, 07 Nov 2015 13:23:07 +0100

author
mbayer
date
Sat, 07 Nov 2015 13:23:07 +0100
changeset 0
2c8ba1964db7
permissions
-rw-r--r--

Initial code from reprappro Marlin repository

0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1 #include "led.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2 #if (LED_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
3 #include "Marlin.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
4 #include "temperature.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
5
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
6 static unsigned long previous_millis_led=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
7 static unsigned long previous_millis_toggle=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
8
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
9 void led_init()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
10 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
11 SET_OUTPUT(LED_PIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
12 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
13
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
14 void led_status()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
15 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
16 if (((millis() - previous_millis_led) < LED_UPDATE_INTERVAL))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
17 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
18 previous_millis_led=millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
19 /* // Not sure what this did - AB
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
20 if (degTargetHotend(active_extruder) > HEATER_0_MINTEMP)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
21 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
22 if (((millis() - previous_millis_toggle) < LED_HOTEND_ACTIVE_FLASH))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
23 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
24 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
25 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
26 WRITE(LED_PIN, READ(HEATER_0_PIN)); // Just tell us if the extruder heater is on
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
27 }*/
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
28 if(READ(HEATER_0_PIN))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
29 WRITE(LED_PIN, 1); // Heater on
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
30 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
31 TOGGLE(LED_PIN); // Heater off
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
32 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
33
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
34
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
35 #endif //LED_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
36
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
37

mercurial