Skip to content

Commit

Permalink
Merge branch 'MarlinFirmware:bugfix-2.1.x' into mecha-octopus
Browse files Browse the repository at this point in the history
  • Loading branch information
Djonker83 authored Oct 22, 2023
2 parents 947c497 + f725885 commit a15db47
Show file tree
Hide file tree
Showing 24 changed files with 856 additions and 550 deletions.
19 changes: 18 additions & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2780,7 +2780,21 @@
* - Switch to a different nozzle on an extruder jam
*/
#define TOOLCHANGE_MIGRATION_FEATURE

#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
// Override toolchange settings
// By default tool migration uses regular toolchange settings.
// With a prime tower, tool-change swapping/priming occur inside the bed.
// When migrating to a new unprimed tool you can set override values below.
//#define MIGRATION_ZRAISE 0 // (mm)

// Longer prime to clean out
//#define MIGRATION_FS_EXTRA_PRIME 0 // (mm) Extra priming length
//#define MIGRATION_FS_WIPE_RETRACT 0 // (mm) Retract before cooling for less stringing, better wipe, etc.

// Cool after prime to reduce stringing
//#define MIGRATION_FS_FAN_SPEED 255 // 0-255
//#define MIGRATION_FS_FAN_TIME 0 // (seconds)
#endif
#endif

/**
Expand All @@ -2793,6 +2807,9 @@
#define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/min)
//#define TOOLCHANGE_PARK_X_ONLY // X axis only move
//#define TOOLCHANGE_PARK_Y_ONLY // Y axis only move
#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
//#define TOOLCHANGE_MIGRATION_DO_PARK // Force park (or no-park) on migration
#endif
#endif
#endif // HAS_MULTI_EXTRUDER

Expand Down
2 changes: 1 addition & 1 deletion Marlin/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2023-10-15"
//#define STRING_DISTRIBUTION_DATE "2023-10-21"

/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@
#define BOARD_ZONESTAR_ZM3E4V2 5064 // Zonestar ZM3E4 V2 (STM32F103VC)
#define BOARD_ERYONE_ERY32_MINI 5065 // Eryone Ery32 mini (STM32F103VE)
#define BOARD_PANDA_PI_V29 5066 // Panda Pi V2.9 - Standalone (STM32F103RC)
#define BOARD_SOVOL_V131 5067 // Sovol V1.3.1 (GD32F103RET6)
#define BOARD_SOVOL_V131 5067 // Sovol V1.3.1 (GD32F103RE)
#define BOARD_TRIGORILLA_V006 5068 // Trigorilla V0.0.6 (GD32F103RE)
#define BOARD_KEDI_CONTROLLER_V1_2 5069 // EDUTRONICS Kedi Controller V1.2 (STM32F103RC)

Expand Down
18 changes: 18 additions & 0 deletions Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,24 @@
#undef TC_GCODE_USE_GLOBAL_Z
#endif

// TOOLCHANGE_MIGRATION_FEATURE - Clean up after sloppy auto config
#if DISABLED(TOOLCHANGE_MIGRATION_FEATURE)
#undef MIGRATION_ZRAISE
#undef MIGRATION_FS_EXTRA_PRIME
#undef MIGRATION_FS_WIPE_RETRACT
#undef MIGRATION_FS_FAN_SPEED
#undef MIGRATION_FS_FAN_TIME
#undef TOOLCHANGE_MIGRATION_DO_PARK
#endif
// TOOLCHANGE_PARK - Clean up after sloppy auto config
#if DISABLED(TOOLCHANGE_PARK)
#undef TOOLCHANGE_PARK_XY
#undef TOOLCHANGE_PARK_XY_FEEDRATE
#undef TOOLCHANGE_PARK_X_ONLY
#undef TOOLCHANGE_PARK_Y_ONLY
#undef TOOLCHANGE_MIGRATION_DO_PARK
#endif

// Multi-Stepping Limit
#ifndef MULTISTEPPING_LIMIT
#define MULTISTEPPING_LIMIT 128
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2023-10-15"
#define STRING_DISTRIBUTION_DATE "2023-10-21"
#endif

/**
Expand Down
35 changes: 25 additions & 10 deletions Marlin/src/lcd/HD44780/marlinui_HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1165,28 +1165,43 @@ void MarlinUI::draw_status_screen() {
#endif // ADVANCED_PAUSE_FEATURE

// Draw a static item with no left-right margin required. Centered by default.
void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char *vstr/*=nullptr*/) {
void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t style/*=SS_DEFAULT*/, const char *vstr/*=nullptr*/) {
lcd_moveto(0, row);

int8_t n = LCD_WIDTH;
const bool center = bool(style & SS_CENTER), full = bool(style & SS_FULL);
const int8_t plen = fstr ? utf8_strlen(fstr) : 0,
vlen = vstr ? utf8_strlen(vstr) : 0;
int8_t pad = (center || full) ? n - plen - vlen : 0;

// Value length, if any
int8_t vlen = vstr ? utf8_strlen(vstr) : 0;

// Expanded label string and width in chars
char estr[calculateWidth(ftpl) + 3] = "\0";
int8_t llen = ftpl ? expand_u8str(estr, ftpl, itemIndex, itemStringC, itemStringF, n - vlen) : 0;

bool mv_colon = false;
if (vlen) {
// Move the leading colon from the value to the label below
mv_colon = (*vstr == ':');
// Shorter value, wider label
if (mv_colon) { vstr++; vlen--; llen++; }
// Remove leading spaces from the value and shorten
while (*vstr == ' ') { vstr++; vlen--; }
}

// Padding for center or full justification
int8_t pad = (center || full) ? n - llen - vlen : 0;

// SS_CENTER: Pad with half of the unused space first
if (center) for (int8_t lpad = pad / 2; lpad > 0; --lpad) { lcd_put_u8str(F(" ")); n--; }
if (center) for (int8_t lpad = pad / 2; lpad > 0; --lpad, --pad, --n) lcd_put_u8str(F(" "));

// Draw as much of the label as fits
if (plen) n -= lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n - vlen);
// Draw as much of the label as fits (without the relocated colon, drawn below)
if (llen) n -= lcd_put_u8str_max(estr, n - vlen);

