Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨♻️ Big progress display revision #24767

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ vc-fileutils.settings
imgui.ini
eeprom.dat
spi_flash.bin
fs.img

#cmake
CMakeLists.txt
Expand Down
61 changes: 29 additions & 32 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1403,9 +1403,6 @@
// On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY

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

// Show the E position (filament used) during printing
//#define LCD_SHOW_E_TOTAL

Expand All @@ -1426,37 +1423,43 @@
//#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup
#endif
#if ENABLED(NEO2_COLOR_PRESETS)
#define NEO2_USER_PRESET_RED 255 // User defined RED value
#define NEO2_USER_PRESET_GREEN 128 // User defined GREEN value
#define NEO2_USER_PRESET_BLUE 0 // User defined BLUE value
#define NEO2_USER_PRESET_WHITE 255 // User defined WHITE value
#define NEO2_USER_PRESET_BRIGHTNESS 255 // User defined intensity
//#define NEO2_USER_PRESET_STARTUP // Have the printer display the user preset color on startup for the second strip
#define NEO2_USER_PRESET_RED 255 // User defined RED value
#define NEO2_USER_PRESET_GREEN 128 // User defined GREEN value
#define NEO2_USER_PRESET_BLUE 0 // User defined BLUE value
#define NEO2_USER_PRESET_WHITE 255 // User defined WHITE value
#define NEO2_USER_PRESET_BRIGHTNESS 255 // User defined intensity
//#define NEO2_USER_PRESET_STARTUP // Have the printer display the user preset color on startup for the second strip
#endif
#endif

#endif
#endif // HAS_DISPLAY || DWIN_LCD_PROUI

// LCD Print Progress options
#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
#if CAN_SHOW_REMAINING_TIME
//#define SHOW_REMAINING_TIME // Display estimated time to completion
#if ENABLED(SHOW_REMAINING_TIME)
//#define USE_M73_REMAINING_TIME // Use remaining time from M73 command instead of estimation
//#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
#endif
// Add the G-code 'M73' to set / report the current job progress
thinkyhead marked this conversation as resolved.
Show resolved Hide resolved
//#define SET_PROGRESS_MANUALLY
#if ENABLED(SET_PROGRESS_MANUALLY)
//#define SET_PROGRESS_PERCENT // Add 'P' parameter to set percentage done, otherwise use Marlin's estimate
//#define SET_REMAINING_TIME // Add 'R' parameter to set remaining time, otherwise use Marlin's estimate
//#define SET_INTERACTION_TIME // Add 'C' parameter to set time until next filament change or other user interaction
#if ENABLED(SET_INTERACTION_TIME)
#define SHOW_INTERACTION_TIME // Display time until next user interaction ('C' = filament change)
#endif
//#define M73_REPORT // Report progress to host with 'M73'
#endif

#if EITHER(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI)
//#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
#endif
// LCD Print Progress options, multiple can be rotated depending on screen layout
#if HAS_DISPLAY && EITHER(SDSUPPORT, SET_PROGRESS_MANUALLY)
#define SHOW_PROGRESS_PERCENT // Show print progress percentage (doesn't affect progress bar)
#define SHOW_ELAPSED_TIME // Display elapsed printing time (prefix 'E')
//#define SHOW_REMAINING_TIME // Display estimated time to completion (prefix 'R')

//#define PRINT_PROGRESS_SHOW_DECIMALS // Show/report progress with decimal digits, not all UIs support this

#if EITHER(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
//#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing
#if ENABLED(LCD_PROGRESS_BAR)
#define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar
#define PROGRESS_BAR_MSG_TIME 3000 // (ms) Amount of time to show the status message
#define PROGRESS_MSG_EXPIRE 0 // (ms) Amount of time to retain the status message (0=forever)
#define PROGRESS_MSG_EXPIRE 0 // (ms) Amount of time to retain the status message (0=forever)
//#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it
//#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar
#endif
Expand Down Expand Up @@ -1799,14 +1802,8 @@
#endif // HAS_MARLINUI_U8GLIB

#if HAS_MARLINUI_U8GLIB || IS_DWIN_MARLINUI
// Show SD percentage next to the progress bar
//#define SHOW_SD_PERCENT

// Enable to save many cycles by drawing a hollow frame on Menu Screens
#define MENU_HOLLOW_FRAME

