Show filament width sensor values in LCD constantly if SD card support is not enabled.

master
Remo Kallio 8 years ago committed by Scott Lahteine
parent d8724bb546
commit d38b1bc4b1

@ -224,6 +224,10 @@
#define LCD_STR_SPECIAL_MAX '\x09' #define LCD_STR_SPECIAL_MAX '\x09'
// Maximum here is 0x1f because 0x20 is ' ' (space) and the normal charsets begin. // Maximum here is 0x1f because 0x20 is ' ' (space) and the normal charsets begin.
// Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here. // Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
// Symbol characters
#define LCD_STR_FILAM_DIA "\xf8"
#define LCD_STR_FILAM_MUL "\xa4"
#else #else
/* Custom characters defined in the first 8 characters of the LCD */ /* Custom characters defined in the first 8 characters of the LCD */
#define LCD_STR_BEDTEMP "\x00" // Print only as a char. This will have 'unexpected' results when used in a string! #define LCD_STR_BEDTEMP "\x00" // Print only as a char. This will have 'unexpected' results when used in a string!

@ -47,7 +47,7 @@ extern float zprobe_zoffset;
int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2]; int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
#if ENABLED(FILAMENT_LCD_DISPLAY) #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
millis_t previous_lcd_status_ms = 0; millis_t previous_lcd_status_ms = 0;
#endif #endif
@ -547,7 +547,7 @@ void lcd_status_screen() {
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
if (lcd_clicked) { if (lcd_clicked) {
#if ENABLED(FILAMENT_LCD_DISPLAY) #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
previous_lcd_status_ms = millis(); // get status message to show up for a while previous_lcd_status_ms = millis(); // get status message to show up for a while
#endif #endif
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
@ -3456,7 +3456,7 @@ void lcd_finishstatus(bool persist=false) {
#endif #endif
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
#if ENABLED(FILAMENT_LCD_DISPLAY) #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
previous_lcd_status_ms = millis(); //get status message to show up for a while previous_lcd_status_ms = millis(); //get status message to show up for a while
#endif #endif
} }

@ -93,7 +93,7 @@
#endif #endif
#if ENABLED(FILAMENT_LCD_DISPLAY) #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
extern millis_t previous_lcd_status_ms; extern millis_t previous_lcd_status_ms;
#endif #endif

@ -535,12 +535,19 @@ static void lcd_implementation_status_screen() {
// When everything is ok you see a constant 'X'. // When everything is ok you see a constant 'X'.
static char xstring[5], ystring[5], zstring[7]; static char xstring[5], ystring[5], zstring[7];
#if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
static char wstring[5], mstring[4];
#endif
// At the first page, regenerate the XYZ strings // At the first page, regenerate the XYZ strings
if (page.page == 0) { if (page.page == 0) {
strcpy(xstring, ftostr4sign(current_position[X_AXIS])); strcpy(xstring, ftostr4sign(current_position[X_AXIS]));
strcpy(ystring, ftostr4sign(current_position[Y_AXIS])); strcpy(ystring, ftostr4sign(current_position[Y_AXIS]));
strcpy(zstring, ftostr52sp(current_position[Z_AXIS] + 0.00001)); strcpy(zstring, ftostr52sp(current_position[Z_AXIS] + 0.00001));
#if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
strcpy(wstring, ftostr12ns(filament_width_meas));
strcpy(mstring, itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
#endif
} }
if (PAGE_CONTAINS(XYZ_FRAME_TOP, XYZ_FRAME_TOP + XYZ_FRAME_HEIGHT - 1)) { if (PAGE_CONTAINS(XYZ_FRAME_TOP, XYZ_FRAME_TOP + XYZ_FRAME_HEIGHT - 1)) {
@ -591,6 +598,22 @@ static void lcd_implementation_status_screen() {
u8g.setPrintPos(12, 50); u8g.setPrintPos(12, 50);
lcd_print(itostr3(feedrate_percentage)); lcd_print(itostr3(feedrate_percentage));
u8g.print('%'); u8g.print('%');
//
// Filament sensor display if SD is disabled
//
#if DISABLED(SDSUPPORT) && ENABLED(FILAMENT_LCD_DISPLAY)
u8g.setPrintPos(56, 50);
lcd_print(wstring);
u8g.setPrintPos(102, 50);
lcd_print(mstring);
u8g.print('%');
lcd_setFont(FONT_MENU);
u8g.setPrintPos(47, 50);
lcd_print(LCD_STR_FILAM_DIA);
u8g.setPrintPos(93, 50);
lcd_print(LCD_STR_FILAM_MUL);
#endif
} }
// //
@ -602,19 +625,21 @@ static void lcd_implementation_status_screen() {
if (PAGE_CONTAINS(STATUS_BASELINE + 1 - INFO_FONT_HEIGHT, STATUS_BASELINE)) { if (PAGE_CONTAINS(STATUS_BASELINE + 1 - INFO_FONT_HEIGHT, STATUS_BASELINE)) {
u8g.setPrintPos(0, STATUS_BASELINE); u8g.setPrintPos(0, STATUS_BASELINE);
#if DISABLED(FILAMENT_LCD_DISPLAY) #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
lcd_print(lcd_status_message);
#else
if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) { //Display both Status message line and Filament display on the last line if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) { //Display both Status message line and Filament display on the last line
lcd_print(lcd_status_message); lcd_print(lcd_status_message);
} }
else { else {
lcd_printPGM(PSTR("dia:")); lcd_printPGM(PSTR(LCD_STR_FILAM_DIA));
u8g.print(':');
lcd_print(ftostr12ns(filament_width_meas)); lcd_print(ftostr12ns(filament_width_meas));
lcd_printPGM(PSTR(" factor:")); lcd_printPGM(PSTR(" " LCD_STR_FILAM_MUL));
u8g.print(':');
lcd_print(itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM])); lcd_print(itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
u8g.print('%'); u8g.print('%');
} }
#else
lcd_print(lcd_status_message);
#endif #endif
} }
} }

@ -396,7 +396,7 @@ void lcd_print(char c) { charset_mapper(c); }
void lcd_erase_line(const int line) { void lcd_erase_line(const int line) {
lcd.setCursor(0, line); lcd.setCursor(0, line);
for (uint8_t i = LCD_WIDTH + 1; --i;) for (uint8_t i = LCD_WIDTH + 1; --i;)
lcd_print(' '); lcd.print(' ');
} }
// Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
@ -775,14 +775,12 @@ static void lcd_implementation_status_screen() {
#if ENABLED(LCD_PROGRESS_BAR) #if ENABLED(LCD_PROGRESS_BAR)
if (card.isFileOpen()) {
// Draw the progress bar if the message has shown long enough // Draw the progress bar if the message has shown long enough
// or if there is no message set. // or if there is no message set.
if (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0]) if (card.isFileOpen() && ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0])
return lcd_draw_progress_bar(card.percentDone()); return lcd_draw_progress_bar(card.percentDone());
} //card.isFileOpen
#elif ENABLED(FILAMENT_LCD_DISPLAY) #elif ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
// Show Filament Diameter and Volumetric Multiplier % // Show Filament Diameter and Volumetric Multiplier %
// After allowing lcd_status_message to show for 5 seconds // After allowing lcd_status_message to show for 5 seconds
@ -795,7 +793,7 @@ static void lcd_implementation_status_screen() {
return; return;
} }
#endif // FILAMENT_LCD_DISPLAY #endif // FILAMENT_LCD_DISPLAY && SDSUPPORT
lcd_print(lcd_status_message); lcd_print(lcd_status_message);
} }

Loading…
Cancel
Save