From 0ce6d510eea8c4beea0e662357dd153abe4aaa14 Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Tue, 11 Dec 2018 10:49:45 -0700 Subject: [PATCH 1/5] Allow ExtUI to use LCD_SET_PROGRESS_MANUALLY --- Marlin/src/gcode/gcode.cpp | 2 +- Marlin/src/gcode/gcode.h | 2 +- Marlin/src/gcode/lcd/M73.cpp | 4 ++-- Marlin/src/inc/SanityCheck.h | 4 ++-- Marlin/src/lcd/ultralcd.cpp | 8 ++++---- Marlin/src/lcd/ultralcd.h | 20 ++++++++++---------- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 973d8713eac2..998050ad8da5 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -336,7 +336,7 @@ void GcodeSuite::process_parsed_command( case 49: M49(); break; // M49: Turn on or off G26 debug flag for verbose output #endif - #if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) + #if (ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI)) && ENABLED(LCD_SET_PROGRESS_MANUALLY) case 73: M73(); break; // M73: Set progress percentage (for display on LCD) #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 07582bc351b0..0b0e552aaac9 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -488,7 +488,7 @@ class GcodeSuite { static void M49(); #endif - #if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) + #if (ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI)) && ENABLED(LCD_SET_PROGRESS_MANUALLY) static void M73(); #endif diff --git a/Marlin/src/gcode/lcd/M73.cpp b/Marlin/src/gcode/lcd/M73.cpp index 78697aecf380..9d141e27c64a 100644 --- a/Marlin/src/gcode/lcd/M73.cpp +++ b/Marlin/src/gcode/lcd/M73.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if (ENABLED(EXTENSIBLE_UI) || ENABLED(ULTRA_LCD)) && ENABLED(LCD_SET_PROGRESS_MANUALLY) #include "../gcode.h" #include "../../lcd/ultralcd.h" @@ -42,4 +42,4 @@ void GcodeSuite::M73() { ui.set_progress(parser.value_byte()); } -#endif // ULTRA_LCD && LCD_SET_PROGRESS_MANUALLY +#endif // (ENABLED(EXTENSIBLE_UI) || ENABLED(ULTRA_LCD)) && LCD_SET_PROGRESS_MANUALLY diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index dbaf362e52dd..0ebde7c37695 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -500,8 +500,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #elif PROGRESS_MSG_EXPIRE < 0 #error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0." #endif -#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && !HAS_GRAPHICAL_LCD - #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR or Graphical LCD." +#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && !HAS_GRAPHICAL_LCD && !ENABLED(EXTENSIBLE_UI) + #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR and Graphical LCD or EXTENSIBLE_UI." #endif /** diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index f5ba174df01e..20eae21ea3be 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -52,6 +52,10 @@ char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1]; #endif +#if ENABLED(LCD_SET_PROGRESS_MANUALLY) + uint8_t MarlinUI::progress_bar_percent; // = 0 +#endif + #if HAS_SPI_LCD #if HAS_GRAPHICAL_LCD @@ -102,10 +106,6 @@ uint8_t MarlinUI::lcd_status_update_delay = 1; // First update one loop delayed millis_t MarlinUI::next_filament_display; // = 0 #endif -#if ENABLED(LCD_SET_PROGRESS_MANUALLY) - uint8_t MarlinUI::progress_bar_percent; // = 0 -#endif - millis_t next_button_update_ms; #if HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index 54eb239b9df9..77e001362cf7 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -271,6 +271,16 @@ class MarlinUI { static uint8_t status_message_level; // Higher levels block lower levels static inline void reset_alert_level() { status_message_level = 0; } + #if HAS_PRINT_PROGRESS + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) + static uint8_t progress_bar_percent; + static void set_progress(const uint8_t progress) { progress_bar_percent = MIN(progress, 100); } + #endif + static uint8_t get_progress(); + #else + static constexpr uint8_t get_progress() { return 0; } + #endif + #if HAS_SPI_LCD static bool detected(); @@ -312,16 +322,6 @@ class MarlinUI { #endif static uint8_t lcd_status_update_delay; - #if HAS_PRINT_PROGRESS - #if ENABLED(LCD_SET_PROGRESS_MANUALLY) - static uint8_t progress_bar_percent; - static void set_progress(const uint8_t progress) { progress_bar_percent = MIN(progress, 100); } - #endif - static uint8_t get_progress(); - #else - static constexpr uint8_t get_progress() { return 0; } - #endif - #if HAS_LCD_CONTRAST static int16_t contrast; static void set_contrast(const int16_t value); From adcb6a920561071d643458bbeda1589861af6612 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 12 Dec 2018 17:03:41 -0600 Subject: [PATCH 2/5] Update SanityCheck.h --- Marlin/src/inc/SanityCheck.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 0ebde7c37695..def0d0068384 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -500,8 +500,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #elif PROGRESS_MSG_EXPIRE < 0 #error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0." #endif -#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && !HAS_GRAPHICAL_LCD && !ENABLED(EXTENSIBLE_UI) - #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR and Graphical LCD or EXTENSIBLE_UI." +#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && !HAS_GRAPHICAL_LCD && DISABLED(EXTENSIBLE_UI) + #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Graphical LCD, or EXTENSIBLE_UI." #endif /** From 4f45645344c4fe6ca3eece69f1ac61638b356d01 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 12 Dec 2018 17:05:41 -0600 Subject: [PATCH 3/5] Update M73.cpp --- Marlin/src/gcode/lcd/M73.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/lcd/M73.cpp b/Marlin/src/gcode/lcd/M73.cpp index 9d141e27c64a..7f1ebf3ea1b8 100644 --- a/Marlin/src/gcode/lcd/M73.cpp +++ b/Marlin/src/gcode/lcd/M73.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if (ENABLED(EXTENSIBLE_UI) || ENABLED(ULTRA_LCD)) && ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && (ENABLED(EXTENSIBLE_UI) || ENABLED(ULTRA_LCD)) #include "../gcode.h" #include "../../lcd/ultralcd.h" @@ -42,4 +42,4 @@ void GcodeSuite::M73() { ui.set_progress(parser.value_byte()); } -#endif // (ENABLED(EXTENSIBLE_UI) || ENABLED(ULTRA_LCD)) && LCD_SET_PROGRESS_MANUALLY +#endif // LCD_SET_PROGRESS_MANUALLY && (ENABLED(EXTENSIBLE_UI) || ENABLED(ULTRA_LCD)) From 1d8e488d0ac77526264165cde72bfed57c556f88 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 12 Dec 2018 17:06:37 -0600 Subject: [PATCH 4/5] Update gcode.h --- Marlin/src/gcode/gcode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 0b0e552aaac9..540e0208a636 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -488,7 +488,7 @@ class GcodeSuite { static void M49(); #endif - #if (ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI)) && ENABLED(LCD_SET_PROGRESS_MANUALLY) + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) && (ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI)) static void M73(); #endif From 1e6429a2e36c301ae3f1b33b239a4f04f8916a57 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 12 Dec 2018 17:20:53 -0600 Subject: [PATCH 5/5] Update gcode.cpp --- Marlin/src/gcode/gcode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 998050ad8da5..3b60486721ab 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -336,7 +336,7 @@ void GcodeSuite::process_parsed_command( case 49: M49(); break; // M49: Turn on or off G26 debug flag for verbose output #endif - #if (ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI)) && ENABLED(LCD_SET_PROGRESS_MANUALLY) + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) && (ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI)) case 73: M73(); break; // M73: Set progress percentage (for display on LCD) #endif