Skip to content

Commit a6a2d4f

Browse files
ellenspthinkyhead
authored andcommitted
🐛 Fix misc. UI issues (MarlinFirmware#25252, MarlinFirmware#25319)
1 parent 3456728 commit a6a2d4f

16 files changed

+57
-44
lines changed

Marlin/src/gcode/host/M115.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ void GcodeSuite::M115() {
232232
const xyz_pos_t lmin = dmin.asLogical(), lmax = dmax.asLogical(),
233233
wmin = cmin.asLogical(), wmax = cmax.asLogical();
234234

235-
SERIAL_ECHOLNPGM(
235+
SERIAL_ECHOPGM(
236236
"area:{"
237237
"full:{"
238238
"min:{"
@@ -249,6 +249,8 @@ void GcodeSuite::M115() {
249249
),
250250
"}" // max
251251
"}," // full
252+
);
253+
SERIAL_ECHOLNPGM(
252254
"work:{"
253255
"min:{"
254256
LIST_N(DOUBLE(NUM_AXES),

Marlin/src/inc/Conditionals_adv.h

+4
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,10 @@
724724
#define HAS_MEDIA_SUBCALLS 1
725725
#endif
726726

727+
#if ANY(SHOW_PROGRESS_PERCENT, SHOW_ELAPSED_TIME, SHOW_REMAINING_TIME, SHOW_INTERACTION_TIME)
728+
#define HAS_EXTRA_PROGRESS 1
729+
#endif
730+
727731
#if HAS_PRINT_PROGRESS && EITHER(PRINT_PROGRESS_SHOW_DECIMALS, SHOW_REMAINING_TIME)
728732
#define HAS_PRINT_PROGRESS_PERMYRIAD 1
729733
#endif

Marlin/src/inc/SanityCheck.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS
946946
#error "SET_PROGRESS_MANUALLY requires at least one of SET_PROGRESS_PERCENT, SET_REMAINING_TIME, SET_INTERACTION_TIME to be enabled."
947947
#endif
948948

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

Marlin/src/lcd/dogm/status_screen_DOGM.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,12 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
444444
}
445445

446446
// Prepare strings for progress display
447-
#if HAS_PRINT_PROGRESS
447+
#if EITHER(HAS_EXTRA_PROGRESS, HAS_PRINT_PROGRESS)
448448
static MarlinUI::progress_t progress = 0;
449449
static char bufferc[13];
450+
#endif
451+
452+
#if HAS_EXTRA_PROGRESS
450453

451454
static void prepare_time_string(const duration_t &time, char prefix) {
452455
char str[13];
@@ -484,7 +487,8 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
484487
if (printJobOngoing())
485488
prepare_time_string(print_job_timer.duration(), 'E'); }
486489
#endif
487-
#endif // HAS_PRINT_PROGRESS
490+
491+
#endif // HAS_EXTRA_PROGRESS
488492

489493
/**
490494
* Draw the Status Screen for a 128x64 DOGM (U8glib) display.

Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
705705
void ST7920_Lite_Status_Screen::drawRemain() {
706706
const duration_t remaint = TERN0(SET_REMAINING_TIME, ui.get_remaining_time());
707707
if (printJobOngoing() && remaint.value) {
708-
draw_progress_string( PPOS, prepare_time_string(remaint, 'R'));
708+
draw_progress_string(PPOS, prepare_time_string(remaint, 'R'));
709709
}
710710
}
711711
#endif
@@ -714,7 +714,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
714714
void ST7920_Lite_Status_Screen::drawInter() {
715715
const duration_t interactt = ui.interaction_time;
716716
if (printingIsActive() && interactt.value) {
717-
draw_progress_string( PPOS, prepare_time_string(interactt, 'C'));
717+
draw_progress_string(PPOS, prepare_time_string(interactt, 'C'));
718718
}
719719
}
720720
#endif
@@ -723,7 +723,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
723723
void ST7920_Lite_Status_Screen::drawElapsed() {
724724
if (printJobOngoing()) {
725725
const duration_t elapsedt = print_job_timer.duration();
726-
draw_progress_string( PPOS, prepare_time_string(elapsedt, 'E'));
726+
draw_progress_string(PPOS, prepare_time_string(elapsedt, 'E'));
727727
}
728728
}
729729
#endif

Marlin/src/lcd/marlinui.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -1743,9 +1743,11 @@ void MarlinUI::init() {
17431743
);
17441744
}
17451745

1746-
#if LCD_WITH_BLINK && DISABLED(HAS_GRAPHICAL_TFT)
1747-
typedef void (*PrintProgress_t)();
1748-
void MarlinUI::rotate_progress() { // Renew and redraw all enabled progress strings
1746+
#if LCD_WITH_BLINK && HAS_EXTRA_PROGRESS
1747+
1748+
// Renew and redraw all enabled progress strings
1749+
void MarlinUI::rotate_progress() {
1750+
typedef void (*PrintProgress_t)();
17491751
const PrintProgress_t progFunc[] = {
17501752
OPTITEM(SHOW_PROGRESS_PERCENT, drawPercent)
17511753
OPTITEM(SHOW_ELAPSED_TIME, drawElapsed)
@@ -1760,7 +1762,8 @@ void MarlinUI::init() {
17601762
(*progFunc[i])();
17611763
}
17621764
}
1763-
#endif
1765+
1766+
#endif // LCD_WITH_BLINK && HAS_EXTRA_PROGRESS
17641767

17651768
#endif // HAS_PRINT_PROGRESS
17661769

Marlin/src/lcd/marlinui.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ class MarlinUI {
334334
FORCE_INLINE static uint16_t get_progress_permyriad() { return _get_progress(); }
335335
#endif
336336
static uint8_t get_progress_percent() { return uint8_t(_get_progress() / (PROGRESS_SCALE)); }
337-
#if LCD_WITH_BLINK
337+
#if LCD_WITH_BLINK && HAS_EXTRA_PROGRESS
338338
#if ENABLED(SHOW_PROGRESS_PERCENT)
339339
static void drawPercent();
340340
#endif
@@ -348,6 +348,8 @@ class MarlinUI {
348348
static void drawInter();
349349
#endif
350350
static void rotate_progress();
351+
#else
352+
static void rotate_progress() {}
351353
#endif
352354
#else
353355
static constexpr uint8_t get_progress_percent() { return 0; }

Marlin/src/lcd/menu/menu_advanced.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ void menu_backlash();
377377

378378
#if ENABLED(MPC_INCLUDE_FAN)
379379
#define MPC_EDIT_ITEMS(N) \
380-
MPC_t &mpc = thermalManager.temp_hotend[MenuItemBase::itemIndex].constants; \
380+
MPC_t &mpc = thermalManager.temp_hotend[MenuItemBase::itemIndex].mpc; \
381381
_MPC_EDIT_ITEMS(N); \
382382
EDIT_ITEM_FAST_N(float43, N, MSG_MPC_AMBIENT_XFER_COEFF_FAN_E, &editable.decimal, 0, 1, []{ \
383383
thermalManager.temp_hotend[MenuItemBase::itemIndex].applyFanAdjustment(editable.decimal); \

Marlin/src/lcd/tft/ui_1024x600.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -675,12 +675,10 @@ static void drawAxisValue(const AxisEnum axis) {
675675
static void moveAxis(const AxisEnum axis, const int8_t direction) {
676676
quick_feedback();
677677

678-
#if ENABLED(PREVENT_COLD_EXTRUSION)
679-
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
680-
drawMessage(F("Too cold"));
681-
return;
682-
}
683-
#endif
678+
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
679+
drawMessage(F("Too cold"));
680+
return;
681+
}
684682

685683
const float diff = motionAxisState.currentStepSize * direction;
686684

Marlin/src/lcd/tft/ui_320x240.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -768,12 +768,10 @@ static void drawAxisValue(const AxisEnum axis) {
768768
static void moveAxis(const AxisEnum axis, const int8_t direction) {
769769
quick_feedback();
770770

771-
#if ENABLED(PREVENT_COLD_EXTRUSION)
772-
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
773-
drawMessage(F("Too cold"));
774-
return;
775-
}
776-
#endif
771+
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
772+
drawMessage(F("Too cold"));
773+
return;
774+
}
777775

778776
const float diff = motionAxisState.currentStepSize * direction;
779777

Marlin/src/lcd/tft/ui_480x320.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -656,12 +656,10 @@ static void drawAxisValue(const AxisEnum axis) {
656656
static void moveAxis(const AxisEnum axis, const int8_t direction) {
657657
quick_feedback();
658658

659-
#if ENABLED(PREVENT_COLD_EXTRUSION)
660-
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
661-
drawMessage(F("Too cold"));
662-
return;
663-
}
664-
#endif
659+
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
660+
drawMessage(F("Too cold"));
661+
return;
662+
}
665663

666664
const float diff = motionAxisState.currentStepSize * direction;
667665

Marlin/src/lcd/tft_io/tft_io.h

+5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
#define TFT_ROTATE_270_MIRROR_X (TFT_ROTATE_270 ^ TFT_MIRROR_X)
5959
#define TFT_ROTATE_270_MIRROR_Y (TFT_ROTATE_270 ^ TFT_MIRROR_Y)
6060

61+
// TFT_ROTATION is user configurable
62+
#ifndef TFT_ROTATION
63+
#define TFT_ROTATION TFT_NO_ROTATION
64+
#endif
65+
6166
// TFT_ORIENTATION is the "sum" of TFT_DEFAULT_ORIENTATION plus user TFT_ROTATION
6267
#define TFT_ORIENTATION ((TFT_DEFAULT_ORIENTATION) ^ (TFT_ROTATION))
6368

Marlin/src/module/motion.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -1420,12 +1420,8 @@ void prepare_line_to_destination() {
14201420
#if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE)
14211421

14221422
if (!DEBUGGING(DRYRUN) && destination.e != current_position.e) {
1423-
bool ignore_e = false;
1424-
1425-
#if ENABLED(PREVENT_COLD_EXTRUSION)
1426-
ignore_e = thermalManager.tooColdToExtrude(active_extruder);
1427-
if (ignore_e) SERIAL_ECHO_MSG(STR_ERR_COLD_EXTRUDE_STOP);
1428-
#endif
1423+
bool ignore_e = thermalManager.tooColdToExtrude(active_extruder);
1424+
if (ignore_e) SERIAL_ECHO_MSG(STR_ERR_COLD_EXTRUDE_STOP);
14291425

14301426
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
14311427
const float e_delta = ABS(destination.e - current_position.e) * planner.e_factor[active_extruder];

Marlin/src/module/temperature.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,9 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED);
560560
#if ENABLED(PREVENT_COLD_EXTRUSION)
561561
bool Temperature::allow_cold_extrude = false;
562562
celsius_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
563+
#else
564+
constexpr bool Temperature::allow_cold_extrude;
565+
constexpr celsius_t Temperature::extrude_min_temp;
563566
#endif
564567

565568
#if HAS_ADC_BUTTONS

Marlin/src/module/temperature.h

+2
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,8 @@ class Temperature {
643643
static bool tooColdToExtrude(const uint8_t E_NAME) { return tooCold(wholeDegHotend(HOTEND_INDEX)); }
644644
static bool targetTooColdToExtrude(const uint8_t E_NAME) { return tooCold(degTargetHotend(HOTEND_INDEX)); }
645645
#else
646+
static constexpr bool allow_cold_extrude = true;
647+
static constexpr celsius_t extrude_min_temp = 0;
646648
static bool tooColdToExtrude(const uint8_t) { return false; }
647649
static bool targetTooColdToExtrude(const uint8_t) { return false; }
648650
#endif

Marlin/src/module/tool_change.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
929929
* Returns FALSE if able to move.
930930
*/
931931
bool too_cold(uint8_t toolID){
932-
if (TERN0(PREVENT_COLD_EXTRUSION, !DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(toolID))) {
932+
if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(toolID)) {
933933
SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD);
934934
return true;
935935
}
@@ -1437,12 +1437,10 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
14371437

14381438
bool extruder_migration() {
14391439

1440-
#if ENABLED(PREVENT_COLD_EXTRUSION)
1441-
if (thermalManager.targetTooColdToExtrude(active_extruder)) {
1442-
DEBUG_ECHOLNPGM("Migration Source Too Cold");
1443-
return false;
1444-
}
1445-
#endif
1440+
if (thermalManager.targetTooColdToExtrude(active_extruder)) {
1441+
DEBUG_ECHOLNPGM("Migration Source Too Cold");
1442+
return false;
1443+
}
14461444

14471445
// No auto-migration or specified target?
14481446
if (!migration.target && active_extruder >= migration.last) {

0 commit comments

Comments
 (0)