Browse Source

LCD Progress Bar

Scott Lahteine 10 years ago
parent
commit
2f467e2797

+ 15
- 1
Marlin/Configuration_adv.h View File

@@ -297,6 +297,20 @@
297 297
 // using:
298 298
 //#define MENU_ADDAUTOSTART
299 299
 
300
+// Show a progress bar on the LCD when printing from SD?
301
+//#define LCD_PROGRESS_BAR
302
+
303
+#ifdef LCD_PROGRESS_BAR
304
+  // Amount of time (ms) to show the bar
305
+  #define PROGRESS_BAR_BAR_TIME 2000
306
+  // Amount of time (ms) to show the status message
307
+  #define PROGRESS_BAR_MSG_TIME 3000
308
+  // Amount of time (ms) to retain the status message (0=forever)
309
+  #define PROGRESS_MSG_EXPIRE   0
310
+  // Enable this to show messages for MSG_TIME then hide them
311
+  //#define PROGRESS_MSG_ONCE
312
+#endif
313
+
300 314
 // The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
301 315
 //#define USE_WATCHDOG
302 316
 
@@ -332,7 +346,7 @@
332 346
 
333 347
 // extruder advance constant (s2/mm3)
334 348
 //
335
-// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
349
+// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2
336 350
 //
337 351
 // Hooke's law says:		force = k * distance
338 352
 // Bernoulli's principle says:	v ^ 2 / 2 + g . h + pressure / density = constant

+ 33
- 0
Marlin/example_configurations/SCARA/Configuration.h View File

@@ -756,6 +756,39 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
756 756
 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
757 757
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
758 758
 
759
+/**********************************************************************\
760
+ * Support for a filament diameter sensor
761
+ * Also allows adjustment of diameter at print time (vs  at slicing)
762
+ * Single extruder only at this point (extruder 0)
763
+ * 
764
+ * Motherboards
765
+ * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector 
766
+ * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E)
767
+ * 301 - Rambo  - uses Analog input 3
768
+ * Note may require analog pins to be defined for different motherboards
769
+ **********************************************************************/
770
+// Uncomment below to enable
771
+//#define FILAMENT_SENSOR
772
+
773
+#define FILAMENT_SENSOR_EXTRUDER_NUM  0  //The number of the extruder that has the filament sensor (0,1,2)
774
+#define MEASUREMENT_DELAY_CM      14  //measurement delay in cm.  This is the distance from filament sensor to middle of barrel
775
+
776
+#define DEFAULT_NOMINAL_FILAMENT_DIA  3.0  //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software.  Used for sensor reading validation
777
+#define MEASURED_UPPER_LIMIT          3.30  //upper limit factor used for sensor reading validation in mm
778
+#define MEASURED_LOWER_LIMIT          1.90  //lower limit factor for sensor reading validation in mm
779
+#define MAX_MEASUREMENT_DELAY     20  //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM  and lower number saves RAM)
780
+
781
+//defines used in the code
782
+#define DEFAULT_MEASURED_FILAMENT_DIA  DEFAULT_NOMINAL_FILAMENT_DIA  //set measured to nominal initially 
783
+
784
+//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.
785
+//#define FILAMENT_LCD_DISPLAY
786
+
787
+
788
+
789
+
790
+
791
+
759 792
 #include "Configuration_adv.h"
760 793
 #include "thermistortables.h"
761 794
 

+ 15
- 1
Marlin/example_configurations/SCARA/Configuration_adv.h View File

@@ -300,6 +300,20 @@
300 300
 // using:
301 301
 //#define MENU_ADDAUTOSTART
302 302
 
303
+// Show a progress bar on the LCD when printing from SD?
304
+//#define LCD_PROGRESS_BAR
305
+
306
+#ifdef LCD_PROGRESS_BAR
307
+  // Amount of time (ms) to show the bar
308
+  #define PROGRESS_BAR_BAR_TIME 2000
309
+  // Amount of time (ms) to show the status message
310
+  #define PROGRESS_BAR_MSG_TIME 3000
311
+  // Amount of time (ms) to retain the status message (0=forever)
312
+  #define PROGRESS_MSG_EXPIRE   0
313
+  // Enable this to show messages for MSG_TIME then hide them
314
+  //#define PROGRESS_MSG_ONCE
315
+#endif
316
+
303 317
 // The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
304 318
 //#define USE_WATCHDOG
305 319
 
@@ -340,7 +354,7 @@
340 354
 
341 355
 // extruder advance constant (s2/mm3)
342 356
 //
343
-// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
357
+// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2
344 358
 //
345 359
 // Hooke's law says:		force = k * distance
346 360
 // Bernoulli's principle says:	v ^ 2 / 2 + g . h + pressure / density = constant

+ 10
- 5
Marlin/example_configurations/delta/Configuration.h View File

@@ -758,22 +758,27 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
758 758
  * 
759 759
  * Motherboards
760 760
  * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector 
761
- * 81 - Printrboard - Uses Analog input 2 on the Aux 2 connector
761
+ * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E)
762 762
  * 301 - Rambo  - uses Analog input 3
763 763
  * Note may require analog pins to be defined for different motherboards
764 764
  **********************************************************************/
