Skip to content

Commit

Permalink
Merge branch 'MarlinFirmware:bugfix-2.1.x' into bugfix-2.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Djonker83 authored Jul 23, 2023
2 parents 616f34b + e451dec commit ea3e0e8
Show file tree
Hide file tree
Showing 48 changed files with 145 additions and 211 deletions.
14 changes: 8 additions & 6 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2206,7 +2206,6 @@
*/
#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
//#define INTEGRATED_BABYSTEPPING // Integration of babystepping into the Stepper ISR
//#define EP_BABYSTEPPING // M293/M294 babystepping with EMERGENCY_PARSER support
//#define BABYSTEP_WITHOUT_HOMING
//#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement)
Expand Down Expand Up @@ -3836,14 +3835,17 @@
//#define REPETIER_GCODE_M360 // Add commands originally from Repetier FW

/**
* Enable this option for a leaner build of Marlin that removes all
* workspace offsets, simplifying coordinate transformations, leveling, etc.
*
* - M206 and M428 are disabled.
* - G92 will revert to its behavior from Marlin 1.0.
* Enable this option for a leaner build of Marlin that removes
* workspace offsets to slightly optimize performance.
* G92 will revert to its behavior from Marlin 1.0.
*/
//#define NO_WORKSPACE_OFFSETS

/**
* Disable M206 and M428 if you don't need home offsets.
*/
//#define NO_HOME_OFFSETS