// Swap the CW/CCW indicators in the graphics overlay
//#define OVERLAY_GFX_REVERSE
#define MENU_HOLLOW_FRAME // Enable to save many cycles by drawing a hollow frame on Menu Screens
//#define OVERLAY_GFX_REVERSE // Swap the CW/CCW indicators in the graphics overlay
#endif

//
Expand Down Expand Up @@ -2064,7 +2061,7 @@
*/
//#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
//#define EXTRA_LIN_ADVANCE_K // Add a second linear advance constant, configurable with M900.
//#define EXTRA_LIN_ADVANCE_K // Add a second linear advance constant, configurable with M900 L.
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // Print debug information to serial during operation. Disable for production use.
//#define EXPERIMENTAL_SCURVE // Allow S-Curve Acceleration to be used with LA.
Expand Down Expand Up @@ -4058,7 +4055,7 @@

/**
* Mechanical Gantry Calibration
* Modern replacement for the Prusa TMC_Z_CALIBRATION.
* Modern replacement for the Průša TMC_Z_CALIBRATION.
* Adds capability to work with any adjustable current drivers.
* Implemented as G34 because M915 is deprecated.
* @section calibrate
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ void startOrResumeJob() {
TERN_(GCODE_REPEAT_MARKERS, repeat.reset());
TERN_(CANCEL_OBJECTS, cancelable.reset());
TERN_(LCD_SHOW_E_TOTAL, e_move_accumulator = 0);
#if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
#if BOTH(SET_PROGRESS_MANUALLY, SET_REMAINING_TIME)
ui.reset_remaining_time();
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,8 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 48: M48(); break; // M48: Z probe repeatability test
#endif

#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
case 73: M73(); break; // M73: Set progress percentage (for display on LCD)
#if ENABLED(SET_PROGRESS_MANUALLY)
case 73: M73(); break; // M73: Set progress percentage
#endif

case 75: M75(); break; // M75: Start print timer
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
* M43 - Display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins (Requires PINS_DEBUGGING)
* M48 - Measure Z Probe repeatability: M48 P<points> X<pos> Y<pos> V<level> E<engage> L<legs> S<chizoid>. (Requires Z_MIN_PROBE_REPEATABILITY_TEST)
*
* M73 - Set the progress percentage. (Requires LCD_SET_PROGRESS_MANUALLY)
* M73 - Set the progress percentage. (Requires SET_PROGRESS_MANUALLY)
* M75 - Start the print job timer.
* M76 - Pause the print job timer.
* M77 - Stop the print job timer.
Expand Down Expand Up @@ -677,7 +677,7 @@ class GcodeSuite {
static void M48();
#endif

#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
#if ENABLED(SET_PROGRESS_MANUALLY)
static void M73();
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/host/M115.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void GcodeSuite::M115() {
cap_line(F("LEVELING_DATA"), ENABLED(HAS_LEVELING));

// BUILD_PERCENT (M73)
cap_line(F("BUILD_PERCENT"), ENABLED(LCD_SET_PROGRESS_MANUALLY));
cap_line(F("BUILD_PERCENT"), BOTH(SET_PROGRESS_MANUALLY, SET_PROGRESS_PERCENT));

// SOFTWARE_POWER (M80, M81)
cap_line(F("SOFTWARE_POWER"), ENABLED(PSU_CONTROL));
Expand Down
54 changes: 45 additions & 9 deletions Marlin/src/gcode/lcd/M73.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,35 @@

#include "../../inc/MarlinConfig.h"

#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
#if ENABLED(SET_PROGRESS_MANUALLY)

#include "../gcode.h"
#include "../../lcd/marlinui.h"
#include "../../sd/cardreader.h"
#include "../../libs/numtostr.h"

#if ENABLED(DWIN_LCD_PROUI)
#include "../../lcd/e3v2/proui/dwin.h"
#endif

#if ENABLED(M73_REPORT)
#define M73_REPORT_PRUSA
#endif

/**
* M73: Set percentage complete (for display on LCD)
*
* Example:
* M73 P25 ; Set progress to 25%
* M73 P25.63 ; Set progress to 25.63%
* M73 R456 ; Set remaining time to 456 minutes
* M73 C12 ; Set next interaction countdown to 12 minutes
* M73 ; Report current values
*
* Use a shorter-than-Průša report format:
* M73 Percent done: ---%; Time left: -----m; Change: -----m;
*
* When PRINT_PROGRESS_SHOW_DECIMALS is enabled - reports percent with 100 / 23.4 / 3.45 format
*
*/
void GcodeSuite::M73() {

Expand All @@ -46,17 +60,39 @@ void GcodeSuite::M73() {

#else

if (parser.seenval('P'))
ui.set_progress((PROGRESS_SCALE) > 1
? parser.value_float() * (PROGRESS_SCALE)
: parser.value_byte()
);
#if ENABLED(SET_PROGRESS_PERCENT)
if (parser.seenval('P'))
ui.set_progress((PROGRESS_SCALE) > 1
? parser.value_float() * (PROGRESS_SCALE)
: parser.value_byte()
);
#endif

#if ENABLED(USE_M73_REMAINING_TIME)
#if ENABLED(SET_REMAINING_TIME)
if (parser.seenval('R')) ui.set_remaining_time(60 * parser.value_ulong());
#endif

#if ENABLED(SET_INTERACTION_TIME)
if (parser.seenval('C')) ui.set_interaction_time(60 * parser.value_ulong());
#endif

#endif

#if ENABLED(M73_REPORT)
{
SERIAL_ECHO_MSG(
TERN(M73_REPORT_PRUSA, "M73 Percent done: ", "Progress: ")
, TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(ui.get_progress_permyriad()), ui.get_progress_percent())
#if ENABLED(SET_REMAINING_TIME)
, TERN(M73_REPORT_PRUSA, "; Print time remaining in mins: ", "%; Time left: "), ui.remaining_time / 60
#endif
#if ENABLED(SET_INTERACTION_TIME)
, TERN(M73_REPORT_PRUSA, "; Change in mins: ", "m; Change: "), ui.interaction_time / 60
#endif
, TERN(M73_REPORT_PRUSA, ";", "m")
);
}
#endif
}