765
-#define FILAMENT_SENSOR
766
-#define FILAMENT_SENSOR_EXTRUDER_NUM	0  //The number of the extruder that has the filament sensor (0,1,2)
767
-#define MEASUREMENT_DELAY_CM			14  //measurement delay in cm.  This is the distance from filament sensor to middle of barrel
765
+// Uncomment below to enable
766
+//#define FILAMENT_SENSOR
767
+
768
+#define FILAMENT_SENSOR_EXTRUDER_NUM  0  //The number of the extruder that has the filament sensor (0,1,2)
769
+#define MEASUREMENT_DELAY_CM      14  //measurement delay in cm.  This is the distance from filament sensor to middle of barrel
768 770
 
769 771
 #define DEFAULT_NOMINAL_FILAMENT_DIA  3.0  //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software.  Used for sensor reading validation
770 772
 #define MEASURED_UPPER_LIMIT          3.30  //upper limit factor used for sensor reading validation in mm
771 773
 #define MEASURED_LOWER_LIMIT          1.90  //lower limit factor for sensor reading validation in mm
772
-#define MAX_MEASUREMENT_DELAY			20  //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM  and lower number saves RAM)
774
+#define MAX_MEASUREMENT_DELAY     20  //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM  and lower number saves RAM)
773 775
 
774 776
 //defines used in the code
775 777
 #define DEFAULT_MEASURED_FILAMENT_DIA  DEFAULT_NOMINAL_FILAMENT_DIA  //set measured to nominal initially 
776 778
 
779
+//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.
780
+//#define FILAMENT_LCD_DISPLAY
781
+
777 782
 
778 783
 
779 784
 

+ 16
- 2
Marlin/example_configurations/delta/Configuration_adv.h View File

@@ -292,6 +292,20 @@
292 292
 // using:
293 293
 //#define MENU_ADDAUTOSTART
294 294
 
295
+// Show a progress bar on the LCD when printing from SD
296
+//#define LCD_PROGRESS_BAR
297
+
298
+#ifdef LCD_PROGRESS_BAR
299
+  // Amount of time (ms) to show the bar
300
+  #define PROGRESS_BAR_BAR_TIME 2000
301
+  // Amount of time (ms) to show the status message
302
+  #define PROGRESS_BAR_MSG_TIME 2000
303
+  // Amount of time (ms) to retain the status message (0=forever)
304
+  #define PROGRESS_MSG_EXPIRE   0
305
+  // Enable this to show messages for MSG_TIME then hide them
306
+  //#define PROGRESS_MSG_ONCE
307
+#endif
308
+
295 309
 // The hardware watchdog should reset the Microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
296 310
 //#define USE_WATCHDOG
297 311
 
@@ -327,10 +341,10 @@
327 341
 
328 342
 // extruder advance constant (s2/mm3)
329 343
 //
330
-// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
344
+// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2
331 345
 //
332 346
 // hooke's law says:		force = k * distance
333
-// bernoulli's priniciple says:	v ^ 2 / 2 + g . h + pressure / density = constant
347
+// Bernoulli's principle says:	v ^ 2 / 2 + g . h + pressure / density = constant
334 348
 // so: v ^ 2 is proportional to number of steps we advance the extruder
335 349
 //#define ADVANCE
336 350
 

+ 85
- 5
Marlin/example_configurations/makibox/Configuration.h View File

@@ -14,6 +14,13 @@
14 14
 // example_configurations/delta directory.
15 15
 //
16 16
 
17
+//===========================================================================
18
+//============================= SCARA Printer ===============================
19
+//===========================================================================
20
+// For a Delta printer replace the configuration files with the files in the
21
+// example_configurations/SCARA directory.
22
+//
23
+
17 24
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
18 25
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
19 26
 // build by the user have been successfully uploaded into firmware.
@@ -26,7 +33,6 @@
26 33
 #define SERIAL_PORT 0
27 34
 
28 35
 // This determines the communication speed of the printer
29
-// This determines the communication speed of the printer
30 36
 #define BAUDRATE 250000
31 37
 
32 38
 // This enables the serial port associated to the Bluetooth interface
@@ -80,6 +86,7 @@
80 86
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
81 87
 // 11 is 100k beta 3950 1% thermistor (4.7k pullup)
82 88
 // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
89
+// 13 is 100k Hisens 3950  1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" 
83 90
 // 20 is the PT100 circuit found in the Ultimainboard V2.x
84 91
 // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
85 92
 //
@@ -145,7 +152,7 @@
145 152
                                   // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
146 153
   #define PID_INTEGRAL_DRIVE_MAX 255  //limit for the integral term
147 154
   #define K1 0.95 //smoothing factor within the PID
148
-  #define PID_dT ((OVERSAMPLENR * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
155
+  #define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
149 156
 
150 157
 // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
151 158
 // Ultimaker
@@ -214,6 +221,44 @@
214 221
 #define EXTRUDE_MINTEMP 170
215 222
 #define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.
216 223
 
224
+/*================== Thermal Runaway Protection ==============================
225
+This is a feature to protect your printer from burn up in flames if it has
226
+a thermistor coming off place (this happened to a friend of mine recently and
227
+motivated me writing this feature).
228
+
229
+The issue: If a thermistor come off, it will read a lower temperature than actual.
230
+The system will turn the heater on forever, burning up the filament and anything
231
+else around.
232
+
233
+After the temperature reaches the target for the first time, this feature will 
234
+start measuring for how long the current temperature stays below the target 
235
+minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS).
236
+
237
+If it stays longer than _PERIOD, it means the thermistor temperature
238
+cannot catch up with the target, so something *may be* wrong. Then, to be on the
239
+safe side, the system will he halt.
240
+
241
+Bear in mind the count down will just start AFTER the first time the 
242
+thermistor temperature is over the target, so you will have no problem if
243
+your extruder heater takes 2 minutes to hit the target on heating.
244
+
245
+*/
246
+// If you want to enable this feature for all your extruder heaters,
247
+// uncomment the 2 defines below:
248
+
249
+// Parameters for all extruder heaters
250
+//#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 //in seconds
251
+//#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
252
+
253
+// If you want to enable this feature for your bed heater,
254
+// uncomment the 2 defines below:
255
+
256
+// Parameters for the bed heater
257
+//#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 //in seconds
258
+//#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
259
+//===========================================================================
260
+
261
+
217 262
 //===========================================================================
