Merge pull request #2074 from thinkyhead/lcd_xyz_unknown

Display unknown XYZ on the LCD as "---"
This commit is contained in:
Scott Lahteine 2015-05-14 04:56:38 -07:00
commit 95f5a68006
2 changed files with 101 additions and 78 deletions

View File

@ -273,7 +273,6 @@ static void lcd_implementation_status_screen() {
u8g.drawFrame(42, 49 - TALL_FONT_CORRECTION, 10, 4); u8g.drawFrame(42, 49 - TALL_FONT_CORRECTION, 10, 4);
u8g.drawPixel(50, 43 - TALL_FONT_CORRECTION); u8g.drawPixel(50, 43 - TALL_FONT_CORRECTION);
// Progress bar frame // Progress bar frame
u8g.drawFrame(54, 49, 73, 4 - TALL_FONT_CORRECTION); u8g.drawFrame(54, 49, 73, 4 - TALL_FONT_CORRECTION);
@ -333,19 +332,28 @@ static void lcd_implementation_status_screen() {
u8g.drawPixel(8,XYZ_BASELINE - 5); u8g.drawPixel(8,XYZ_BASELINE - 5);
u8g.drawPixel(8,XYZ_BASELINE - 3); u8g.drawPixel(8,XYZ_BASELINE - 3);
u8g.setPrintPos(10,XYZ_BASELINE); u8g.setPrintPos(10,XYZ_BASELINE);
if (axis_known_position[X_AXIS])
lcd_print(ftostr31ns(current_position[X_AXIS])); lcd_print(ftostr31ns(current_position[X_AXIS]));
else
lcd_printPGM(PSTR("---"));
u8g.setPrintPos(43,XYZ_BASELINE); u8g.setPrintPos(43,XYZ_BASELINE);
lcd_print('Y'); lcd_print('Y');
u8g.drawPixel(49,XYZ_BASELINE - 5); u8g.drawPixel(49,XYZ_BASELINE - 5);
u8g.drawPixel(49,XYZ_BASELINE - 3); u8g.drawPixel(49,XYZ_BASELINE - 3);
u8g.setPrintPos(51,XYZ_BASELINE); u8g.setPrintPos(51,XYZ_BASELINE);
if (axis_known_position[Y_AXIS])
lcd_print(ftostr31ns(current_position[Y_AXIS])); lcd_print(ftostr31ns(current_position[Y_AXIS]));
else
lcd_printPGM(PSTR("---"));
u8g.setPrintPos(83,XYZ_BASELINE); u8g.setPrintPos(83,XYZ_BASELINE);
lcd_print('Z'); lcd_print('Z');
u8g.drawPixel(89,XYZ_BASELINE - 5); u8g.drawPixel(89,XYZ_BASELINE - 5);
u8g.drawPixel(89,XYZ_BASELINE - 3); u8g.drawPixel(89,XYZ_BASELINE - 3);
u8g.setPrintPos(91,XYZ_BASELINE); u8g.setPrintPos(91,XYZ_BASELINE);
lcd_print(ftostr31(current_position[Z_AXIS])); if (axis_known_position[Z_AXIS])
lcd_print(ftostr32sp(current_position[Z_AXIS]));
else
lcd_printPGM(PSTR("---.--"));
u8g.setColorIndex(1); // black on white u8g.setColorIndex(1); // black on white
// Feedrate // Feedrate

View File

@ -406,97 +406,99 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
/* /*
Possible status screens: Possible status screens:
16x2 |0123456789012345| 16x2 |000/000 B000/000|
|000/000 B000/000| |0123456789012345|
|Status line.....|
16x4 |0123456789012345| 16x4 |000/000 B000/000|
|000/000 B000/000| |SD100% Z000.00 |
|SD100% Z000.0|
|F100% T--:--| |F100% T--:--|
|Status line.....| |0123456789012345|
20x2 |01234567890123456789| 20x2 |T000/000D B000/000D |
|T000/000D B000/000D | |01234567890123456789|
|Status line.........|
20x4 |01234567890123456789| 20x4 |T000/000D B000/000D |
|T000/000D B000/000D | |X000 Y000 Z000.00 |
|X000 Y000 Z000.00|
|F100% SD100% T--:--| |F100% SD100% T--:--|
|Status line.........| |01234567890123456789|
20x4 |01234567890123456789| 20x4 |T000/000D B000/000D |
|T000/000D B000/000D |
|T000/000D Z000.00 | |T000/000D Z000.00 |
|F100% SD100% T--:--| |F100% SD100% T--:--|
|Status line.........| |01234567890123456789|
*/ */
static void lcd_implementation_status_screen() { static void lcd_implementation_status_screen() {
int tHotend = int(degHotend(0) + 0.5);
int tTarget = int(degTargetHotend(0) + 0.5); #define LCD_TEMP_ONLY(T1,T2) \
lcd.print(itostr3(T1 + 0.5)); \
lcd.print('/'); \
lcd.print(itostr3left(T2 + 0.5))
#define LCD_TEMP(T1,T2,PREFIX) \
lcd.print(PREFIX); \
LCD_TEMP_ONLY(T1,T2); \
lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); \
if (T2 < 10) lcd.print(' ')
//
// Line 1
//
lcd.setCursor(0, 0);
#if LCD_WIDTH < 20 #if LCD_WIDTH < 20
lcd.setCursor(0, 0); //
lcd.print(itostr3(tHotend)); // Hotend 0 Temperature
lcd.print('/'); //
lcd.print(itostr3left(tTarget)); LCD_TEMP_ONLY(degHotend(0), degTargetHotend(0));
//
// Hotend 1 or Bed Temperature
//
#if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 #if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
// If we have an 2nd extruder or heated bed, show that in the top right corner
lcd.setCursor(8, 0); lcd.setCursor(8, 0);
#if EXTRUDERS > 1 #if EXTRUDERS > 1
tHotend = int(degHotend(1) + 0.5);
tTarget = int(degTargetHotend(1) + 0.5);
lcd.print(LCD_STR_THERMOMETER[0]); lcd.print(LCD_STR_THERMOMETER[0]);
#else // Heated bed LCD_TEMP_ONLY(degHotend(1), degTargetHotend(1));
tHotend = int(degBed() + 0.5); #else
tTarget = int(degTargetBed() + 0.5);
lcd.print(LCD_STR_BEDTEMP[0]); lcd.print(LCD_STR_BEDTEMP[0]);
LCD_TEMP_ONLY(degBed(), degTargetBed());
#endif #endif
lcd.print(itostr3(tHotend));
lcd.print('/');
lcd.print(itostr3left(tTarget));
#endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
#else // LCD_WIDTH > 19 #else // LCD_WIDTH >= 20
lcd.setCursor(0, 0); //
lcd.print(LCD_STR_THERMOMETER[0]); // Hotend 0 Temperature
lcd.print(itostr3(tHotend)); //
lcd.print('/'); LCD_TEMP(degHotend(0), degTargetHotend(0), LCD_STR_THERMOMETER[0]);
lcd.print(itostr3left(tTarget));
lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
if (tTarget < 10) lcd.print(' ');
//
// Hotend 1 or Bed Temperature
//
#if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 #if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
// If we have an 2nd extruder or heated bed, show that in the top right corner
lcd.setCursor(10, 0); lcd.setCursor(10, 0);
#if EXTRUDERS > 1 #if EXTRUDERS > 1
tHotend = int(degHotend(1) + 0.5); LCD_TEMP(degHotend(1), degTargetHotend(1), LCD_STR_THERMOMETER[0]);
tTarget = int(degTargetHotend(1) + 0.5); #else
lcd.print(LCD_STR_THERMOMETER[0]); LCD_TEMP(degBed(), degTargetBed(), LCD_STR_BEDTEMP[0]);
#else // Heated bed
tHotend = int(degBed() + 0.5);
tTarget = int(degTargetBed() + 0.5);
lcd.print(LCD_STR_BEDTEMP[0]);
#endif #endif
lcd.print(itostr3(tHotend));
lcd.print('/');
lcd.print(itostr3left(tTarget));
lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
if (tTarget < 10) lcd.print(' ');
#endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
#endif // LCD_WIDTH > 19 #endif // LCD_WIDTH >= 20
//
// Line 2
//
#if LCD_HEIGHT > 2 #if LCD_HEIGHT > 2
// Lines 2 for 4 line LCD
#if LCD_WIDTH < 20 #if LCD_WIDTH < 20
#ifdef SDSUPPORT #ifdef SDSUPPORT
lcd.setCursor(0, 2); lcd.setCursor(0, 2);
lcd_printPGM(PSTR("SD")); lcd_printPGM(PSTR("SD"));
@ -507,36 +509,48 @@ static void lcd_implementation_status_screen() {
lcd.print('%'); lcd.print('%');
#endif // SDSUPPORT #endif // SDSUPPORT
#else // LCD_WIDTH > 19 #else // LCD_WIDTH >= 20
#if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0
// If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps
tHotend = int(degBed() + 0.5);
tTarget = int(degTargetBed() + 0.5);
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd.print(LCD_STR_BEDTEMP[0]);
lcd.print(itostr3(tHotend)); #if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0
lcd.print('/');
lcd.print(itostr3left(tTarget)); // If we both have a 2nd extruder and a heated bed,
lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); // show the heated bed temp on the left,
if (tTarget < 10) lcd.print(' '); // since the first line is filled with extruder temps
LCD_TEMP(degBed(), degTargetBed(), LCD_STR_BEDTEMP[0]);
#else #else
lcd.setCursor(0,1);
lcd.print('X'); lcd.print('X');
if (axis_known_position[X_AXIS])
lcd.print(ftostr3(current_position[X_AXIS])); lcd.print(ftostr3(current_position[X_AXIS]));
else
lcd_printPGM(PSTR("---"));
lcd_printPGM(PSTR(" Y")); lcd_printPGM(PSTR(" Y"));
if (axis_known_position[Y_AXIS])
lcd.print(ftostr3(current_position[Y_AXIS])); lcd.print(ftostr3(current_position[Y_AXIS]));
else
lcd_printPGM(PSTR("---"));
#endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
#endif // LCD_WIDTH > 19 #endif // LCD_WIDTH >= 20
lcd.setCursor(LCD_WIDTH - 8, 1); lcd.setCursor(LCD_WIDTH - 8, 1);
lcd.print('Z'); lcd.print('Z');
if (axis_known_position[Z_AXIS])
lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001)); lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
else
lcd_printPGM(PSTR("---.--"));
#endif // LCD_HEIGHT > 2 #endif // LCD_HEIGHT > 2
//
// Line 3
//
#if LCD_HEIGHT > 3 #if LCD_HEIGHT > 3
lcd.setCursor(0, 2); lcd.setCursor(0, 2);
@ -570,9 +584,10 @@ static void lcd_implementation_status_screen() {
#endif // LCD_HEIGHT > 3 #endif // LCD_HEIGHT > 3
/** //
* Display Progress Bar, Filament display, and/or Status Message on the last line // Last Line
*/ // Status Message (which may be a Progress Bar or Filament display)
//
lcd.setCursor(0, LCD_HEIGHT - 1); lcd.setCursor(0, LCD_HEIGHT - 1);