/**
* CNC G-code options
* Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc.
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-07-17"
//#define STRING_DISTRIBUTION_DATE "2023-07-22"

/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/HAL/ESP32/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@
#error "FAST_PWM_FAN is not available on TinyBee."
#endif

#if ALL(I2S_STEPPER_STREAM, BABYSTEPPING) && DISABLED(INTEGRATED_BABYSTEPPING)
#error "BABYSTEPPING on I2S stream requires INTEGRATED_BABYSTEPPING."
#endif

#if USING_PULLDOWNS
#error "PULLDOWN pin mode is not available on ESP32 boards."
#endif
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ void setup() {
SETUP_RUN(touchBt.init());
#endif

TERN_(HAS_M206_COMMAND, current_position += home_offset); // Init current position based on home_offset
TERN_(HAS_HOME_OFFSET, current_position += home_offset); // Init current position based on home_offset

sync_plan_position(); // Vital to init stepper/planner equivalent for current_position

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,9 @@
FORCE_INLINE constexpr T operator|(T x, T y) { return static_cast<T>(static_cast<int>(x) | static_cast<int>(y)); } \
FORCE_INLINE constexpr T operator^(T x, T y) { return static_cast<T>(static_cast<int>(x) ^ static_cast<int>(y)); } \
FORCE_INLINE constexpr T operator~(T x) { return static_cast<T>(~static_cast<int>(x)); } \
FORCE_INLINE T & operator&=(T &x, T y) { return x &= y; } \
FORCE_INLINE T & operator|=(T &x, T y) { return x |= y; } \
FORCE_INLINE T & operator^=(T &x, T y) { return x ^= y; }
FORCE_INLINE T & operator&=(T &x, T y) { x = x & y; return x; } \
FORCE_INLINE T & operator|=(T &x, T y) { x = x | y; return x; } \
FORCE_INLINE T & operator^=(T &x, T y) { x = x ^ y; return x; }

// C++11 solution that is standard compliant. <type_traits> is not available on all platform
namespace Private {
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/babystep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void Babystep::add_mm(const AxisEnum axis, const_float_t mm) {
steps[BS_AXIS_IND(axis)] = distance;
TERN_(BABYSTEP_DISPLAY_TOTAL, axis_total[BS_TOTAL_IND(axis)] = distance);
TERN_(BABYSTEP_ALWAYS_AVAILABLE, gcode.reset_stepper_timeout());
TERN_(INTEGRATED_BABYSTEPPING, if (has_steps()) stepper.initiateBabystepping());
TERN_(BABYSTEPPING, if (has_steps()) stepper.initiateBabystepping());
}
#endif

Expand All @@ -77,7 +77,7 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
steps[BS_AXIS_IND(axis)] += distance;
TERN_(BABYSTEP_DISPLAY_TOTAL, axis_total[BS_TOTAL_IND(axis)] += distance);
TERN_(BABYSTEP_ALWAYS_AVAILABLE, gcode.reset_stepper_timeout());
TERN_(INTEGRATED_BABYSTEPPING, if (has_steps()) stepper.initiateBabystepping());
TERN_(BABYSTEPPING, if (has_steps()) stepper.initiateBabystepping());
}

#if ENABLED(EP_BABYSTEPPING)
Expand Down
9 changes: 2 additions & 7 deletions Marlin/src/feature/babystep.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@

#include "../inc/MarlinConfigPre.h"

#if ENABLED(INTEGRATED_BABYSTEPPING)
#define BABYSTEPS_PER_SEC 1000UL
#define BABYSTEP_TICKS ((STEPPER_TIMER_RATE) / (BABYSTEPS_PER_SEC))
#else
#define BABYSTEPS_PER_SEC 976UL
#define BABYSTEP_TICKS ((TEMP_TIMER_RATE) / (BABYSTEPS_PER_SEC))
#endif
#define BABYSTEPS_PER_SEC 1000UL
#define BABYSTEP_TICKS ((STEPPER_TIMER_RATE) / (BABYSTEPS_PER_SEC))

#if ANY(IS_CORE, BABYSTEP_XY, I2C_POSITION_ENCODERS)
#define BS_AXIS_IND(A) A
Expand Down
13 changes: 5 additions & 8 deletions Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW

TERN_(GCODE_REPEAT_MARKERS, info.stored_repeat = repeat);
TERN_(HAS_HOME_OFFSET, info.home_offset = home_offset);
TERN_(HAS_POSITION_SHIFT, info.position_shift = position_shift);
TERN_(HAS_WORKSPACE_OFFSET, info.workspace_offset = workspace_offset);
E_TERN_(info.active_extruder = active_extruder);

#if DISABLED(NO_VOLUMETRICS)
Expand Down Expand Up @@ -552,10 +552,7 @@ void PrintJobRecovery::resume() {

TERN_(GCODE_REPEAT_MARKERS, repeat = info.stored_repeat);
TERN_(HAS_HOME_OFFSET, home_offset = info.home_offset);
TERN_(HAS_POSITION_SHIFT, position_shift = info.position_shift);
#if HAS_HOME_OFFSET || HAS_POSITION_SHIFT
LOOP_NUM_AXES(i) update_workspace_offset((AxisEnum)i);
#endif
TERN_(HAS_WORKSPACE_OFFSET, workspace_offset = info.workspace_offset);

// Relative axis modes
gcode.axis_relative = info.axis_relative;
Expand Down Expand Up @@ -600,11 +597,11 @@ void PrintJobRecovery::resume() {
DEBUG_EOL();
#endif

#if HAS_POSITION_SHIFT
DEBUG_ECHOPGM("position_shift: ");
#if HAS_WORKSPACE_OFFSET
DEBUG_ECHOPGM("workspace_offset: ");
LOOP_NUM_AXES(i) {
if (i) DEBUG_CHAR(',');
DEBUG_ECHO(info.position_shift[i]);
DEBUG_ECHO(info.workspace_offset[i]);
}
DEBUG_EOL();
#endif
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/powerloss.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ typedef struct {
#if HAS_HOME_OFFSET
xyz_pos_t home_offset;
#endif
#if HAS_POSITION_SHIFT
xyz_pos_t position_shift;
#if HAS_WORKSPACE_OFFSET
xyz_pos_t workspace_offset;
#endif
#if HAS_MULTI_EXTRUDER
uint8_t active_extruder;
Expand Down
9 changes: 1 addition & 8 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,7 @@
* (Z is already at the right height)
*/
constexpr xy_float_t safe_homing_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT };
#if HAS_HOME_OFFSET && DISABLED(Z_SAFE_HOMING_POINT_ABSOLUTE)
xy_float_t okay_homing_xy = safe_homing_xy;
okay_homing_xy -= home_offset;
#else
constexpr xy_float_t okay_homing_xy = safe_homing_xy;
#endif

destination.set(okay_homing_xy, current_position.z);
destination.set(safe_homing_xy, current_position.z);