218 263
 //=============================Mechanical Settings===========================
219 264
 //===========================================================================
@@ -269,6 +314,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
269 314
 #define DISABLE_Y false
270 315
 #define DISABLE_Z false
271 316
 #define DISABLE_E false // For all extruders
317
+#define DISABLE_INACTIVE_EXTRUDER true //disable only inactive extruders and keep active extruder enabled
272 318
 
273 319
 #define INVERT_X_DIR false    // for Mendel set to false, for Orca set to true
274 320
 #define INVERT_Y_DIR false    // for Mendel set to true, for Orca set to false
@@ -300,6 +346,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
300 346
 //============================= Bed Auto Leveling ===========================
301 347
 
302 348
 //#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line)
349
+#define Z_PROBE_REPEATABILITY_TEST  // If not commented out, Z-Probe Repeatability test will be included if Auto Bed Leveling is Enabled.
303 350
 
304 351
 #ifdef ENABLE_AUTO_BED_LEVELING
305 352
 
@@ -360,6 +407,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
360 407
   #define Z_RAISE_BEFORE_PROBING 15    //How much the extruder will be raised before traveling to the first probing point.
361 408
   #define Z_RAISE_BETWEEN_PROBINGS 5  //How much the extruder will be raised when traveling from between next probing points
362 409
 
410
+  //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell
411
+  //#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like.
363 412
 
364 413
   //If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
365 414
   //The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
@@ -461,6 +510,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
461 510
 //#define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
462 511
 #define SDSUPPORT // Enable SD Card Support in Hardware Console
463 512
 #define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
513
+//#define SD_CHECK_AND_RETRY // Use CRC checks and retries on the SD communication
464 514
 //#define ENCODER_PULSES_PER_STEP 1 // Increase if you have a high resolution encoder
465 515
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
466 516
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
@@ -675,12 +725,42 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
675 725
 // This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
676 726
 // Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500.
677 727
 //
678
-
679
-#define DIGIPOT_I2C
680
-
681 728
 //#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
682 729
 //#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
683 730
 
731
+/**********************************************************************\
732
+ * Support for a filament diameter sensor
733
+ * Also allows adjustment of diameter at print time (vs  at slicing)
734
+ * Single extruder only at this point (extruder 0)
735
+ * 
736
+ * Motherboards
737
+ * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector 
738
+ * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E)
739
+ * 301 - Rambo  - uses Analog input 3
740
+ * Note may require analog pins to be defined for different motherboards
741
+ **********************************************************************/
742
+// Uncomment below to enable
743
+//#define FILAMENT_SENSOR
744
+
745
+#define FILAMENT_SENSOR_EXTRUDER_NUM	0  //The number of the extruder that has the filament sensor (0,1,2)
746
+#define MEASUREMENT_DELAY_CM			14  //measurement delay in cm.  This is the distance from filament sensor to middle of barrel
747
+
748
+#define DEFAULT_NOMINAL_FILAMENT_DIA  3.0  //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software.  Used for sensor reading validation
749
+#define MEASURED_UPPER_LIMIT          3.30  //upper limit factor used for sensor reading validation in mm
750
+#define MEASURED_LOWER_LIMIT          1.90  //lower limit factor for sensor reading validation in mm
751
+#define MAX_MEASUREMENT_DELAY			20  //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM  and lower number saves RAM)
752
+
753
+//defines used in the code
754
+#define DEFAULT_MEASURED_FILAMENT_DIA  DEFAULT_NOMINAL_FILAMENT_DIA  //set measured to nominal initially 
755
+
756
+//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.
757
+//#define FILAMENT_LCD_DISPLAY
758
+
759
+
760
+
761
+
762
+
763
+
684 764
 #include "Configuration_adv.h"
685 765
 #include "thermistortables.h"
686 766
 

+ 15
- 1
Marlin/example_configurations/makibox/Configuration_adv.h View File

@@ -296,6 +296,20 @@
296 296
 // using:
297 297
 //#define MENU_ADDAUTOSTART
298 298
 
299
+// Show a progress bar on the LCD when printing from SD
300
+//#define LCD_PROGRESS_BAR
301
+
302
+#ifdef LCD_PROGRESS_BAR
303
+  // Amount of time (ms) to show the bar
304
+  #define PROGRESS_BAR_BAR_TIME 2000
305
+  // Amount of time (ms) to show the status message
306
+  #define PROGRESS_BAR_MSG_TIME 2000
307
+  // Amount of time (ms) to retain the status message (0=forever)
308
+  #define PROGRESS_MSG_EXPIRE   0
309
+  // Enable this to show messages for MSG_TIME then hide them
310
+  //#define PROGRESS_MSG_ONCE
311
+#endif
312
+
299 313
 // The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
300 314
 //#define USE_WATCHDOG
301 315
 
@@ -331,7 +345,7 @@
331 345
 
332 346
 // extruder advance constant (s2/mm3)
333 347
 //
334
-// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
348
+// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2
335 349
 //
