Added temperature status less.

Hopefully fixed viky button handling without braking other boards
This commit is contained in:
Erik van der Zalm
2013-10-20 12:12:35 +02:00
parent 667d278f54
commit 8a08cca0f2
4 changed files with 810 additions and 751 deletions

View File

@ -2938,6 +2938,39 @@ void controllerFan()
}
#endif
#ifdef TEMP_STAT_LEDS
static bool blue_led = false;
static bool red_led = false;
static uint32_t stat_update = 0;
void handle_status_leds(void) {
float max_temp = 0.0;
if(millis() > stat_update) {
stat_update += 500; // Update every 0.5s
for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
max_temp = max(max_temp, degHotend(cur_extruder));
max_temp = max(max_temp, degTargetHotend(cur_extruder));
}
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
max_temp = max(max_temp, degTargetBed());
max_temp = max(max_temp, degBed());
#endif
if((max_temp > 55.0) && (red_led == false)) {
digitalWrite(STAT_LED_RED, 1);
digitalWrite(STAT_LED_BLUE, 0);
red_led = true;
blue_led = false;
}
if((max_temp < 54.0) && (blue_led == false)) {
digitalWrite(STAT_LED_RED, 0);
digitalWrite(STAT_LED_BLUE, 1);
red_led = false;
blue_led = true;
}
}
}
#endif
void manage_inactivity()
{
if( (millis() - previous_millis_cmd) > max_inactive_time )
@ -2991,7 +3024,10 @@ void manage_inactivity()
memcpy(destination,current_position,sizeof(destination));
prepare_move();
}
#endif
#endif
#ifdef TEMP_STAT_LEDS
handle_status_leds();
#endif
check_axes_activity();
}