if (vlen && n > 0) {
// SS_FULL: Pad with enough space to justify the value
if (full && !center) {
// Move the leading colon from the value to the label
if (*vstr == ':') { n -= lcd_put_u8str(F(":")); vstr++; }
// Move spaces to the padding
while (*vstr == ' ') { vstr++; pad++; }
if (mv_colon) n -= lcd_put_u8str(F(":"));
// Pad in-between
for (; pad > 0; --pad) { lcd_put_u8str(F(" ")); n--; }
}
Expand Down
37 changes: 25 additions & 12 deletions Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,29 +969,42 @@ void MarlinUI::draw_status_screen() {
#endif

// Draw a static item with no left-right margin required. Centered by default.
void MenuItem_static::draw(const uint8_t row, FSTR_P const fstr, const uint8_t style/*=SS_DEFAULT*/, const char *vstr/*=nullptr*/) {
void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t style/*=SS_DEFAULT*/, const char *vstr/*=nullptr*/) {
if (!PanelDetected) return;
lcd_moveto(0, row);

uint8_t n = LCD_WIDTH;
const bool center = bool(style & SS_CENTER), full = bool(style & SS_FULL);
const int8_t plen = fstr ? utf8_strlen(fstr) : 0,
vlen = vstr ? utf8_strlen(vstr) : 0;
int8_t pad = (center || full) ? n - plen - vlen : 0;

// Value length, if any
int8_t vlen = vstr ? utf8_strlen(vstr) : 0;

char estr[utf8_strlen(ftpl) + 3] = "\0";
int8_t llen = ftpl ? expand_u8str(estr, ftpl, itemIndex, itemStringC, itemStringF, n - vlen) : 0;

bool mv_colon = false;
if (vlen) {
// Move the leading colon from the value to the label below
mv_colon = (*vstr == ':');
// Shorter value, wider label
if (mv_colon) { vstr++; vlen--; llen++; }
// Remove leading spaces from the value and shorten
while (*vstr == ' ') { vstr++; vlen--; }
}

int8_t pad = (center || full) ? n - llen - vlen : 0;

// SS_CENTER: Pad with half of the unused space first
if (center) for (int8_t lpad = pad / 2; lpad > 0; --lpad) { lcd.write(' '); n--; }

// Draw as much of the label as fits
if (plen) n -= lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n - vlen);
if (llen) n -= lcd_put_u8str_max(estr, n - vlen);

if (vlen && n > 0) {
// SS_FULL: Pad with enough space to justify the value
if (full && !center) {
// Move the leading colon from the value to the label
if (*vstr == ':') { lcd.write(':'); vstr++; n--; }
// Move spaces to the padding
while (*vstr == ' ') { vstr++; pad++; }
if (mv_colon) { lcd.write(':'); n--; }
// Pad in-between
for (; pad > 0; --pad) { lcd.write(' '); n--; }
}
Expand All @@ -1004,25 +1017,25 @@ void MarlinUI::draw_status_screen() {
}

// Draw a generic menu item with pre_char (if selected) and post_char
void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char pre_char, const char post_char) {
void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char pre_char, const char post_char) {
if (!PanelDetected) return;
lcd_moveto(0, row);
lcd.write(sel ? pre_char : ' ');
uint8_t n = LCD_WIDTH - 2;
n -= lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n);
n -= lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n);
for (; n; --n) lcd.write(' ');
lcd.write(post_char);
lcd.print_line();
}

// Draw a menu item with a (potentially) editable value
void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const fstr, const char * const inStr, const bool pgm) {
void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) {
if (!PanelDetected) return;
const uint8_t vlen = inStr ? (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)) : 0;
lcd_moveto(0, row);
lcd.write(sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
uint8_t n = LCD_WIDTH - 2 - vlen;
n -= lcd_put_u8str(fstr, itemIndex, itemStringC, itemStringF, n);
n -= lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n);
if (vlen) {
lcd.write(':');
for (; n; --n) lcd.write(' ');
Expand Down
121 changes: 68 additions & 53 deletions Marlin/src/lcd/dogm/marlinui_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,63 +411,78 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop

// Draw a static line of text in the same idiom as a menu item
void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t style/*=SS_DEFAULT*/, const char *vstr/*=nullptr*/) {
if (!mark_as_selected(row, style & SS_INVERT)) return;

if (mark_as_selected(row, style & SS_INVERT)) {
pixel_len_t n = LCD_PIXEL_WIDTH; // pixel width of string allowed

const bool center = bool(style & SS_CENTER), full = bool(style & SS_FULL);
const int pwide = ftpl ? calculateWidth(ftpl) : 0,
vlen = vstr ? utf8_strlen(vstr) : 0;
int pad = (center || full) ? ((LCD_PIXEL_WIDTH) - pwide - vlen * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH) : 0;

// SS_CENTER: Pad with half of the unused space first
if (center) for (int lpad = pad / 2; lpad > 0; --lpad) n -= lcd_put_u8str(F(" "));

// Draw as much of the label as fits
if (pwide) n -= lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH);

if (vlen) {
// SS_FULL: Pad with enough space to justify the value
if (full && !center && n > MENU_FONT_WIDTH) {
// Move the leading colon from the value to the label
if (*vstr == ':') { n -= lcd_put_u8str(F(":")); vstr++; }
// Move spaces to the padding
while (*vstr == ' ') { vstr++; pad++; }
// Pad in-between
for (; pad > 0; --pad) n -= lcd_put_u8str(F(" "));
}
n -= lcd_put_u8str_max(vstr, n);
pixel_len_t n = LCD_PIXEL_WIDTH; // pixel width of string allowed
const bool center = bool(style & SS_CENTER), full = bool(style & SS_FULL);

char estr[calculateWidth(ftpl) + 3] = "\0";
pixel_len_t lwide = ftpl ? (MENU_FONT_WIDTH) * expand_u8str(estr, ftpl, itemIndex, itemStringC, itemStringF, (LCD_PIXEL_WIDTH) / (MENU_FONT_WIDTH)) : 0;

// Value length, if any
int8_t vlen = vstr ? utf8_strlen(vstr) : 0;

bool mv_colon = false;
if (vlen) {
// Move the leading colon from the value to the label below
mv_colon = (*vstr == ':');
// Shorter value, wider label
if (mv_colon) { vstr++; vlen--; lwide += MENU_FONT_WIDTH; }
// Remove leading spaces from the value and shorten
while (*vstr == ' ') { vstr++; vlen--; }
}

// Padding for center or full justification
int8_t pad = (center || full) ? ((LCD_PIXEL_WIDTH) - lwide - vlen * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH) : 0;

// SS_CENTER: Pad with half of the unused space first
if (center) for (int8_t lpad = pad / 2; lpad > 0; --lpad) n -= lcd_put_u8str(F(" "));

// Draw as much of the label as fits (without the relocated colon, drawn below)
if (lwide) lcd_put_u8str_max(estr, n);

// Value string?
if (vlen) {
// SS_FULL: Pad with enough space to justify the value
if (full && !center && n > MENU_FONT_WIDTH) {
// Draw the leading colon moved from the value to the label
if (mv_colon) n -= lcd_put_u8str(F(":"));
// Pad in-between
for (; pad > 0; --pad) n -= lcd_put_u8str(F(" "));
}
while (n > MENU_FONT_WIDTH) n -= lcd_put_u8str(F(" "));
// Draw the value string
n -= lcd_put_u8str_max(vstr, n);
}
// Always fill out the rest with spaces
while (n > MENU_FONT_WIDTH) n -= lcd_put_u8str(F(" "));
}

// Draw a generic menu item
void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char, const char post_char) {
if (mark_as_selected(row, sel)) {
uint8_t n = LCD_WIDTH - 1;
n -= lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n);
for (; n; --n) lcd_put_u8str(F(" "));
lcd_put_lchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char);
lcd_put_u8str(F(" "));
}
if (!mark_as_selected(row, sel)) return;

