Merge pull request #1141 from filipmu/Filament-Sensor

Display filament sensor data on a 20x4 LCD or Graphical LCD
master
Bo Herrmannsen 10 years ago
commit 91d740e128

@ -773,7 +773,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
*
* Motherboards
* 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
* Note may require analog pins to be defined for different motherboards
**********************************************************************/
@ -791,6 +791,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
//defines used in the code
#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

@ -328,7 +328,21 @@ static void lcd_implementation_status_screen()
// Status line
u8g.setFont(FONT_STATUSMENU);
u8g.setPrintPos(0,61);
#ifndef FILAMENT_LCD_DISPLAY
u8g.print(lcd_status_message);
#else
if(message_millis+5000>millis()){ //Display both Status message line and Filament display on the last line
u8g.print(lcd_status_message);
}
else
{
lcd_printPGM(PSTR("dia:"));
u8g.print(ftostr12ns(filament_width_meas));
lcd_printPGM(PSTR(" factor:"));
u8g.print(itostr3(extrudemultiply));
u8g.print('%');
}
#endif
}

@ -20,6 +20,12 @@ int absPreheatHPBTemp;
int absPreheatFanSpeed;
#ifdef FILAMENT_LCD_DISPLAY
unsigned long message_millis=0;
#endif
#ifdef ULTIPANEL
static float manual_feedrate[] = MANUAL_FEEDRATE;
#endif // ULTIPANEL
@ -216,6 +222,9 @@ static void lcd_status_screen()
encoderPosition = 0;
lcd_quick_feedback();
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
@ -1355,6 +1364,9 @@ void lcd_setstatus(const char* message)
return;
strncpy(lcd_status_message, message, LCD_WIDTH);
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)
{
@ -1362,6 +1374,9 @@ void lcd_setstatuspgm(const char* message)
return;
strncpy_P(lcd_status_message, message, LCD_WIDTH);
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)
{
@ -1549,6 +1564,20 @@ char *ftostr32(const float &x)
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)
{
conv[0]=(xx>=0)?'+':'-';

@ -45,6 +45,10 @@
extern bool cancel_heatup;
#ifdef FILAMENT_LCD_DISPLAY
extern unsigned long message_millis;
#endif
void lcd_buzz(long duration,uint16_t freq);
bool lcd_clicked();
@ -111,6 +115,7 @@ char *ftostr3(const float &x);
char *ftostr31ns(const float &x); // float to string without sign character
char *ftostr31(const float &x);
char *ftostr32(const float &x);
char *ftostr12ns(const float &x);
char *ftostr5(const float &x);
char *ftostr51(const float &x);
char *ftostr52(const float &x);

@ -499,9 +499,23 @@ static void lcd_implementation_status_screen()
}
#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.print(lcd_status_message);
#endif
}
static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
{

@ -54,6 +54,7 @@ Features:
* Automatic operation of extruder/cold-end cooling fans based on nozzle temperature
* RC Servo Support, specify angle or duration for continuous rotation servos.
* Bed Auto Leveling.
* Support for a filament diameter sensor, which adjusts extrusion volume
The default baudrate is 250000. This baudrate has less jitter and hence errors than the usual 115200 baud, but is less supported by drivers and host-environments.
@ -392,6 +393,13 @@ For example, suppose you measured the endstop position and it was 20mm to the ri
That's it.. enjoy never having to calibrate your Z endstop neither leveling your bed by hand anymore ;-)
Filament Sensor
---------------
Supports the use of a real time filament diameter sensor that measures the diameter of the filament going into the extruder and then adjusts the extrusion rate to compensate for filament that does not match what is defined in the g-code. The diameter can also be displayed on the LCD screen. This potentially eliminates the need to measure filament diameter when changing spools of filament. Gcode becomes independent of the filament diameter. Can also compensate for changing diameter.
For examples of these sensors, see: http://www.thingiverse.com/thing:454584, https://www.youmagine.com/designs/filament-diameter-sensor, http://diy3dprinting.blogspot.com/2014/01/diy-filament-diameter-sensor.html. Any sensor which produces a voltage equivalent to the diameter in mm (i.e. 1v = 1mm) can be used. This provides a very simple interface and may encourage more innovation in this area.
4 new Mcodes are defined to set relevant parameters: M404, M405, M406, M407 - see above.
Implements a delay buffer to handle the transit delay between where the filament is measured and when it gets to the extruder.

Loading…
Cancel
Save