Merge pull request #8945 from thinkyhead/bf2_better_char_lcd

[2.0.x] Display up to 3 extruders on char LCD
This commit is contained in:
Scott Lahteine 2017-12-28 20:48:14 -06:00 committed by GitHub
commit 8274369522
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -635,7 +635,11 @@ FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr,
} }
FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, const bool blink) { FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, const bool blink) {
#if TEMP_SENSOR_BED
const bool isBed = heater < 0; const bool isBed = heater < 0;
#else
constexpr bool isBed = false;
#endif
const float t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)), const float t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)),
t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater)); t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
@ -735,7 +739,7 @@ static void lcd_implementation_status_screen() {
// //
// Hotend 1 or Bed Temperature // Hotend 1 or Bed Temperature
// //
#if HOTENDS > 1 || TEMP_SENSOR_BED != 0 #if HOTENDS > 1 || TEMP_SENSOR_BED
lcd.setCursor(8, 0); lcd.setCursor(8, 0);
#if HOTENDS > 1 #if HOTENDS > 1
@ -746,7 +750,7 @@ static void lcd_implementation_status_screen() {
_draw_heater_status(-1, -1, blink); _draw_heater_status(-1, -1, blink);
#endif #endif
#endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0 #endif // HOTENDS > 1 || TEMP_SENSOR_BED
#else // LCD_WIDTH >= 20 #else // LCD_WIDTH >= 20
@ -758,12 +762,17 @@ static void lcd_implementation_status_screen() {
// //
// Hotend 1 or Bed Temperature // Hotend 1 or Bed Temperature
// //
#if HOTENDS > 1 || TEMP_SENSOR_BED != 0 #if HOTENDS > 1 || TEMP_SENSOR_BED
lcd.setCursor(10, 0); lcd.setCursor(10, 0);
#if HOTENDS > 1 #if HOTENDS > 1
_draw_heater_status(1, LCD_STR_THERMOMETER[0], blink); _draw_heater_status(1, LCD_STR_THERMOMETER[0], blink);
#else #else
_draw_heater_status(-1, LCD_BEDTEMP_CHAR, blink); _draw_heater_status(-1, (
#if HAS_LEVELING
planner.leveling_active && blink ? '_' :
#endif
LCD_BEDTEMP_CHAR
), blink);
#endif #endif
#endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0 #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
@ -792,14 +801,25 @@ static void lcd_implementation_status_screen() {
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
#if HOTENDS > 1 && TEMP_SENSOR_BED != 0 // If the first line has two extruder temps,
// show more temperatures on the next line
// instead of
// If we both have a 2nd extruder and a heated bed, #if HOTENDS > 2 || (HOTENDS > 1 && TEMP_SENSOR_BED)
// show the heated bed temp on the left,
// since the first line is filled with extruder temps
_draw_heater_status(-1, LCD_BEDTEMP_CHAR, blink);
#else #if HOTENDS > 2
_draw_heater_status(2, LCD_STR_THERMOMETER[0], blink);
lcd.setCursor(10, 1);
#endif
_draw_heater_status(-1, (
#if HAS_LEVELING
planner.leveling_active && blink ? '_' :
#endif
LCD_BEDTEMP_CHAR
), blink);
#else // HOTENDS <= 2 && (HOTENDS <= 1 || !TEMP_SENSOR_BED)
// Before homing the axis letters are blinking 'X' <-> '?'. // Before homing the axis letters are blinking 'X' <-> '?'.
// When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '. // When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '.
// When everything is ok you see a constant 'X'. // When everything is ok you see a constant 'X'.
@ -812,7 +832,7 @@ static void lcd_implementation_status_screen() {
_draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink); _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
lcd.print(ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS]))); lcd.print(ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])));
#endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0 #endif // HOTENDS <= 2 && (HOTENDS <= 1 || !TEMP_SENSOR_BED)
#endif // LCD_WIDTH >= 20 #endif // LCD_WIDTH >= 20
@ -820,7 +840,7 @@ static void lcd_implementation_status_screen() {
_draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink); _draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink);
lcd.print(ftostr52sp(FIXFLOAT(current_position[Z_AXIS]))); lcd.print(ftostr52sp(FIXFLOAT(current_position[Z_AXIS])));
#if HAS_LEVELING #if HAS_LEVELING && !TEMP_SENSOR_BED
lcd.write(planner.leveling_active || blink ? '_' : ' '); lcd.write(planner.leveling_active || blink ? '_' : ' ');
#endif #endif