#endif // LCD_SET_PROGRESS_MANUALLY
#endif // SET_PROGRESS_MANUALLY
4 changes: 2 additions & 2 deletions Marlin/src/gcode/sd/M1001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "../queue.h"
#endif

#if EITHER(LCD_SET_PROGRESS_MANUALLY, SD_REPRINT_LAST_SELECTED_FILE)
#if EITHER(SET_PROGRESS_MANUALLY, SD_REPRINT_LAST_SELECTED_FILE)
#include "../../lcd/marlinui.h"
#endif

Expand Down Expand Up @@ -84,7 +84,7 @@ void GcodeSuite::M1001() {
process_subcommands_now(F("M77"));

// Set the progress bar "done" state
TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress_done());
TERN_(SET_PROGRESS_PERCENT, ui.set_progress_done());

// Announce SD file completion
{
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/sd/M23.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void GcodeSuite::M23() {
for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
card.openFileRead(parser.string_arg);

TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(0));
TERN_(SET_PROGRESS_PERCENT, ui.set_progress(0));
}

#endif // SDSUPPORT
4 changes: 0 additions & 4 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,6 @@
#define HAS_MANUAL_MOVE_MENU 1
#endif

#if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, IS_DWIN_MARLINUI, DWIN_CREALITY_LCD_JYERSUI)
#define CAN_SHOW_REMAINING_TIME 1
#endif

#if HAS_MARLINUI_U8GLIB
#ifndef LCD_PIXEL_WIDTH
#define LCD_PIXEL_WIDTH 128
Expand Down
8 changes: 7 additions & 1 deletion Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,16 @@
#undef MENU_ADDAUTOSTART
#endif

#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
#if EITHER(SDSUPPORT, SET_PROGRESS_MANUALLY)
#define HAS_PRINT_PROGRESS 1
#endif

#if DISABLED(SET_PROGRESS_MANUALLY)
#undef SET_REMAINING_TIME
#undef SET_INTERACTION_TIME
#undef M73_REPORT
#endif

