Added temperature status less.

Hopefully fixed viky button handling without braking other boards
master
Erik van der Zalm 11 years ago
parent 667d278f54
commit 8a08cca0f2

@ -540,6 +540,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
//#define FAST_PWM_FAN //#define FAST_PWM_FAN
// Temperature status leds that display the hotend and bet temperature.
// If alle hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
// Otherwise the RED led is on. There is 1C hysteresis.
//#define TEMP_STAT_LEDS
// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
// which is not ass annoying as with the hardware PWM. On the other hand, if this frequency // which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
// is too low, you should also increment SOFT_PWM_SCALE. // is too low, you should also increment SOFT_PWM_SCALE.

@ -2938,6 +2938,39 @@ void controllerFan()
} }
#endif #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() void manage_inactivity()
{ {
if( (millis() - previous_millis_cmd) > max_inactive_time ) if( (millis() - previous_millis_cmd) > max_inactive_time )
@ -2992,6 +3025,9 @@ void manage_inactivity()
prepare_move(); prepare_move();
} }
#endif #endif
#ifdef TEMP_STAT_LEDS
handle_status_leds();
#endif
check_axes_activity(); check_axes_activity();
} }

@ -544,6 +544,13 @@
#endif #endif
#endif #endif
#ifdef TEMP_STAT_LEDS
#if MOTHERBOARD == 67
#define STAT_LED_RED 6
#define STAT_LED_BLUE 11
#endif
#endif
#ifdef ULTRA_LCD #ifdef ULTRA_LCD
#ifdef NEWPANEL #ifdef NEWPANEL

@ -737,12 +737,23 @@ static void lcd_implementation_update_indicators()
#endif #endif
#ifdef LCD_HAS_SLOW_BUTTONS #ifdef LCD_HAS_SLOW_BUTTONS
extern uint32_t blocking_enc;
static uint8_t lcd_implementation_read_slow_buttons() static uint8_t lcd_implementation_read_slow_buttons()
{ {
#ifdef LCD_I2C_TYPE_MCP23017 #ifdef LCD_I2C_TYPE_MCP23017
uint8_t slow_buttons;
// Reading these buttons this is likely to be too slow to call inside interrupt context // Reading these buttons this is likely to be too slow to call inside interrupt context
// so they are called during normal lcd_update // so they are called during normal lcd_update
return lcd.readButtons() << B_I2C_BTN_OFFSET; slow_buttons = lcd.readButtons() << B_I2C_BTN_OFFSET;
#if defined(LCD_I2C_VIKI)
if(slow_buttons & (B_MI|B_RI)) { //LCD clicked
if(blocking_enc > millis()) {
slow_buttons &= ~(B_MI|B_RI); // Disable LCD clicked buttons if screen is updated
}
}
#endif
return slow_buttons;
#endif #endif
} }
#endif #endif

Loading…
Cancel
Save