336 350
 // Hooke's law says:		force = k * distance
337 351
 // Bernoulli's principle says:	v ^ 2 / 2 + g . h + pressure / density = constant

+ 6
- 4
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

@@ -749,24 +749,26 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
749 749
  * 
750 750
  * Motherboards
751 751
  * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector 
752
- * 81 - Printrboard - Uses Analog input 2 on the Aux 2 connector
752
+ * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E)
753 753
  * 301 - Rambo  - uses Analog input 3
754 754
  * Note may require analog pins to be defined for different motherboards
755 755
  **********************************************************************/
756 756
 // Uncomment below to enable
757 757
 //#define FILAMENT_SENSOR
758 758
 
759
-#define FILAMENT_SENSOR_EXTRUDER_NUM	0  //The number of the extruder that has the filament sensor (0,1,2)
760
-#define MEASUREMENT_DELAY_CM			14  //measurement delay in cm.  This is the distance from filament sensor to middle of barrel
759
+#define FILAMENT_SENSOR_EXTRUDER_NUM  0  //The number of the extruder that has the filament sensor (0,1,2)
760
+#define MEASUREMENT_DELAY_CM      14  //measurement delay in cm.  This is the distance from filament sensor to middle of barrel
761 761
 
762 762
 #define DEFAULT_NOMINAL_FILAMENT_DIA  3.0  //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software.  Used for sensor reading validation
763 763
 #define MEASURED_UPPER_LIMIT          3.30  //upper limit factor used for sensor reading validation in mm
764 764
 #define MEASURED_LOWER_LIMIT          1.90  //lower limit factor for sensor reading validation in mm
765
-#define MAX_MEASUREMENT_DELAY			20  //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM  and lower number saves RAM)
765
+#define MAX_MEASUREMENT_DELAY     20  //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM  and lower number saves RAM)
766 766
 
767 767
 //defines used in the code
768 768
 #define DEFAULT_MEASURED_FILAMENT_DIA  DEFAULT_NOMINAL_FILAMENT_DIA  //set measured to nominal initially 
769 769
 
770
+//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.
771
+//#define FILAMENT_LCD_DISPLAY
770 772
 
771 773
 
772 774
 

+ 15
- 1
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

@@ -297,6 +297,20 @@
297 297
 // using:
298 298
 //#define MENU_ADDAUTOSTART
299 299
 
300
+// Show a progress bar on the LCD when printing from SD?
301
+//#define LCD_PROGRESS_BAR
302
+
303
+#ifdef LCD_PROGRESS_BAR
304
+  // Amount of time (ms) to show the bar
305
+  #define PROGRESS_BAR_BAR_TIME 2000
306
+  // Amount of time (ms) to show the status message
307
+  #define PROGRESS_BAR_MSG_TIME 3000
308
+  // Amount of time (ms) to retain the status message (0=forever)
309
+  #define PROGRESS_MSG_EXPIRE   0
310
+  // Enable this to show messages for MSG_TIME then hide them
311
+  //#define PROGRESS_MSG_ONCE
312
+#endif
313
+
300 314
 // The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
301 315
 //#define USE_WATCHDOG
302 316
 
@@ -332,7 +346,7 @@
332 346
 
333 347
 // extruder advance constant (s2/mm3)
334 348
 //
335
-// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
349
+// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2
336 350
 //
337 351
 // Hooke's law says:		force = k * distance
338 352
 // Bernoulli's principle says:	v ^ 2 / 2 + g . h + pressure / density = constant

+ 91
- 57
Marlin/ultralcd.cpp View File

@@ -19,15 +19,12 @@ int absPreheatHotendTemp;
19 19
 int absPreheatHPBTemp;
20 20
 int absPreheatFanSpeed;
21 21
 
22
-
23 22
 #ifdef FILAMENT_LCD_DISPLAY
24
-unsigned long message_millis=0;
23
+  unsigned long message_millis = 0;
25 24
 #endif
26 25
 
27
-
28
-
29 26
 #ifdef ULTIPANEL
30
-static float manual_feedrate[] = MANUAL_FEEDRATE;
27
+  static float manual_feedrate[] = MANUAL_FEEDRATE;
31 28
 #endif // ULTIPANEL
32 29
 
33 30
 /* !Configuration settings */
@@ -163,7 +160,7 @@ uint32_t encoderPosition;
163 160
 #if (SDCARDDETECT > 0)
164 161
 bool lcd_oldcardstatus;
165 162
 #endif
166
-#endif//ULTIPANEL
163
+#endif //ULTIPANEL
167 164
 
168 165
 menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */
169 166
 uint32_t lcd_next_update_millis;
@@ -189,12 +186,45 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool
189 186
     currentMenu = menu;
190 187
     encoderPosition = encoder;
191 188
     if (feedback) lcd_quick_feedback();
189
+
190
+    // For LCD_PROGRESS_BAR re-initialize the custom characters
191
+    #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
192
+      lcd_set_custom_characters(menu == lcd_status_screen);
193
+    #endif
192 194
   }
193 195
 }
194 196
 
195 197
 /* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */
196 198
 static void lcd_status_screen()