TERN_(HOMING_Z_WITH_PROBE, destination -= probe.offset_xy);

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/calibrate/G33.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ void GcodeSuite::G33() {
SERIAL_ECHOLNPGM("Save with M500 and/or copy to Configuration.h");
}
else { // !end iterations
SString<14> msg;
SString<15> msg;
if (iterations < 31)
msg.setf(F("Iteration : %02i"), (unsigned int)iterations);
else
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 204: M204(); break; // M204: Set acceleration
case 205: M205(); break; // M205: Set advanced settings

#if HAS_M206_COMMAND
#if HAS_HOME_OFFSET
case 206: M206(); break; // M206: Set home offsets
#endif

Expand Down Expand Up @@ -881,7 +881,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 425: M425(); break; // M425: Tune backlash compensation
#endif

#if HAS_M206_COMMAND
#if HAS_HOME_OFFSET
case 428: M428(); break; // M428: Apply current_position to home_offset
#endif

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ class GcodeSuite {
static void M205();
static void M205_report(const bool forReplay=true);

#if HAS_M206_COMMAND
#if HAS_HOME_OFFSET
static void M206();
static void M206_report(const bool forReplay=true);
#endif
Expand Down Expand Up @@ -1043,7 +1043,7 @@ class GcodeSuite {
static void M425_report(const bool forReplay=true);
#endif

#if HAS_M206_COMMAND
#if HAS_HOME_OFFSET
static void M428();
#endif

Expand Down
7 changes: 1 addition & 6 deletions Marlin/src/gcode/geometry/G53-G59.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ bool GcodeSuite::select_coordinate_system(const int8_t _new) {
xyz_float_t new_offset{0};
if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1))
new_offset = coordinate_system[_new];
LOOP_NUM_AXES(i) {
if (position_shift[i] != new_offset[i]) {
position_shift[i] = new_offset[i];
update_workspace_offset((AxisEnum)i);
}
}
workspace_offset = new_offset;
return true;
}

Expand Down
12 changes: 4 additions & 8 deletions Marlin/src/gcode/geometry/G92.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ void GcodeSuite::G92() {

#if ENABLED(CNC_COORDINATE_SYSTEMS) && !IS_SCARA
case 1: // G92.1 - Zero the Workspace Offset
LOOP_NUM_AXES(i) if (position_shift[i]) {
position_shift[i] = 0;
update_workspace_offset((AxisEnum)i);
}
workspace_offset.reset();
break;
#endif

Expand All @@ -92,10 +89,9 @@ void GcodeSuite::G92() {
v = TERN0(HAS_EXTRUDERS, i == E_AXIS) ? l : LOGICAL_TO_NATIVE(l, i), // Axis position in NATIVE space (applying the existing offset)
d = v - current_position[i]; // How much is the current axis position altered by?
if (!NEAR_ZERO(d)) {
#if HAS_POSITION_SHIFT && NONE(IS_SCARA, POLARGRAPH) // When using workspaces...
#if HAS_WORKSPACE_OFFSET && NONE(IS_SCARA, POLARGRAPH) // When using workspaces...
if (TERN1(HAS_EXTRUDERS, i != E_AXIS)) {
position_shift[i] += d; // ...most axes offset the workspace...
update_workspace_offset((AxisEnum)i);
workspace_offset[i] += d; // ...most axes offset the workspace...
}
else {
#if HAS_EXTRUDERS
Expand All @@ -120,7 +116,7 @@ void GcodeSuite::G92() {
#if ENABLED(CNC_COORDINATE_SYSTEMS)
// Apply Workspace Offset to the active coordinate system
if (WITHIN(active_coordinate_system, 0, MAX_COORDINATE_SYSTEMS - 1))
coordinate_system[active_coordinate_system] = position_shift;
coordinate_system[active_coordinate_system] = workspace_offset;
#endif

if (sync_XYZE) sync_plan_position();
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/geometry/M206_M428.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "../../inc/MarlinConfig.h"

#if HAS_M206_COMMAND
#if HAS_HOME_OFFSET

#include "../gcode.h"
#include "../../module/motion.h"
Expand Down Expand Up @@ -101,4 +101,4 @@ void GcodeSuite::M428() {
OKAY_BUZZ();
}

#endif // HAS_M206_COMMAND
#endif // HAS_HOME_OFFSET
4 changes: 2 additions & 2 deletions Marlin/src/gcode/probe/M951.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void mpe_settings_init() {
mpe_settings.parking_xpos[0] = pex[0]; // M951 L
mpe_settings.parking_xpos[1] = pex[1]; // M951 R
mpe_settings.grab_distance = PARKING_EXTRUDER_GRAB_DISTANCE; // M951 I
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, mpe_settings.grab_distance * -1));
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, -mpe_settings.grab_distance));
mpe_settings.slow_feedrate = MMM_TO_MMS(MPE_SLOW_SPEED); // M951 J
mpe_settings.fast_feedrate = MMM_TO_MMS(MPE_FAST_SPEED); // M951 H
mpe_settings.travel_distance = MPE_TRAVEL_DISTANCE; // M951 D
Expand All @@ -59,7 +59,7 @@ void GcodeSuite::M951() {
if (parser.seenval('R')) mpe_settings.parking_xpos[1] = parser.value_linear_units();
if (parser.seenval('I')) {
mpe_settings.grab_distance = parser.value_linear_units();
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, mpe_settings.grab_distance * -1));
TERN_(HAS_HOME_OFFSET, set_home_offset(X_AXIS, -mpe_settings.grab_distance));
}
if (parser.seenval('J')) mpe_settings.slow_feedrate = MMM_TO_MMS(parser.value_linear_units());
if (parser.seenval('H')) mpe_settings.fast_feedrate = MMM_TO_MMS(parser.value_linear_units());
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/inc/Changes.h
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,8 @@
#error "Z3_USE_ENDSTOP is obsolete. Instead set Z2_STOP_PIN directly. (e.g., 'Z3_USE_ENDSTOP _ZMAX_' becomes 'Z3_STOP_PIN Z_MAX_PIN')"
#elif defined(Z4_USE_ENDSTOP)
#error "Z4_USE_ENDSTOP is obsolete. Instead set Z4_STOP_PIN directly. (e.g., 'Z4_USE_ENDSTOP _ZMAX_' becomes 'Z4_STOP_PIN Z_MAX_PIN')"
#elif defined(INTEGRATED_BABYSTEPPING)
#error "INTEGRATED_BABYSTEPPING is no longer needed and should be removed."
#endif

// L64xx stepper drivers have been removed
Expand Down
12 changes: 7 additions & 5 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -1782,20 +1782,22 @@
#define HAS_UI_1024x600 1
#endif

// Number of text lines the screen can display (may depend on font used)
// Touch screens leave space for extra buttons at the bottom
#if ANY(HAS_UI_320x240, HAS_UI_480x272)
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 8, 9) // Fewer lines with touch buttons onscreen
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 8, 9)
#else
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7) // Fewer lines with touch buttons onscreen
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7)
#endif
#elif HAS_UI_480x320
#if ENABLED(TFT_COLOR_UI_PORTRAIT)
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 9, 10) // Fewer lines with touch buttons onscreen
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 9, 10)
#else
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7) // Fewer lines with touch buttons onscreen
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7)
#endif
#elif HAS_UI_1024x600
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 12, 13) // Fewer lines with touch buttons onscreen
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 12, 13)
#endif

