Skip to content

Commit

Permalink
🐛 Fix misc. UI issues (#25252, #25319)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellensp authored and thinkyhead committed Apr 10, 2023
1 parent 6d74df6 commit a67d36a
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 44 deletions.
4 changes: 3 additions & 1 deletion Marlin/src/gcode/host/M115.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:{"
Expand All @@ -249,6 +249,8 @@ void GcodeSuite::M115() {
),
"}" // max
"}," // full
);
SERIAL_ECHOLNPGM(
"work:{"
"min:{"
LIST_N(DOUBLE(NUM_AXES),
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_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

Expand Down
8 changes: 6 additions & 2 deletions Marlin/src/lcd/dogm/status_screen_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,12 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
}

// Prepare strings for progress display
#if HAS_PRINT_PROGRESS
#if EITHER(HAS_EXTRA_PROGRESS, HAS_PRINT_PROGRESS)
static MarlinUI::progress_t progress = 0;
static char bufferc[13];
#endif

#if HAS_EXTRA_PROGRESS

static void prepare_time_string(const duration_t &time, char prefix) {
char str[13];
Expand Down Expand Up @@ -484,7 +487,8 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
if (printJobOngoing())
prepare_time_string(print_job_timer.duration(), 'E'); }
#endif
#endif // HAS_PRINT_PROGRESS

#endif // HAS_EXTRA_PROGRESS

/**
* Draw the Status Screen for a 128x64 DOGM (U8glib) display.
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
11 changes: 7 additions & 4 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -1760,7 +1762,8 @@ void MarlinUI::init() {
(*progFunc[i])();
}
}
#endif

#endif // LCD_WITH_BLINK && HAS_EXTRA_PROGRESS

#endif // HAS_PRINT_PROGRESS

Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/lcd/marlinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class MarlinUI {
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
Expand All @@ -348,6 +348,8 @@ class MarlinUI {
static void drawInter();
#endif
static void rotate_progress();
#else
static void rotate_progress() {}
#endif
#else
static constexpr uint8_t get_progress_percent() { return 0; }
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_advanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand Down
10 changes: 4 additions & 6 deletions Marlin/src/lcd/tft/ui_1024x600.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 4 additions & 6 deletions Marlin/src/lcd/tft/ui_320x240.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 4 additions & 6 deletions Marlin/src/lcd/tft/ui_480x320.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/lcd/tft_io/tft_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
8 changes: 2 additions & 6 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,12 +1420,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];
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,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
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/module/temperature.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions Marlin/src/module/tool_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -1437,12 +1437,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) {
Expand Down

0 comments on commit a67d36a

Please sign in to comment.