uint8_t n = LCD_WIDTH - 1;
n -= lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n);
for (; n; --n) lcd_put_u8str(F(" "));
lcd_put_lchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char);
lcd_put_u8str(F(" "));
}

// Draw a menu item with an editable value
void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) {
if (mark_as_selected(row, sel)) {
const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)),
pixelwidth = (pgm ? uxg_GetUtf8StrPixelWidthP(u8g.getU8g(), inStr) : uxg_GetUtf8StrPixelWidth(u8g.getU8g(), inStr));
const u8g_uint_t prop = USE_WIDE_GLYPH ? 2 : 1;

uint8_t n = LCD_WIDTH - 2 - vallen * prop;
n -= lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n);
if (vallen) {
lcd_put_u8str(F(":"));
for (; n; --n) lcd_put_u8str(F(" "));
lcd_moveto(LCD_PIXEL_WIDTH - _MAX((MENU_FONT_WIDTH) * vallen, pixelwidth + 2), row_y2);
if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
}
if (!mark_as_selected(row, sel)) return;

const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)),
pixelwidth = (pgm ? uxg_GetUtf8StrPixelWidthP(u8g.getU8g(), inStr) : uxg_GetUtf8StrPixelWidth(u8g.getU8g(), inStr));
const u8g_uint_t prop = USE_WIDE_GLYPH ? 2 : 1;

uint8_t n = LCD_WIDTH - 2 - vallen * prop;
n -= lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n);
if (vallen) {
lcd_put_u8str(F(":"));
for (; n; --n) lcd_put_u8str(F(" "));
lcd_moveto(LCD_PIXEL_WIDTH - _MAX((MENU_FONT_WIDTH) * vallen, pixelwidth + 2), row_y2);
if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
}
}

Expand Down Expand Up @@ -545,13 +560,13 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
#if HAS_MEDIA

void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) {
if (mark_as_selected(row, sel)) {
const uint8_t maxlen = LCD_WIDTH - isDir;
if (isDir) lcd_put_lchar(LCD_STR_FOLDER[0]);
const pixel_len_t pixw = maxlen * (MENU_FONT_WIDTH);
pixel_len_t n = pixw - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), pixw);
for (; n > MENU_FONT_WIDTH; n -= MENU_FONT_WIDTH) lcd_put_u8str(F(" "));
}
if (!mark_as_selected(row, sel)) return;

const uint8_t maxlen = LCD_WIDTH - isDir;
if (isDir) lcd_put_lchar(LCD_STR_FOLDER[0]);
const pixel_len_t pixw = maxlen * (MENU_FONT_WIDTH);
pixel_len_t n = pixw - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), pixw);
for (; n > MENU_FONT_WIDTH; n -= MENU_FONT_WIDTH) lcd_put_u8str(F(" "));
}

#endif // HAS_MEDIA
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/lcd/e3v2/common/dwin_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,9 @@
#define ICON_ProbeOffsetZ ICON_StepZ
#define ICON_PIDNozzle ICON_SetEndTemp
#define ICON_PIDbed ICON_SetBedTemp
#define ICON_FWRetract ICON_StepE
#define ICON_FWRetLength ICON_StepE
#define ICON_FWRetSpeed ICON_Setspeed
#define ICON_FWRetZRaise ICON_MoveZ
#define ICON_FWRecSpeed ICON_Setspeed
#define ICON_FWRecExtra ICON_StepE
Loading

0 comments on commit a15db47

Please sign in to comment.