197 199
 {
200
+  #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
201
+    uint16_t mil = millis();
202
+    #ifndef PROGRESS_MSG_ONCE
203
+      if (mil > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
204
+        progressBarTick = mil;
205
+      }
206
+    #endif
207
+    #if PROGRESS_MSG_EXPIRE > 0
208
+      // keep the message alive if paused, count down otherwise
209
+      if (messageTick > 0) {
210
+        if (card.isFileOpen()) {
211
+          if (IS_SD_PRINTING) {
212
+            if ((mil-messageTick) >= PROGRESS_MSG_EXPIRE) {
213
+              lcd_status_message[0] = '\0';
214
+              messageTick = 0;
215
+            }
216
+          }
217
+          else {
218
+            messageTick += LCD_UPDATE_INTERVAL;
219
+          }
220
+        }
221
+        else {
222
+          messageTick = 0;
223
+        }
224
+      }
225
+    #endif
226
+  #endif //LCD_PROGRESS_BAR
227
+
198 228
     if (lcd_status_update_delay)
199 229
         lcd_status_update_delay--;
200 230
     else
@@ -227,10 +257,14 @@ static void lcd_status_screen()
227 257
     if (current_click)
228 258
     {
229 259
         lcd_goto_menu(lcd_main_menu);
230
-        lcd_implementation_init(); // to maybe revive the LCD if static electricity killed it.
231
-#ifdef FILAMENT_LCD_DISPLAY
232
-        message_millis=millis();  //get status message to show up for a while
233
-#endif
260
+        lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
261
+          #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
262
+            currentMenu == lcd_status_screen
263
+          #endif
264
+        );
265
+        #ifdef FILAMENT_LCD_DISPLAY
266
+          message_millis = millis();  // get status message to show up for a while
267
+        #endif
234 268
     }
235 269
 
236 270
 #ifdef ULTIPANEL_FEEDMULTIPLY
@@ -257,28 +291,22 @@ static void lcd_status_screen()
257 291
         feedmultiply += int(encoderPosition);
258 292
         encoderPosition = 0;
259 293
     }
260
-#endif//ULTIPANEL_FEEDMULTIPLY
294
+#endif //ULTIPANEL_FEEDMULTIPLY
261 295
 
262 296
     if (feedmultiply < 10)
263 297
         feedmultiply = 10;
264 298
     else if (feedmultiply > 999)
265 299
         feedmultiply = 999;
266
-#endif//ULTIPANEL
300
+#endif //ULTIPANEL
267 301
 }
268 302
 
269 303
 #ifdef ULTIPANEL
270
-static void lcd_return_to_status()
271
-{
272
-    lcd_goto_menu(lcd_status_screen, 0, false);
273
-}
274
-static void lcd_sdcard_pause()
275
-{
276
-    card.pauseSDPrint();
277
-}
278
-static void lcd_sdcard_resume()
279
-{
280
-    card.startFileprint();
281
-}
304
+
305
+static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen, 0, false); }
306
+
307
+static void lcd_sdcard_pause() { card.pauseSDPrint(); }
308
+
309
+static void lcd_sdcard_resume() { card.startFileprint(); }
282 310
 
283 311
 static void lcd_sdcard_stop()
284 312
 {
@@ -918,10 +946,8 @@ void lcd_sdcard_menu()
918 946
 #define menu_edit_type(_type, _name, _strFunc, scale) \
919 947
     void menu_edit_ ## _name () \
920 948
     { \
921
-        if ((int32_t)encoderPosition < 0) \
922
-            encoderPosition = 0; \
923
-        if ((int32_t)encoderPosition > maxEditValue) \
924
-            encoderPosition = maxEditValue; \
949
+        if ((int32_t)encoderPosition < 0) encoderPosition = 0; \
950
+        if ((int32_t)encoderPosition > maxEditValue) encoderPosition = maxEditValue; \
925 951
         if (lcdDrawUpdate) \
926 952
             lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
927 953
         if (LCD_CLICKED) \
@@ -1112,7 +1138,11 @@ void lcd_update()
1112 1138
     {
1113 1139
         lcdDrawUpdate = 2;
1114 1140
         lcd_oldcardstatus = IS_SD_INSERTED;
1115
-        lcd_implementation_init(); // to maybe revive the LCD if static electricity killed it.
1141
+        lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
1142
+          #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
1143
+            currentMenu == lcd_status_screen
1144
+          #endif
1145
+        );
1116 1146
 
1117 1147
         if(lcd_oldcardstatus)
1118 1148
         {
@@ -1192,10 +1222,8 @@ void lcd_update()
1192 1222
             lcdDrawUpdate = 2;
1193 1223
         }
1194 1224
 #endif//ULTIPANEL
1195
-        if (lcdDrawUpdate == 2)
1196
-            lcd_implementation_clear();
1197
-        if (lcdDrawUpdate)
1198
-            lcdDrawUpdate--;
1225
+        if (lcdDrawUpdate == 2) lcd_implementation_clear();
1226
+        if (lcdDrawUpdate) lcdDrawUpdate--;
1199 1227
         lcd_next_update_millis = millis() + LCD_UPDATE_INTERVAL;
1200 1228
     }
1201 1229
 }
@@ -1206,35 +1234,39 @@ void lcd_ignore_click(bool b)
1206 1234
     wait_for_unclick = false;
1207 1235
 }
1208 1236
 
1237
+void lcd_finishstatus() {
1238
+  int len = strlen(lcd_status_message);
1239
+  if (len > 0) {
1240
+    while (len < LCD_WIDTH) {
1241
+      lcd_status_message[len++] = ' ';
1242
+    }
1243
+  }
1244
+  lcd_status_message[LCD_WIDTH] = '\0';
1245
+  #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
1246
+    #if PROGRESS_MSG_EXPIRE > 0
1247
+      messageTick =
1248
+    #endif
1249
+    progressBarTick = millis();
1250
+  #endif
1251
+  lcdDrawUpdate = 2;
1252
+
1253
+  #ifdef FILAMENT_LCD_DISPLAY
1254
+    message_millis = millis();  //get status message to show up for a while
1255
+  #endif
1256
+}
1209 1257
 void lcd_setstatus(const char* message)
