Display Filament Sensor data on 20x4 LCD
Changes to support displaying the real-time filament width and the volume factor on a 20x4 LCD. The data is displayed on the 4th line. First the status message is displayed for 5 seconds, and then the filament data is displayed. The status message can be seen by re-selecting the info screen in the menu.
This commit is contained in:
parent
df7c80335a
commit
d84934d8c5
|
@ -773,7 +773,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
|
||||||
*
|
*
|
||||||
* Motherboards
|
* Motherboards
|
||||||
* 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector
|
* 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector
|
||||||
* 81 - Printrboard - Uses Analog input 2 on the Aux 2 connector
|
* 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E)
|
||||||
* 301 - Rambo - uses Analog input 3
|
* 301 - Rambo - uses Analog input 3
|
||||||
* Note may require analog pins to be defined for different motherboards
|
* Note may require analog pins to be defined for different motherboards
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
@ -789,6 +789,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
|
||||||
//defines used in the code
|
//defines used in the code
|
||||||
#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially
|
#define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA //set measured to nominal initially
|
||||||
|
|
||||||
|
//When using an LCD, uncomment the line below to display the Filament sensor data on the last line instead of status. Status will appear for 5 sec.
|
||||||
|
//#define FILAMENT_LCD_DISPLAY
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,12 @@ int absPreheatHPBTemp;
|
||||||
int absPreheatFanSpeed;
|
int absPreheatFanSpeed;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef FILAMENT_LCD_DISPLAY
|
||||||
|
unsigned long message_millis=0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ULTIPANEL
|
#ifdef ULTIPANEL
|
||||||
static float manual_feedrate[] = MANUAL_FEEDRATE;
|
static float manual_feedrate[] = MANUAL_FEEDRATE;
|
||||||
#endif // ULTIPANEL
|
#endif // ULTIPANEL
|
||||||
|
@ -195,6 +201,9 @@ static void lcd_status_screen()
|
||||||
encoderPosition = 0;
|
encoderPosition = 0;
|
||||||
lcd_quick_feedback();
|
lcd_quick_feedback();
|
||||||
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.
|
||||||
|
#ifdef FILAMENT_LCD_DISPLAY
|
||||||
|
message_millis=millis(); //get status message to show up for a while
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ULTIPANEL_FEEDMULTIPLY
|
#ifdef ULTIPANEL_FEEDMULTIPLY
|
||||||
|
@ -1321,6 +1330,9 @@ void lcd_setstatus(const char* message)
|
||||||
return;
|
return;
|
||||||
strncpy(lcd_status_message, message, LCD_WIDTH);
|
strncpy(lcd_status_message, message, LCD_WIDTH);
|
||||||
lcdDrawUpdate = 2;
|
lcdDrawUpdate = 2;
|
||||||
|
#ifdef FILAMENT_LCD_DISPLAY
|
||||||
|
message_millis=millis(); //get status message to show up for a while
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void lcd_setstatuspgm(const char* message)
|
void lcd_setstatuspgm(const char* message)
|
||||||
{
|
{
|
||||||
|
@ -1328,6 +1340,9 @@ void lcd_setstatuspgm(const char* message)
|
||||||
return;
|
return;
|
||||||
strncpy_P(lcd_status_message, message, LCD_WIDTH);
|
strncpy_P(lcd_status_message, message, LCD_WIDTH);
|
||||||
lcdDrawUpdate = 2;
|
lcdDrawUpdate = 2;
|
||||||
|
#ifdef FILAMENT_LCD_DISPLAY
|
||||||
|
message_millis=millis(); //get status message to show up for a while
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void lcd_setalertstatuspgm(const char* message)
|
void lcd_setalertstatuspgm(const char* message)
|
||||||
{
|
{
|
||||||
|
@ -1515,6 +1530,20 @@ char *ftostr32(const float &x)
|
||||||
return conv;
|
return conv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Float to string with 1.23 format
|
||||||
|
char *ftostr12ns(const float &x)
|
||||||
|
{
|
||||||
|
long xx=x*100;
|
||||||
|
|
||||||
|
xx=abs(xx);
|
||||||
|
conv[0]=(xx/100)%10+'0';
|
||||||
|
conv[1]='.';
|
||||||
|
conv[2]=(xx/10)%10+'0';
|
||||||
|
conv[3]=(xx)%10+'0';
|
||||||
|
conv[4]=0;
|
||||||
|
return conv;
|
||||||
|
}
|
||||||
|
|
||||||
char *itostr31(const int &xx)
|
char *itostr31(const int &xx)
|
||||||
{
|
{
|
||||||
conv[0]=(xx>=0)?'+':'-';
|
conv[0]=(xx>=0)?'+':'-';
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
extern int absPreheatFanSpeed;
|
extern int absPreheatFanSpeed;
|
||||||
|
|
||||||
extern bool cancel_heatup;
|
extern bool cancel_heatup;
|
||||||
|
|
||||||
|
#ifdef FILAMENT_LCD_DISPLAY
|
||||||
|
extern unsigned long message_millis;
|
||||||
|
#endif
|
||||||
|
|
||||||
void lcd_buzz(long duration,uint16_t freq);
|
void lcd_buzz(long duration,uint16_t freq);
|
||||||
bool lcd_clicked();
|
bool lcd_clicked();
|
||||||
|
@ -109,6 +113,7 @@ char *ftostr3(const float &x);
|
||||||
char *ftostr31ns(const float &x); // float to string without sign character
|
char *ftostr31ns(const float &x); // float to string without sign character
|
||||||
char *ftostr31(const float &x);
|
char *ftostr31(const float &x);
|
||||||
char *ftostr32(const float &x);
|
char *ftostr32(const float &x);
|
||||||
|
char *ftostr12ns(const float &x);
|
||||||
char *ftostr5(const float &x);
|
char *ftostr5(const float &x);
|
||||||
char *ftostr51(const float &x);
|
char *ftostr51(const float &x);
|
||||||
char *ftostr52(const float &x);
|
char *ftostr52(const float &x);
|
||||||
|
|
|
@ -499,9 +499,23 @@ static void lcd_implementation_status_screen()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Status message line on the last line
|
//Display both Status message line and Filament display on the last line
|
||||||
|
#ifdef FILAMENT_LCD_DISPLAY
|
||||||
|
if(message_millis+5000>millis()){ //display any status for the first 5 sec after screen is initiated
|
||||||
|
lcd.setCursor(0, LCD_HEIGHT - 1);
|
||||||
|
lcd.print(lcd_status_message);
|
||||||
|
} else {
|
||||||
|
lcd.setCursor(0,LCD_HEIGHT - 1);
|
||||||
|
lcd_printPGM(PSTR("Dia "));
|
||||||
|
lcd.print(ftostr12ns(filament_width_meas));
|
||||||
|
lcd_printPGM(PSTR(" V"));
|
||||||
|
lcd.print(itostr3(100.0*volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
|
||||||
|
lcd.print('%');
|
||||||
|
}
|
||||||
|
#else
|
||||||
lcd.setCursor(0, LCD_HEIGHT - 1);
|
lcd.setCursor(0, LCD_HEIGHT - 1);
|
||||||
lcd.print(lcd_status_message);
|
lcd.print(lcd_status_message);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
|
static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue