Skip to content

Commit

Permalink
Add LCD_SET_PROGRESS_MANUALLY
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Oct 15, 2017
1 parent 23dbaaf commit 5f708d4
Show file tree
Hide file tree
Showing 31 changed files with 161 additions and 31 deletions.
3 changes: 3 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
25 changes: 24 additions & 1 deletion Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6022,7 +6022,7 @@ inline void gcode_G92() {
#if ENABLED(ULTIPANEL)
if (lcd_detected()) {
while (wait_for_user) idle();
IS_SD_PRINTING ? LCD_MESSAGEPGM(MSG_RESUMING) : LCD_MESSAGEPGM(WELCOME_MSG);
print_job_timer.isPaused() ? LCD_MESSAGEPGM(WELCOME_MSG) : LCD_MESSAGEPGM(MSG_RESUMING);
}
#else
while (wait_for_user) idle();
Expand Down Expand Up @@ -7241,6 +7241,24 @@ inline void gcode_M42() {

#endif // AUTO_BED_LEVELING_UBL && UBL_G26_MESH_VALIDATION

#if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY)
/**
* M73: Set percentage complete (for display on LCD)
*
* Example:
* M73 P25 ; Set progress to 25%
*
* Notes:
* This has no effect during an SD print job
*/
inline void gcode_M73() {
if (!IS_SD_PRINTING && parser.seen('P')) {
progress_bar_percent = parser.value_byte();
NOMORE(progress_bar_percent, 100);
}
}
#endif // ULTRA_LCD && LCD_SET_PROGRESS_MANUALLY

/**
* M75: Start print timer
*/
Expand Down Expand Up @@ -11090,6 +11108,11 @@ void process_next_command() {
break;
#endif // AUTO_BED_LEVELING_UBL && UBL_G26_MESH_VALIDATION

#if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY)
case 73: // M73: Set print progress percentage
gcode_M73(); break;
#endif

case 75: // M75: Start print timer
gcode_M75(); break;
case 76: // M76: Pause print timer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
3 changes: 3 additions & 0 deletions Marlin/example_configurations/Anet/A6/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
3 changes: 3 additions & 0 deletions Marlin/example_configurations/Anet/A8/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
3 changes: 3 additions & 0 deletions Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
3 changes: 3 additions & 0 deletions Marlin/example_configurations/Cartesio/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
3 changes: 3 additions & 0 deletions Marlin/example_configurations/Felix/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
3 changes: 3 additions & 0 deletions Marlin/example_configurations/RigidBot/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
3 changes: 3 additions & 0 deletions Marlin/example_configurations/SCARA/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
3 changes: 3 additions & 0 deletions Marlin/example_configurations/TinyBoy2/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
3 changes: 3 additions & 0 deletions Marlin/example_configurations/makibox/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
3 changes: 3 additions & 0 deletions Marlin/example_configurations/wt150/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@
//#define LCD_PROGRESS_BAR_TEST
#endif

// Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY

// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT

Expand Down
60 changes: 40 additions & 20 deletions Marlin/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
// Initialized by settings.load()
int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];

#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD))
uint8_t progress_bar_percent;
#endif

#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
millis_t previous_lcd_status_ms = 0;
#endif
Expand Down Expand Up @@ -603,36 +607,52 @@ void lcd_status_screen() {
#endif

#if ENABLED(LCD_PROGRESS_BAR)

//
// HD44780 implements the following message blinking and
// message expiration because Status Line and Progress Bar
// share the same line on the display.
//

// Set current percentage from SD when actively printing
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
if (IS_SD_PRINTING)
progress_bar_percent = card.percentDone();
#endif

millis_t ms = millis();

// If the message will blink rather than expire...
#if DISABLED(PROGRESS_MSG_ONCE)
if (ELAPSED(ms, progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME)) {
if (ELAPSED(ms, progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME))
progress_bar_ms = ms;
}
#endif

#if PROGRESS_MSG_EXPIRE > 0

// Handle message expire
if (expire_status_ms > 0) {
#if ENABLED(SDSUPPORT)
if (card.isFileOpen()) {
// Expire the message when printing is active
if (IS_SD_PRINTING) {
if (ELAPSED(ms, expire_status_ms)) {
lcd_status_message[0] = '\0';
expire_status_ms = 0;
}
}
else {
expire_status_ms += LCD_UPDATE_INTERVAL;
}
}
else {

#if DISABLED(LCD_SET_PROGRESS_MANUALLY)
const uint8_t progress_bar_percent = card.percentDone();
#endif

// Expire the message if a job is active and the bar has ticks
if (progress_bar_percent > 2 && !print_job_timer.isPaused()) {
if (ELAPSED(ms, expire_status_ms)) {
lcd_status_message[0] = '\0';
expire_status_ms = 0;
}
#else
expire_status_ms = 0;
#endif // SDSUPPORT
}
else {
// Defer message expiration before bar appears
// and during any pause (not just SD)
expire_status_ms += LCD_UPDATE_INTERVAL;
}
}
#endif

#endif // PROGRESS_MSG_EXPIRE

#endif // LCD_PROGRESS_BAR

#if ENABLED(ULTIPANEL)
Expand Down
Loading

0 comments on commit 5f708d4

Please sign in to comment.