// This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
#if !HAS_X_AXIS
//#define LCD_SHOW_E_TOTAL
#define NO_WORKSPACE_OFFSETS
#define NO_HOME_OFFSETS
#undef AUTOTEMP
#undef CALIBRATION_MEASURE_LEFT
#undef CALIBRATION_MEASURE_RIGHT
Expand Down
12 changes: 6 additions & 6 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -3140,15 +3140,15 @@
#undef MOTOR_CURRENT
#endif

// Updated G92 behavior shifts the workspace
// G92 shifts the workspace
#if DISABLED(NO_WORKSPACE_OFFSETS)
#define HAS_POSITION_SHIFT 1
#define HAS_WORKSPACE_OFFSET 1
#endif
#if DISABLED(NO_HOME_OFFSETS)
#if IS_CARTESIAN
#define HAS_HOME_OFFSET 1 // The home offset also shifts the coordinate space
#define HAS_WORKSPACE_OFFSET 1 // Cumulative offset to workspace to save some calculation
#define HAS_M206_COMMAND 1 // M206 sets the home offset for Cartesian machines
#define HAS_HOME_OFFSET 1 // M206 affects the Native Machine Space on G28
#elif IS_SCARA
#define HAS_SCARA_OFFSET 1 // The SCARA home offset applies only on G28
#define HAS_SCARA_OFFSET 1 // The SCARA home offset applies only on G28
#endif
#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-07-17"
#define STRING_DISTRIBUTION_DATE "2023-07-22"
#endif

/**
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/HD44780/marlinui_HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ void MarlinUI::draw_status_message(const bool blink) {
}

#if HAS_PRINT_PROGRESS

#define TPOFFSET (LCD_WIDTH - 1)
static uint8_t timepos = TPOFFSET - 6;
static char buffer[8];
Expand Down Expand Up @@ -837,6 +838,7 @@ void MarlinUI::draw_status_message(const bool blink) {
}
}
#endif

#endif // HAS_PRINT_PROGRESS

/**
Expand Down
Loading

0 comments on commit ea3e0e8

Please sign in to comment.