1210 1258
 {
1211 1259
     if (lcd_status_message_level > 0)
1212 1260
         return;
1213 1261
     strncpy(lcd_status_message, message, LCD_WIDTH);
1214
-
1215
-    size_t i = strlen(lcd_status_message);
1216
-    memset(lcd_status_message + i, ' ', LCD_WIDTH - i);
1217
-    lcd_status_message[LCD_WIDTH] = '\0';
1218
-
1219
-    lcdDrawUpdate = 2;
1220
-#ifdef FILAMENT_LCD_DISPLAY
1221
-        message_millis=millis();  //get status message to show up for a while
1222
-#endif
1262
+    lcd_finishstatus();
1223 1263
 }
1224 1264
 void lcd_setstatuspgm(const char* message)
1225 1265
 {
1226 1266
     if (lcd_status_message_level > 0)
1227 1267
         return;
1228 1268
     strncpy_P(lcd_status_message, message, LCD_WIDTH);
1229
-
1230
-    size_t i = strlen(lcd_status_message);
1231
-    memset(lcd_status_message + i, ' ', LCD_WIDTH - i);
1232
-    lcd_status_message[LCD_WIDTH] = '\0';
1233
-
1234
-    lcdDrawUpdate = 2;
1235
-#ifdef FILAMENT_LCD_DISPLAY
1236
-        message_millis=millis();  //get status message to show up for a while
1237
-#endif
1269
+    lcd_finishstatus();
1238 1270
 }
1239 1271
 void lcd_setalertstatuspgm(const char* message)
1240 1272
 {
@@ -1382,7 +1414,7 @@ char *itostr2(const uint8_t &x)
1382 1414
   return conv;
1383 1415
 }
1384 1416
 
1385
-//  convert float to string with +123.4 format
1417
+// Convert float to string with 123.4 format, dropping sign
1386 1418
 char *ftostr31(const float &x)
1387 1419
 {
1388 1420
   int xx=x*10;
@@ -1397,7 +1429,7 @@ char *ftostr31(const float &x)
1397 1429
   return conv;
1398 1430
 }
1399 1431
 
1400
-//  convert float to string with 123.4 format
1432
+// Convert float to string with 123.4 format
1401 1433
 char *ftostr31ns(const float &x)
1402 1434
 {
1403 1435
   int xx=x*10;
@@ -1429,7 +1461,7 @@ char *ftostr32(const float &x)
1429 1461
   return conv;
1430 1462
 }
1431 1463
 
1432
-//Float to string with 1.23 format
1464
+// Convert float to string with 1.23 format
1433 1465
 char *ftostr12ns(const float &x)
1434 1466
 {
1435 1467
   long xx=x*100;
@@ -1443,6 +1475,7 @@ char *ftostr12ns(const float &x)
1443 1475
   return conv;
1444 1476
 }
1445 1477
 
1478
+// Convert int to lj string with +123.0 format
1446 1479
 char *itostr31(const int &xx)
1447 1480
 {
1448 1481
   conv[0]=(xx>=0)?'+':'-';
@@ -1475,6 +1508,7 @@ char *itostr3(const int &x)
1475 1508
   return conv;
1476 1509
 }
1477 1510
 
1511
+// Convert int to lj string with 123 format
1478 1512
 char *itostr3left(const int &xx)
