Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/bugfix-2.1.x' into bugfix-2.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rondlh committed Oct 28, 2023
2 parents 34dd6bc + cb8df74 commit e096917
Show file tree
Hide file tree
Showing 43 changed files with 571 additions and 333 deletions.
10 changes: 8 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# editorconfig.org
root = true

[*]
trim_trailing_whitespace = true
insert_final_newline = true

[{*.patch,syntax_test_*}]
trim_trailing_whitespace = false

[{*.c,*.cpp,*.h,*.ino,*.py,Makefile}]
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf

[{*.c,*.cpp,*.h,*.ino}]
Expand All @@ -18,6 +20,10 @@ indent_size = 2
indent_style = tab
indent_size = 2

[*.md]
# Two spaces at the end of the line means newline in Markdown
trim_trailing_whitespace = false

[{*.py}]
indent_style = space
indent_size = 4
Expand Down
8 changes: 1 addition & 7 deletions .github/code_of_conduct.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,9 @@ Project maintainers are responsible for clarifying the standards of acceptable b

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [marlinfirmware@github.com](mailto:marlinfirmware@github.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by messaging @MarlinFirmware/moderators on the relevant issue, [or privately](//github.com/orgs/MarlinFirmware/teams/moderators). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances.

## Attribution

Expand Down
2 changes: 1 addition & 1 deletion .github/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The following is a set of guidelines for contributing to Marlin, hosted by the [

## Code of Conduct

This project and everyone participating in it is governed by the [Marlin Code of Conduct](code_of_conduct.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [marlinfirmware@github.com](mailto:marlinfirmware@github.com).
This project and everyone participating in it is governed by the [Marlin Code of Conduct](code_of_conduct.md). By participating, you are expected to uphold this code. Please report unacceptable behavior by messaging @MarlinFirmware/moderators on the relevant issue, [or privately](//github.com/orgs/MarlinFirmware/teams/moderators).

## I don't want to read this whole thing I just have a question!!!

Expand Down
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode-remote.remote-containers",
"ms-vscode.cpptools-extension-pack"
]
}
6 changes: 1 addition & 5 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1257,11 +1257,6 @@
#define XY_FREQUENCY_MIN_PERCENT 5 // (percent) Minimum FR percentage to apply. Set with M201 G<min%>.
#endif

// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end
// of the buffer and all stops. This should not be much greater than zero and should only be changed
// if unwanted behavior is observed on a user's machine when running at very slow speeds.
#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s)

//
// Backlash Compensation
// Adds extra movement to axes on direction-changes to account for backlash.
Expand Down Expand Up @@ -4247,6 +4242,7 @@
// row. By default idle() is profiled so this shows how "idle" the processor is.
// See class CodeProfiler.
//#define MAX7219_DEBUG_MULTISTEPPING 6 // Show multi-stepping 1 to 128 on this LED matrix row.
//#define MAX7219_DEBUG_SLOWDOWN 6 // Count (mod 16) how many times SLOWDOWN has reduced print speed.
#endif

/**
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-20"
//#define STRING_DISTRIBUTION_DATE "2023-10-28"

/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/core/serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
#include "../feature/ethernet.h"
#endif

uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE;
// Echo commands to the terminal by default in dev mode
uint8_t marlin_debug_flags = TERN(MARLIN_DEV_MODE, MARLIN_DEBUG_ECHO, MARLIN_DEBUG_NONE);

// Commonly-used strings in serial output
PGMSTR(SP_A_STR, " A"); PGMSTR(SP_B_STR, " B"); PGMSTR(SP_C_STR, " C");
Expand Down
9 changes: 9 additions & 0 deletions Marlin/src/feature/max7219.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,15 @@ void Max7219::idle_tasks() {
}
#endif

#ifdef MAX7219_DEBUG_SLOWDOWN
static uint8_t last_slowdown_count = 0;
const uint8_t slowdown_count = Planner::slowdown_count;
if (slowdown_count != last_slowdown_count) {
mark16(MAX7219_DEBUG_SLOWDOWN, last_slowdown_count, slowdown_count, &row_change_mask);
last_slowdown_count = slowdown_count;
}
#endif

// batch line updates
suspended--;
if (!suspended)
Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,13 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
#endif
#endif

#if HAS_EXTRUDERS
#if HAS_HOTEND
HOTEND_LOOP() info.target_temperature[e] = thermalManager.degTargetHotend(e);
#endif

TERN_(HAS_HEATED_BED, info.target_temperature_bed = thermalManager.degTargetBed());

#if HAS_FAN
COPY(info.fan_speed, thermalManager.fan_speed);
#endif
TERN_(HAS_FAN, COPY(info.fan_speed, thermalManager.fan_speed));

#if HAS_LEVELING
info.flag.leveling = planner.leveling_active;
Expand Down Expand Up @@ -672,7 +670,9 @@ void PrintJobRecovery::resume() {

DEBUG_ECHOLNPGM("flag.dryrun: ", AS_DIGIT(info.flag.dryrun));
DEBUG_ECHOLNPGM("flag.allow_cold_extrusion: ", AS_DIGIT(info.flag.allow_cold_extrusion));
DEBUG_ECHOLNPGM("flag.volumetric_enabled: ", AS_DIGIT(info.flag.volumetric_enabled));
#if DISABLED(NO_VOLUMETRICS)
DEBUG_ECHOLNPGM("flag.volumetric_enabled: ", AS_DIGIT(info.flag.volumetric_enabled));
#endif
}
else
DEBUG_ECHOLNPGM("INVALID DATA");
Expand Down
7 changes: 3 additions & 4 deletions Marlin/src/gcode/bedlevel/G35.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
* 41 - Counter-Clockwise M4
* 50 - Clockwise M5
* 51 - Counter-Clockwise M5
**/
*
*/
void GcodeSuite::G35() {
DEBUG_SECTION(log_G35, "G35", DEBUGGING(LEVELING));

Expand All @@ -82,9 +83,7 @@ void GcodeSuite::G35() {
set_bed_leveling_enabled(false);
#endif

#if ENABLED(CNC_WORKSPACE_PLANES)
workspace_plane = PLANE_XY;
#endif
TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY);

probe.use_probing_tool();

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@
#define _HAS_1(N) (defined(MAIN_MENU_ITEM_##N##_DESC) && defined(MAIN_MENU_ITEM_##N##_GCODE))
#define HAS_USER_ITEM(V...) DO(HAS,||,V)
#else
#define HAS_USER_ITEM(N) 0
#define HAS_USER_ITEM(...) 0
#endif

/**
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -3463,8 +3463,8 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive."
#error "CNC_COORDINATE_SYSTEMS is incompatible with NO_WORKSPACE_OFFSETS."
#endif

#if !BLOCK_BUFFER_SIZE || !IS_POWER_OF_2(BLOCK_BUFFER_SIZE)
#error "BLOCK_BUFFER_SIZE must be a power of 2."
#if !BLOCK_BUFFER_SIZE
#error "BLOCK_BUFFER_SIZE must be non-zero."
#elif BLOCK_BUFFER_SIZE > 64
#error "A very large BLOCK_BUFFER_SIZE is not needed and takes longer to drain the buffer on pause / cancel."
#endif
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-20"
#define STRING_DISTRIBUTION_DATE "2023-10-28"
#endif

/**
Expand Down
39 changes: 27 additions & 12 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 Expand Up @@ -1233,8 +1248,8 @@ void MarlinUI::draw_status_screen() {
}

// The Select Screen presents a prompt and two "buttons"
void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const pref, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) {
ui.draw_select_screen_prompt(pref, string, suff);
void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const fpre, const char * const string/*=nullptr*/, FSTR_P const fsuf/*=nullptr*/) {
ui.draw_select_screen_prompt(fpre, string, fsuf);
if (no) {
SETCURSOR(0, LCD_HEIGHT - 1);
lcd_put_lchar(yesno ? ' ' : '['); lcd_put_u8str(no); lcd_put_lchar(yesno ? ' ' : ']');
Expand Down
41 changes: 27 additions & 14 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 Expand Up @@ -1051,9 +1064,9 @@ void MarlinUI::draw_status_screen() {
}

// The Select Screen presents a prompt and two "buttons"
void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const pref, const char * const string, FSTR_P const suff) {
void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const fpre, const char * const string, FSTR_P const fsuf) {
if (!PanelDetected) return;
ui.draw_select_screen_prompt(pref, string, suff);
ui.draw_select_screen_prompt(fpre, string, fsuf);
lcd.write(COLOR_EDIT);
if (no) {
lcd_moveto(0, MIDDLE_Y);
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/lcd/dogm/lcdprint_u8g.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,19 @@ int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) {
return ret;
}

/**
* @return output width in pixels
*/
int lcd_put_u8str_max(const char * utf8_str, const pixel_len_t max_length) {
u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(),
ret = uxg_DrawUtf8Str(u8g.getU8g(), x, y, utf8_str, max_length);
u8g.setPrintPos(x + ret, y);
return ret;
}

/**
* @return output width in pixels
*/
int lcd_put_u8str_max_P(PGM_P utf8_pstr, const pixel_len_t max_length) {
u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(),
ret = uxg_DrawUtf8StrP(u8g.getU8g(), x, y, utf8_pstr, max_length);
Expand Down
Loading

0 comments on commit e096917

Please sign in to comment.