From b7c23631c5840e2338cae531b171459e9e9c5301 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 22 Jan 2023 15:08:37 +1300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20misc.=20UI=20issues=20(#25?= =?UTF-8?q?252)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/gcode/host/M115.cpp | 4 +++- Marlin/src/inc/Conditionals_adv.h | 4 ++++ Marlin/src/inc/SanityCheck.h | 2 +- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 2 +- Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp | 6 +++--- Marlin/src/lcd/marlinui.cpp | 11 +++++++---- Marlin/src/lcd/marlinui.h | 4 +++- Marlin/src/lcd/menu/menu_advanced.cpp | 2 +- Marlin/src/lcd/tft/ui_1024x600.cpp | 10 ++++------ Marlin/src/lcd/tft/ui_320x240.cpp | 10 ++++------ Marlin/src/lcd/tft/ui_480x320.cpp | 10 ++++------ Marlin/src/lcd/tft_io/tft_io.h | 5 +++++ Marlin/src/module/motion.cpp | 8 ++------ Marlin/src/module/temperature.cpp | 3 +++ Marlin/src/module/temperature.h | 2 ++ Marlin/src/module/tool_change.cpp | 12 +++++------- 16 files changed, 52 insertions(+), 43 deletions(-) diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index 6e8c406adc..d28d53eedd 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -232,7 +232,7 @@ void GcodeSuite::M115() { const xyz_pos_t lmin = dmin.asLogical(), lmax = dmax.asLogical(), wmin = cmin.asLogical(), wmax = cmax.asLogical(); - SERIAL_ECHOLNPGM( + SERIAL_ECHOPGM( "area:{" "full:{" "min:{" @@ -249,6 +249,8 @@ void GcodeSuite::M115() { ), "}" // max "}," // full + ); + SERIAL_ECHOLNPGM( "work:{" "min:{" LIST_N(DOUBLE(NUM_AXES), diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index ea52c9b998..9833b300d3 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -656,6 +656,10 @@ #define HAS_MEDIA_SUBCALLS 1 #endif +#if ANY(SHOW_PROGRESS_PERCENT, SHOW_ELAPSED_TIME, SHOW_REMAINING_TIME, SHOW_INTERACTION_TIME) + #define HAS_EXTRA_PROGRESS 1 +#endif + #if HAS_PRINT_PROGRESS && EITHER(PRINT_PROGRESS_SHOW_DECIMALS, SHOW_REMAINING_TIME) #define HAS_PRINT_PROGRESS_PERMYRIAD 1 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index b17bf2b719..1aadbb19e3 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -944,7 +944,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #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) +#if HAS_LCDPRINT && HAS_EXTRA_PROGRESS && LCD_HEIGHT < 4 #error "Displays with fewer than 4 rows of text can't show progress values." #endif diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index cba58f5c02..03e83c2181 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -444,7 +444,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const } // Prepare strings for progress display -#if HAS_PRINT_PROGRESS +#if HAS_EXTRA_PROGRESS static MarlinUI::progress_t progress = 0; static char bufferc[13]; diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp index 9ed0d8a9d6..3d1594aca2 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp @@ -705,7 +705,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() { void ST7920_Lite_Status_Screen::drawRemain() { const duration_t remaint = TERN0(SET_REMAINING_TIME, ui.get_remaining_time()); if (printJobOngoing() && remaint.value) { - draw_progress_string( PPOS, prepare_time_string(remaint, 'R')); + draw_progress_string(PPOS, prepare_time_string(remaint, 'R')); } } #endif @@ -714,7 +714,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() { void ST7920_Lite_Status_Screen::drawInter() { const duration_t interactt = ui.interaction_time; if (printingIsActive() && interactt.value) { - draw_progress_string( PPOS, prepare_time_string(interactt, 'C')); + draw_progress_string(PPOS, prepare_time_string(interactt, 'C')); } } #endif @@ -723,7 +723,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() { void ST7920_Lite_Status_Screen::drawElapsed() { if (printJobOngoing()) { const duration_t elapsedt = print_job_timer.duration(); - draw_progress_string( PPOS, prepare_time_string(elapsedt, 'E')); + draw_progress_string(PPOS, prepare_time_string(elapsedt, 'E')); } } #endif diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index ff12703ca9..91982b5480 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1743,9 +1743,11 @@ void MarlinUI::init() { ); } - #if LCD_WITH_BLINK && DISABLED(HAS_GRAPHICAL_TFT) - typedef void (*PrintProgress_t)(); - void MarlinUI::rotate_progress() { // Renew and redraw all enabled progress strings + #if LCD_WITH_BLINK && HAS_EXTRA_PROGRESS + + // Renew and redraw all enabled progress strings + void MarlinUI::rotate_progress() { + typedef void (*PrintProgress_t)(); const PrintProgress_t progFunc[] = { OPTITEM(SHOW_PROGRESS_PERCENT, drawPercent) OPTITEM(SHOW_ELAPSED_TIME, drawElapsed) @@ -1760,7 +1762,8 @@ void MarlinUI::init() { (*progFunc[i])(); } } - #endif + + #endif // LCD_WITH_BLINK && HAS_EXTRA_PROGRESS #endif // HAS_PRINT_PROGRESS diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index ec19f8bd34..827a71a29d 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -334,7 +334,7 @@ public: FORCE_INLINE static uint16_t get_progress_permyriad() { return _get_progress(); } #endif static uint8_t get_progress_percent() { return uint8_t(_get_progress() / (PROGRESS_SCALE)); } - #if LCD_WITH_BLINK + #if LCD_WITH_BLINK && HAS_EXTRA_PROGRESS #if ENABLED(SHOW_PROGRESS_PERCENT) static void drawPercent(); #endif @@ -348,6 +348,8 @@ public: static void drawInter(); #endif static void rotate_progress(); + #else + static void rotate_progress() {} #endif #else static constexpr uint8_t get_progress_percent() { return 0; } diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 6f404f20e1..0e24d0ed80 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -377,7 +377,7 @@ void menu_backlash(); #if ENABLED(MPC_INCLUDE_FAN) #define MPC_EDIT_ITEMS(N) \ - MPC_t &mpc = thermalManager.temp_hotend[MenuItemBase::itemIndex].constants; \ + MPC_t &mpc = thermalManager.temp_hotend[MenuItemBase::itemIndex].mpc; \ _MPC_EDIT_ITEMS(N); \ EDIT_ITEM_FAST_N(float43, N, MSG_MPC_AMBIENT_XFER_COEFF_FAN_E, &editable.decimal, 0, 1, []{ \ thermalManager.temp_hotend[MenuItemBase::itemIndex].applyFanAdjustment(editable.decimal); \ diff --git a/Marlin/src/lcd/tft/ui_1024x600.cpp b/Marlin/src/lcd/tft/ui_1024x600.cpp index f3eb83eb9f..363e8eaf99 100644 --- a/Marlin/src/lcd/tft/ui_1024x600.cpp +++ b/Marlin/src/lcd/tft/ui_1024x600.cpp @@ -675,12 +675,10 @@ static void drawAxisValue(const AxisEnum axis) { static void moveAxis(const AxisEnum axis, const int8_t direction) { quick_feedback(); - #if ENABLED(PREVENT_COLD_EXTRUSION) - if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage(F("Too cold")); - return; - } - #endif + if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { + drawMessage(F("Too cold")); + return; + } const float diff = motionAxisState.currentStepSize * direction; diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index 07fa957327..fa433645d7 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -768,12 +768,10 @@ static void drawAxisValue(const AxisEnum axis) { static void moveAxis(const AxisEnum axis, const int8_t direction) { quick_feedback(); - #if ENABLED(PREVENT_COLD_EXTRUSION) - if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage(F("Too cold")); - return; - } - #endif + if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { + drawMessage(F("Too cold")); + return; + } const float diff = motionAxisState.currentStepSize * direction; diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index 02e9ca196a..5bf50a5818 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -656,12 +656,10 @@ static void drawAxisValue(const AxisEnum axis) { static void moveAxis(const AxisEnum axis, const int8_t direction) { quick_feedback(); - #if ENABLED(PREVENT_COLD_EXTRUSION) - if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage(F("Too cold")); - return; - } - #endif + if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { + drawMessage(F("Too cold")); + return; + } const float diff = motionAxisState.currentStepSize * direction; diff --git a/Marlin/src/lcd/tft_io/tft_io.h b/Marlin/src/lcd/tft_io/tft_io.h index 8f68d78900..a3635aaa93 100644 --- a/Marlin/src/lcd/tft_io/tft_io.h +++ b/Marlin/src/lcd/tft_io/tft_io.h @@ -58,6 +58,11 @@ #define TFT_ROTATE_270_MIRROR_X (TFT_ROTATE_270 ^ TFT_MIRROR_X) #define TFT_ROTATE_270_MIRROR_Y (TFT_ROTATE_270 ^ TFT_MIRROR_Y) +// TFT_ROTATION is user configurable +#ifndef TFT_ROTATION + #define TFT_ROTATION TFT_NO_ROTATION +#endif + // TFT_ORIENTATION is the "sum" of TFT_DEFAULT_ORIENTATION plus user TFT_ROTATION #define TFT_ORIENTATION ((TFT_DEFAULT_ORIENTATION) ^ (TFT_ROTATION)) diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 17c607da08..39506e21d6 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1418,12 +1418,8 @@ void prepare_line_to_destination() { #if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE) if (!DEBUGGING(DRYRUN) && destination.e != current_position.e) { - bool ignore_e = false; - - #if ENABLED(PREVENT_COLD_EXTRUSION) - ignore_e = thermalManager.tooColdToExtrude(active_extruder); - if (ignore_e) SERIAL_ECHO_MSG(STR_ERR_COLD_EXTRUDE_STOP); - #endif + bool ignore_e = thermalManager.tooColdToExtrude(active_extruder); + if (ignore_e) SERIAL_ECHO_MSG(STR_ERR_COLD_EXTRUDE_STOP); #if ENABLED(PREVENT_LENGTHY_EXTRUDE) const float e_delta = ABS(destination.e - current_position.e) * planner.e_factor[active_extruder]; diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 99d5603566..5d4ccc0a51 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -517,6 +517,9 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); #if ENABLED(PREVENT_COLD_EXTRUSION) bool Temperature::allow_cold_extrude = false; celsius_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP; +#else + constexpr bool Temperature::allow_cold_extrude; + constexpr celsius_t Temperature::extrude_min_temp; #endif #if HAS_ADC_BUTTONS diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 0b5f8caf3f..9ac5db44ed 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -643,6 +643,8 @@ class Temperature { static bool tooColdToExtrude(const uint8_t E_NAME) { return tooCold(wholeDegHotend(HOTEND_INDEX)); } static bool targetTooColdToExtrude(const uint8_t E_NAME) { return tooCold(degTargetHotend(HOTEND_INDEX)); } #else + static constexpr bool allow_cold_extrude = true; + static constexpr celsius_t extrude_min_temp = 0; static bool tooColdToExtrude(const uint8_t) { return false; } static bool targetTooColdToExtrude(const uint8_t) { return false; } #endif diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 7322098c0b..74e99ac093 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -929,7 +929,7 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0. * Returns FALSE if able to move. */ bool too_cold(uint8_t toolID){ - if (TERN0(PREVENT_COLD_EXTRUSION, !DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(toolID))) { + if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(toolID)) { SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD); return true; } @@ -1429,12 +1429,10 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { bool extruder_migration() { - #if ENABLED(PREVENT_COLD_EXTRUSION) - if (thermalManager.targetTooColdToExtrude(active_extruder)) { - DEBUG_ECHOLNPGM("Migration Source Too Cold"); - return false; - } - #endif + if (thermalManager.targetTooColdToExtrude(active_extruder)) { + DEBUG_ECHOLNPGM("Migration Source Too Cold"); + return false; + } // No auto-migration or specified target? if (!migration.target && active_extruder >= migration.last) {