1479 1513
 {
1480 1514
   if (xx >= 100)
@@ -1508,7 +1542,7 @@ char *itostr4(const int &xx) {
1508 1542
   return conv;
1509 1543
 }
1510 1544
 
1511
-//  convert float to rj string with 12345 format
1545
+// Convert float to rj string with 12345 format
1512 1546
 char *ftostr5(const float &x) {
1513 1547
   long xx = abs(x);
1514 1548
   conv[0] = xx >= 10000 ? (xx / 10000) % 10 + '0' : ' ';
@@ -1520,7 +1554,7 @@ char *ftostr5(const float &x) {
1520 1554
   return conv;
1521 1555
 }
1522 1556
 
1523
-//  convert float to string with +1234.5 format
1557
+// Convert float to string with +1234.5 format
1524 1558
 char *ftostr51(const float &x)
1525 1559
 {
1526 1560
   long xx=x*10;
@@ -1536,7 +1570,7 @@ char *ftostr51(const float &x)
1536 1570
   return conv;
1537 1571
 }
1538 1572
 
1539
-//  convert float to string with +123.45 format
1573
+// Convert float to string with +123.45 format
1540 1574
 char *ftostr52(const float &x)
1541 1575
 {
1542 1576
   long xx=x*100;

+ 204
- 109
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

@@ -208,6 +208,14 @@ extern volatile uint16_t buttons;  //an extended version of the last checked but
208 208
   LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7
209 209
 #endif
210 210
 
211
+#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
212
+  static uint16_t progressBarTick = 0;
213
+  #if PROGRESS_MSG_EXPIRE > 0
214
+    static uint16_t messageTick = 0;
215
+  #endif
216
+  #define LCD_STR_PROGRESS  "\x03\x04\x05"
217
+#endif
218
+
211 219
 /* Custom characters defined in the first 8 characters of the LCD */
212 220
 #define LCD_STR_BEDTEMP     "\x00"
213 221
 #define LCD_STR_DEGREE      "\x01"
@@ -219,91 +227,157 @@ extern volatile uint16_t buttons;  //an extended version of the last checked but
219 227
 #define LCD_STR_CLOCK       "\x07"
220 228
 #define LCD_STR_ARROW_RIGHT "\x7E"  /* from the default character set */
221 229
 
222
-static void lcd_implementation_init()
223
-{
224
-    byte bedTemp[8] =
225
-    {
226
-        B00000,
227
-        B11111,
228
-        B10101,
229
-        B10001,
230
-        B10101,
231
-        B11111,
232
-        B00000,
233
-        B00000
234
-    }; //thanks Sonny Mounicou
235
-    byte degree[8] =
236
-    {
237
-        B01100,
238
-        B10010,
239
-        B10010,
240
-        B01100,
241
-        B00000,
242
-        B00000,
243
-        B00000,
244
-        B00000
245
-    };
246
-    byte thermometer[8] =
247
-    {
248
-        B00100,
249
-        B01010,
250
-        B01010,
251
-        B01010,
252
-        B01010,
253
-        B10001,
254
-        B10001,
255
-        B01110
256
-    };
257
-    byte uplevel[8]={
258
-        B00100,
259
-        B01110,
260
-        B11111,
261
-        B00100,
262
-        B11100,
263
-        B00000,
264
-        B00000,
265
-        B00000
266
-    }; //thanks joris
267
-    byte refresh[8]={
268
-        B00000,
269
-        B00110,
270
-        B11001,
271
-        B11000,
272
-        B00011,
273
-        B10011,
274
-        B01100,
275
-        B00000,
276
-    }; //thanks joris
277
-    byte folder [8]={
278
-        B00000,
279
-        B11100,
280
-        B11111,
281
-        B10001,
282
-        B10001,
283
-        B11111,
284
-        B00000,
285
-        B00000
286
-    }; //thanks joris
287
-    byte feedrate [8]={
288
-        B11100,
289
-        B10000,
290
-        B11000,
291
-        B10111,
292
-        B00101,
293
-        B00110,
294
-        B00101,
295
-        B00000
296
-    }; //thanks Sonny Mounicou
297
-    byte clock [8]={
298
-        B00000,
299
-        B01110,
300
-        B10011,
301
-        B10101,
302
-        B10001,
303
-        B01110,
304
-        B00000,
305
-        B00000
306
-    }; //thanks Sonny Mounicou
230
+static void lcd_set_custom_characters(
231
+  #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
232
+    bool progress_bar_set=true
233
+  #endif
234
+) {
235
+  byte bedTemp[8] = {
236
+    B00000,
237
+    B11111,
238
+    B10101,
239
+    B10001,
240
+    B10101,
241
+    B11111,
242
+    B00000,
243
+    B00000
244
+  }; //thanks Sonny Mounicou
245
+  byte degree[8] = {
246
+    B01100,
247
+    B10010,
248
+    B10010,
249
+    B01100,
250
+    B00000,
251
+    B00000,
252
+    B00000,
253
+    B00000
254
+  };
255
+  byte thermometer[8] = {
256
+    B00100,
257
+    B01010,
258
+    B01010,
259
+    B01010,
260
+    B01010,
261
+    B10001,
262
+    B10001,
263
+    B01110
264
+  };
265
+  byte uplevel[8] = {
266
+    B00100,
267
+    B01110,
268
+    B11111,
269
+    B00100,
270
+    B11100,
271
+    B00000,
272
+    B00000,
273
+    B00000
274
+  }; //thanks joris
275
+  byte refresh[8] = {
276
+    B00000,
277
+    B00110,
278
+    B11001,
279
+    B11000,
280
+    B00011,
281
+    B10011,
282
+    B01100,
283
+    B00000,
284
+  }; //thanks joris
285
+  byte folder[8] = {
286
+    B00000,
287
+    B11100,
288
+    B11111,
289
+    B10001,
290
+    B10001,
291
+    B11111,
292
+    B00000,
293
+    B00000
294
+  }; //thanks joris
295
+  byte feedrate[8] = {
296
+    B11100,
297
+    B10000,
298
+    B11000,
299
+    B10111,
300
+    B00101,
301
+    B00110,
302
+    B00101,
303
+    B00000
304
+  }; //thanks Sonny Mounicou
305
+  byte clock[8] = {
306
+    B00000,
307
+    B01110,
308
+    B10011,
309
+    B10101,
310
+    B10001,
311
+    B01110,
312
+    B00000,
313
+    B00000
314
+  }; //thanks Sonny Mounicou
315
+
316
+  #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
317
+    static bool char_mode = false;
318
+    byte progress[3][8] = { {
319
+      B00000,
320
+      B10000,
321
+      B10000,
322
+      B10000,
323
+      B10000,
324
+      B10000,
325
+      B10000,
326
+      B00000
327
+    }, {
328
+      B00000,
329
+      B10100,
330
+      B10100,
331
+      B10100,
332
+      B10100,
333
+      B10100,
334
+      B10100,
335
+      B00000
336
+    }, {
337
+      B00000,
338
+      B10101,
339
+      B10101,
340
+      B10101,
341
+      B10101,
342
+      B10101,
343
+      B10101,
344
+      B00000
345
+    } };
346
+    if (progress_bar_set != char_mode) {
347
+      char_mode = progress_bar_set;
348
+      lcd.createChar(LCD_STR_BEDTEMP[0], bedTemp);
349
+      lcd.createChar(LCD_STR_DEGREE[0], degree);
350
+      lcd.createChar(LCD_STR_THERMOMETER[0], thermometer);
351
+      lcd.createChar(LCD_STR_FEEDRATE[0], feedrate);
352
+      lcd.createChar(LCD_STR_CLOCK[0], clock);
353
+      if (progress_bar_set) {
354
+        // Progress bar characters for info screen
355
+        for (int i=3; i--;) lcd.createChar(LCD_STR_PROGRESS[i], progress[i]);
356
+      }
357
+      else {
358
+        // Custom characters for submenus
359
+        lcd.createChar(LCD_STR_UPLEVEL[0], uplevel);
360
+        lcd.createChar(LCD_STR_REFRESH[0], refresh);
361
+        lcd.createChar(LCD_STR_FOLDER[0], folder);
362
+      }
363
+    }
364
+  #else
365
+    lcd.createChar(LCD_STR_BEDTEMP[0], bedTemp);
366
+    lcd.createChar(LCD_STR_DEGREE[0], degree);
367
+    lcd.createChar(LCD_STR_THERMOMETER[0], thermometer);
368
+    lcd.createChar(LCD_STR_UPLEVEL[0], uplevel);
369
+    lcd.createChar(LCD_STR_REFRESH[0], refresh);
370
+    lcd.createChar(LCD_STR_FOLDER[0], folder);
371
+    lcd.createChar(LCD_STR_FEEDRATE[0], feedrate);
372
+    lcd.createChar(LCD_STR_CLOCK[0], clock);
373
+  #endif
374
+}
375
+
376
+static void lcd_implementation_init(
377
+  #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
378
+    bool progress_bar_set=true
379
+  #endif
380
+) {
307 381
 
308 382
 #if defined(LCD_I2C_TYPE_PCF8575)
309 383
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
@@ -329,14 +403,12 @@ static void lcd_implementation_init()
329 403
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
330 404
 #endif
331 405
 
332
-    lcd.createChar(LCD_STR_BEDTEMP[0], bedTemp);
333
-    lcd.createChar(LCD_STR_DEGREE[0], degree);
334
-    lcd.createChar(LCD_STR_THERMOMETER[0], thermometer);
335
-    lcd.createChar(LCD_STR_UPLEVEL[0], uplevel);
336
-    lcd.createChar(LCD_STR_REFRESH[0], refresh);
337
-    lcd.createChar(LCD_STR_FOLDER[0], folder);
338
-    lcd.createChar(LCD_STR_FEEDRATE[0], feedrate);
339
-    lcd.createChar(LCD_STR_CLOCK[0], clock);
406
+    lcd_set_custom_characters(
407
+        #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
408
+            progress_bar_set
409
+        #endif
410
+    );
411
+
340 412
     lcd.clear();
341 413
 }
342 414
 static void lcd_implementation_clear()
@@ -507,23 +579,46 @@ static void lcd_implementation_status_screen()
507 579
     }
508 580
 #endif
509 581
 
510
-    //Display both Status message line and Filament display on the last line
511
-    #ifdef FILAMENT_LCD_DISPLAY
512
-      if(message_millis+5000>millis()){  //display any status for the first 5 sec after screen is initiated
513
-         	 lcd.setCursor(0, LCD_HEIGHT - 1);
514
-        	 lcd.print(lcd_status_message);
515
-        } else {
516
-		     lcd.setCursor(0,LCD_HEIGHT - 1);
517
-		     lcd_printPGM(PSTR("Dia "));
518
-		     lcd.print(ftostr12ns(filament_width_meas));
519
-		     lcd_printPGM(PSTR(" V"));
520
-		     lcd.print(itostr3(100.0*volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
521
-    		 lcd.print('%');
582
+  // Status message line at the bottom
583
+  lcd.setCursor(0, LCD_HEIGHT - 1);
584
+
585
+  #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
586
+
587
+    if (card.isFileOpen()) {
588
+      uint16_t mil = millis(), diff = mil - progressBarTick;
589
+      if (diff >= PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
590
+        // draw the progress bar
591
+        int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
592
+          cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
593
+        char msg[LCD_WIDTH+1], b = ' ';
594
+        msg[i] = '\0';
595
+        while (i--) {
596
+          if (i == cel - 1)
597
+            b = LCD_STR_PROGRESS[2];
598
+          else if (i == cel && rem != 0)
599
+            b = LCD_STR_PROGRESS[rem-1];
600
+          msg[i] = b;
522 601
         }
523
-    #else
524
-    lcd.setCursor(0, LCD_HEIGHT - 1);
525
-    lcd.print(lcd_status_message);
526
-    #endif
602
+        lcd.print(msg);
603
+        return;
604
+      }
605
+    } //card.isFileOpen
606
+
607
+  #endif //LCD_PROGRESS_BAR
608
+
609
+  //Display both Status message line and Filament display on the last line
610
+  #ifdef FILAMENT_LCD_DISPLAY
611
+    if (message_millis + 5000 <= millis()) {  //display any status for the first 5 sec after screen is initiated
612
+      lcd_printPGM(PSTR("Dia "));
613
+      lcd.print(ftostr12ns(filament_width_meas));
614
+      lcd_printPGM(PSTR(" V"));
615
+      lcd.print(itostr3(100.0*volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
616
+  	  lcd.print('%');
617
+  	  return;
618
+    }
619
+  #endif //FILAMENT_LCD_DISPLAY
620
+
621
+  lcd.print(lcd_status_message);
527 622
 }
528 623
 static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
529 624
 {

Loading…
Cancel
Save