#if ANY(HAS_MARLINUI_MENU, ULTIPANEL_FEEDMULTIPLY, SOFT_RESET_ON_KILL)
#define HAS_ENCODER_ACTION 1
#endif
Expand Down
26 changes: 15 additions & 11 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@
#elif defined(MKS_LCD12864)
#error "MKS_LCD12864 is now MKS_LCD12864A or MKS_LCD12864B."
#elif defined(DOGM_SD_PERCENT)
#error "DOGM_SD_PERCENT is now SHOW_SD_PERCENT."
#error "DOGM_SD_PERCENT is now SHOW_PROGRESS_PERCENT."
#elif defined(NEOPIXEL_BKGD_LED_INDEX)
#error "NEOPIXEL_BKGD_LED_INDEX is now NEOPIXEL_BKGD_INDEX_FIRST."
#elif defined(TEMP_SENSOR_1_AS_REDUNDANT)
Expand Down Expand Up @@ -646,6 +646,12 @@
#error "TOUCH_IDLE_SLEEP (seconds) is now TOUCH_IDLE_SLEEP_MINS (minutes)."
#elif defined(LCD_BACKLIGHT_TIMEOUT)
#error "LCD_BACKLIGHT_TIMEOUT (seconds) is now LCD_BACKLIGHT_TIMEOUT_MINS (minutes)."
#elif defined(LCD_SET_PROGRESS_MANUALLY)
#error "LCD_SET_PROGRESS_MANUALLY is now SET_PROGRESS_MANUALLY."
#elif defined(USE_M73_REMAINING_TIME)
#error "USE_M73_REMAINING_TIME is now SET_REMAINING_TIME."
#elif defined(SHOW_SD_PERCENT)
#error "SHOW_SD_PERCENT is now SHOW_PROGRESS_PERCENT."
#endif

// L64xx stepper drivers have been removed
Expand Down Expand Up @@ -894,8 +900,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
* Progress Bar
*/
#if ENABLED(LCD_PROGRESS_BAR)
#if NONE(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
#error "LCD_PROGRESS_BAR requires SDSUPPORT or LCD_SET_PROGRESS_MANUALLY."
#if NONE(SDSUPPORT, SET_PROGRESS_MANUALLY)
#error "LCD_PROGRESS_BAR requires SDSUPPORT or SET_PROGRESS_MANUALLY."
#elif NONE(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
#error "LCD_PROGRESS_BAR only applies to HD44780 character LCD and TFTGLCD_PANEL_(SPI|I2C)."
#elif HAS_MARLINUI_U8GLIB || IS_DWIN_MARLINUI
Expand All @@ -905,12 +911,14 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#elif PROGRESS_MSG_EXPIRE < 0
#error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0."
#endif
#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && NONE(HAS_MARLINUI_U8GLIB, HAS_GRAPHICAL_TFT, HAS_MARLINUI_HD44780, EXTENSIBLE_UI, HAS_DWIN_E3V2, IS_DWIN_MARLINUI)
#error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Character LCD, Graphical LCD, TFT, DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_*, OR EXTENSIBLE_UI."
#endif

#if ENABLED(USE_M73_REMAINING_TIME) && DISABLED(LCD_SET_PROGRESS_MANUALLY)
#error "USE_M73_REMAINING_TIME requires LCD_SET_PROGRESS_MANUALLY"
#if ENABLED(SET_PROGRESS_MANUALLY) && NONE(SET_PROGRESS_PERCENT, SET_REMAINING_TIME, SET_INTERACTION_TIME)
#error "SET_PROGRESS_MANUALLY requires at least one of SET_PROGRESS_PERCENT, SET_REMAINING_TIME, SET_INTERACTION_TIME to be enabled."
#endif

#if HAS_LCDPRINT && LCD_HEIGHT < 4 && ANY(SHOW_PROGRESS_PERCENT, SHOW_ELAPSED_TIME, SHOW_REMAINING_TIME, SHOW_INTERACTION_TIME)
#error "Displays with fewer than 4 rows of text can't show progress values."
#endif

#if !HAS_MARLINUI_MENU && ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
Expand Down Expand Up @@ -4038,10 +4046,6 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive.");
#error "COOLANT_FLOOD requires COOLANT_FLOOD_PIN to be defined."
#endif

#if NONE(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, IS_DWIN_MARLINUI) && ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
#error "PRINT_PROGRESS_SHOW_DECIMALS currently requires a Graphical LCD."
#endif

#if HAS_ADC_BUTTONS && defined(ADC_BUTTON_DEBOUNCE_DELAY) && ADC_BUTTON_DEBOUNCE_DELAY < 16
#error "ADC_BUTTON_DEBOUNCE_DELAY must be greater than 16."
#endif
Expand Down
Loading