update code base to Marlin 2.0.9.2
This commit is contained in:
4
Marlin/src/gcode/geometry/G17-G19.cpp
Executable file → Normal file
4
Marlin/src/gcode/geometry/G17-G19.cpp
Executable file → Normal file
@@ -16,7 +16,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
inline void report_workspace_plane() {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM("Workspace Plane ");
|
||||
serialprintPGM(
|
||||
SERIAL_ECHOPGM_P(
|
||||
gcode.workspace_plane == GcodeSuite::PLANE_YZ ? PSTR("YZ\n")
|
||||
: gcode.workspace_plane == GcodeSuite::PLANE_ZX ? PSTR("ZX\n")
|
||||
: PSTR("XY\n")
|
||||
|
8
Marlin/src/gcode/geometry/G53-G59.cpp
Executable file → Normal file
8
Marlin/src/gcode/geometry/G53-G59.cpp
Executable file → Normal file
@@ -16,7 +16,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,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_XYZ(i) {
|
||||
LOOP_LINEAR_AXES(i) {
|
||||
if (position_shift[i] != new_offset[i]) {
|
||||
position_shift[i] = new_offset[i];
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
@@ -69,7 +69,7 @@ void GcodeSuite::G53() {
|
||||
process_parsed_command(); // ...process the chained command
|
||||
select_coordinate_system(old_system);
|
||||
#ifdef DEBUG_M53
|
||||
SERIAL_ECHOLNPAIR("Go back to workspace ", old_system);
|
||||
SERIAL_ECHOLNPGM("Go back to workspace ", old_system);
|
||||
report_current_position();
|
||||
#endif
|
||||
}
|
||||
@@ -87,7 +87,7 @@ void GcodeSuite::G53() {
|
||||
void G54_59(uint8_t subcode=0) {
|
||||
const int8_t _space = parser.codenum - 54 + subcode;
|
||||
if (gcode.select_coordinate_system(_space)) {
|
||||
SERIAL_ECHOLNPAIR("Select workspace ", _space);
|
||||
SERIAL_ECHOLNPGM("Select workspace ", _space);
|
||||
report_current_position();
|
||||
}
|
||||
}
|
||||
|
108
Marlin/src/gcode/geometry/G92.cpp
Executable file → Normal file
108
Marlin/src/gcode/geometry/G92.cpp
Executable file → Normal file
@@ -16,7 +16,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -29,75 +29,105 @@
|
||||
#endif
|
||||
|
||||
/**
|
||||
* G92: Set current position to given X Y Z E
|
||||
* G92: Set the Current Position to the given X Y Z E values.
|
||||
*
|
||||
* Behind the scenes the G92 command may modify the Current Position
|
||||
* or the Position Shift depending on settings and sub-commands.
|
||||
*
|
||||
* Since E has no Workspace Offset, it is always set directly.
|
||||
*
|
||||
* Without Workspace Offsets (e.g., with NO_WORKSPACE_OFFSETS):
|
||||
* G92 : Set NATIVE Current Position to the given X Y Z E.
|
||||
*
|
||||
* Using Workspace Offsets (default Marlin behavior):
|
||||
* G92 : Modify Workspace Offsets so the reported position shows the given X Y Z E.
|
||||
* G92.1 : Zero XYZ Workspace Offsets (so the reported position = the native position).
|
||||
*
|
||||
* With POWER_LOSS_RECOVERY:
|
||||
* G92.9 : Set NATIVE Current Position to the given X Y Z E.
|
||||
*/
|
||||
void GcodeSuite::G92() {
|
||||
|
||||
bool sync_E = false, sync_XYZ = false;
|
||||
#if HAS_EXTRUDERS
|
||||
bool sync_E = false;
|
||||
#endif
|
||||
bool sync_XYZE = false;
|
||||
|
||||
#if ENABLED(USE_GCODE_SUBCODES)
|
||||
#if USE_GCODE_SUBCODES
|
||||
const uint8_t subcode_G92 = parser.subcode;
|
||||
#else
|
||||
constexpr uint8_t subcode_G92 = 0;
|
||||
#endif
|
||||
|
||||
switch (subcode_G92) {
|
||||
default: break;
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
||||
case 1: {
|
||||
// Zero the G92 values and restore current position
|
||||
#if !IS_SCARA
|
||||
LOOP_XYZ(i) if (position_shift[i]) {
|
||||
position_shift[i] = 0;
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
}
|
||||
#endif // Not SCARA
|
||||
} return;
|
||||
default: return; // Ignore unknown G92.x
|
||||
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS) && !IS_SCARA
|
||||
case 1: // G92.1 - Zero the Workspace Offset
|
||||
LOOP_LINEAR_AXES(i) if (position_shift[i]) {
|
||||
position_shift[i] = 0;
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
case 9: {
|
||||
LOOP_XYZE(i) {
|
||||
case 9: // G92.9 - Set Current Position directly (like Marlin 1.0)
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
if (TERN1(HAS_EXTRUDERS, i != E_AXIS))
|
||||
sync_XYZE = true;
|
||||
else {
|
||||
TERN_(HAS_EXTRUDERS, sync_E = true);
|
||||
}
|
||||
current_position[i] = parser.value_axis_units((AxisEnum)i);
|
||||
if (i == E_AXIS) sync_E = true; else sync_XYZ = true;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
break;
|
||||
#endif
|
||||
case 0: {
|
||||
LOOP_XYZE(i) {
|
||||
|
||||
case 0:
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
const float l = parser.value_axis_units((AxisEnum)i),
|
||||
v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i),
|
||||
d = v - current_position[i];
|
||||
const float l = parser.value_axis_units((AxisEnum)i), // Given axis coordinate value, converted to millimeters
|
||||
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 IS_SCARA || !HAS_POSITION_SHIFT
|
||||
if (i == E_AXIS) sync_E = true; else sync_XYZ = true;
|
||||
current_position[i] = v; // Without workspaces revert to Marlin 1.0 behavior
|
||||
#elif HAS_POSITION_SHIFT
|
||||
if (i == E_AXIS) {
|
||||
sync_E = true;
|
||||
current_position.e = v; // When using coordinate spaces, only E is set directly
|
||||
}
|
||||
else {
|
||||
position_shift[i] += d; // Other axes simply offset the coordinate space
|
||||
#if HAS_POSITION_SHIFT && !IS_SCARA // When using workspaces...
|
||||
if (TERN1(HAS_EXTRUDERS, i != E_AXIS)) {
|
||||
position_shift[i] += d; // ...most axes offset the workspace...
|
||||
update_workspace_offset((AxisEnum)i);
|
||||
}
|
||||
else {
|
||||
#if HAS_EXTRUDERS
|
||||
sync_E = true;
|
||||
current_position.e = v; // ...but E is set directly
|
||||
#endif
|
||||
}
|
||||
#else // Without workspaces...
|
||||
if (TERN1(HAS_EXTRUDERS, i != E_AXIS))
|
||||
sync_XYZE = true;
|
||||
else {
|
||||
TERN_(HAS_EXTRUDERS, sync_E = true);
|
||||
}
|
||||
current_position[i] = v; // ...set Current Position directly (like Marlin 1.0)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
break;
|
||||
}
|
||||
|
||||
#if ENABLED(CNC_COORDINATE_SYSTEMS)
|
||||
// Apply workspace offset to the active coordinate system
|
||||
// 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;
|
||||
#endif
|
||||
|
||||
if (sync_XYZ) sync_plan_position();
|
||||
else if (sync_E) sync_plan_position_e();
|
||||
if (sync_XYZE) sync_plan_position();
|
||||
#if HAS_EXTRUDERS
|
||||
else if (sync_E) sync_plan_position_e();
|
||||
#endif
|
||||
|
||||
report_current_position();
|
||||
IF_DISABLED(DIRECT_STEPPING, report_current_position());
|
||||
}
|
||||
|
35
Marlin/src/gcode/geometry/M206_M428.cpp
Executable file → Normal file
35
Marlin/src/gcode/geometry/M206_M428.cpp
Executable file → Normal file
@@ -16,7 +16,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -26,8 +26,9 @@
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/motion.h"
|
||||
#include "../../lcd/ultralcd.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
#include "../../libs/buzzer.h"
|
||||
#include "../../MarlinCore.h"
|
||||
|
||||
/**
|
||||
* M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
|
||||
@@ -37,8 +38,10 @@
|
||||
* *** In the 2.0 release, it will simply be disabled by default.
|
||||
*/
|
||||
void GcodeSuite::M206() {
|
||||
LOOP_XYZ(i)
|
||||
if (parser.seen(XYZ_CHAR(i)))
|
||||
if (!parser.seen_any()) return M206_report();
|
||||
|
||||
LOOP_LINEAR_AXES(i)
|
||||
if (parser.seen(AXIS_CHAR(i)))
|
||||
set_home_offset((AxisEnum)i, parser.value_linear_units());
|
||||
|
||||
#if ENABLED(MORGAN_SCARA)
|
||||
@@ -49,6 +52,24 @@ void GcodeSuite::M206() {
|
||||
report_current_position();
|
||||
}
|
||||
|
||||
void GcodeSuite::M206_report(const bool forReplay/*=true*/) {
|
||||
report_heading_etc(forReplay, PSTR(STR_HOME_OFFSET));
|
||||
SERIAL_ECHOLNPGM_P(
|
||||
#if IS_CARTESIAN
|
||||
LIST_N(DOUBLE(LINEAR_AXES),
|
||||
PSTR(" M206 X"), LINEAR_UNIT(home_offset.x),
|
||||
SP_Y_STR, LINEAR_UNIT(home_offset.y),
|
||||
SP_Z_STR, LINEAR_UNIT(home_offset.z),
|
||||
SP_I_STR, LINEAR_UNIT(home_offset.i),
|
||||
SP_J_STR, LINEAR_UNIT(home_offset.j),
|
||||
SP_K_STR, LINEAR_UNIT(home_offset.k)
|
||||
)
|
||||
#else
|
||||
PSTR(" M206 Z"), LINEAR_UNIT(home_offset.z)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* M428: Set home_offset based on the distance between the
|
||||
* current_position and the nearest "reference point."
|
||||
@@ -61,10 +82,10 @@ void GcodeSuite::M206() {
|
||||
* Use M206 to set these values directly.
|
||||
*/
|
||||
void GcodeSuite::M428() {
|
||||
if (axis_unhomed_error()) return;
|
||||
if (homing_needed_error()) return;
|
||||
|
||||
xyz_float_t diff;
|
||||
LOOP_XYZ(i) {
|
||||
LOOP_LINEAR_AXES(i) {
|
||||
diff[i] = base_home_pos((AxisEnum)i) - current_position[i];
|
||||
if (!WITHIN(diff[i], -20, 20) && home_dir((AxisEnum)i) > 0)
|
||||
diff[i] = -current_position[i];
|
||||
@@ -76,7 +97,7 @@ void GcodeSuite::M428() {
|
||||
}
|
||||
}
|
||||
|
||||
LOOP_XYZ(i) set_home_offset((AxisEnum)i, diff[i]);
|
||||
LOOP_LINEAR_AXES(i) set_home_offset((AxisEnum)i, diff[i]);
|
||||
report_current_position();
|
||||
LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
|
||||
BUZZ(100, 659);
|
||||
|
Reference in New Issue
Block a user