Skip to content

Commit b7c2363

Browse files
ellenspthinkyhead
andauthored
🐛 Fix misc. UI issues (MarlinFirmware#25252)
Co-authored-by: Scott Lahteine <[email protected]>
1 parent f2b8942 commit b7c2363

16 files changed

+52
-43
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
@@ -656,6 +656,10 @@
656656
#define HAS_MEDIA_SUBCALLS 1
657657
#endif
658658

659+
#if ANY(SHOW_PROGRESS_PERCENT, SHOW_ELAPSED_TIME, SHOW_REMAINING_TIME, SHOW_INTERACTION_TIME)
660+
#define HAS_EXTRA_PROGRESS 1
661+
#endif
662+
659663
#if HAS_PRINT_PROGRESS && EITHER(PRINT_PROGRESS_SHOW_DECIMALS, SHOW_REMAINING_TIME)
660664
#define HAS_PRINT_PROGRESS_PERMYRIAD 1
661665
#endif

Marlin/src/inc/SanityCheck.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
944944
#error "SET_PROGRESS_MANUALLY requires at least one of SET_PROGRESS_PERCENT, SET_REMAINING_TIME, SET_INTERACTION_TIME to be enabled."
945945
#endif
946946

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

Marlin/src/lcd/dogm/status_screen_DOGM.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ 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 HAS_EXTRA_PROGRESS
448448
static MarlinUI::progress_t progress = 0;
449449
static char bufferc[13];
450450

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
@@ -1418,12 +1418,8 @@ void prepare_line_to_destination() {
14181418
#if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE)
14191419

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

14281424
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
14291425
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
@@ -517,6 +517,9 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED);
517517
#if ENABLED(PREVENT_COLD_EXTRUSION)
518518
bool Temperature::allow_cold_extrude = false;
519519
celsius_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
520+
#else
521+
constexpr bool Temperature::allow_cold_extrude;
522+
constexpr celsius_t Temperature::extrude_min_temp;
520523
#endif
521524

522525
#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
}
@@ -1429,12 +1429,10 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
14291429

14301430
bool extruder_migration() {
14311431

1432-
#if ENABLED(PREVENT_COLD_EXTRUSION)
1433-
if (thermalManager.targetTooColdToExtrude(active_extruder)) {
1434-
DEBUG_ECHOLNPGM("Migration Source Too Cold");
1435-
return false;
1436-
}
1437-
#endif
1432+
if (thermalManager.targetTooColdToExtrude(active_extruder)) {
1433+
DEBUG_ECHOLNPGM("Migration Source Too Cold");
1434+
return false;
1435+
}
14381436

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

0 commit comments

Comments
 (0)