mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-01-19 16:16:13 +00:00
Update current position in M852
This commit is contained in:
parent
aa1b4eded6
commit
08d9aeff41
1 changed files with 32 additions and 15 deletions
|
@ -9914,37 +9914,47 @@ inline void gcode_M502() {
|
||||||
* K[yz_factor] - New YZ skew factor
|
* K[yz_factor] - New YZ skew factor
|
||||||
*/
|
*/
|
||||||
inline void gcode_M852() {
|
inline void gcode_M852() {
|
||||||
const bool ijk = parser.seen('I') || parser.seen('S')
|
uint8_t ijk = 0, badval = 0, setval = 0;
|
||||||
#if ENABLED(SKEW_CORRECTION_FOR_Z)
|
|
||||||
|| parser.seen('J') || parser.seen('K')
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
bool badval = false;
|
|
||||||
|
|
||||||
if (parser.seen('I') || parser.seen('S')) {
|
if (parser.seen('I') || parser.seen('S')) {
|
||||||
|
++ijk;
|
||||||
const float value = parser.value_linear_units();
|
const float value = parser.value_linear_units();
|
||||||
if (WITHIN(value, SKEW_FACTOR_MIN, SKEW_FACTOR_MAX))
|
if (WITHIN(value, SKEW_FACTOR_MIN, SKEW_FACTOR_MAX)) {
|
||||||
planner.xy_skew_factor = value;
|
if (planner.xy_skew_factor != value) {
|
||||||
|
planner.xy_skew_factor = value;
|
||||||
|
++setval;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
badval = true;
|
++badval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(SKEW_CORRECTION_FOR_Z)
|
#if ENABLED(SKEW_CORRECTION_FOR_Z)
|
||||||
|
|
||||||
if (parser.seen('J')) {
|
if (parser.seen('J')) {
|
||||||
|
++ijk;
|
||||||
const float value = parser.value_linear_units();
|
const float value = parser.value_linear_units();
|
||||||
if (WITHIN(value, SKEW_FACTOR_MIN, SKEW_FACTOR_MAX))
|
if (WITHIN(value, SKEW_FACTOR_MIN, SKEW_FACTOR_MAX)) {
|
||||||
planner.xz_skew_factor = value;
|
if (planner.xz_skew_factor != value) {
|
||||||
|
planner.xz_skew_factor = value;
|
||||||
|
++setval;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
badval = true;
|
++badval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser.seen('K')) {
|
if (parser.seen('K')) {
|
||||||
|
++ijk;
|
||||||
const float value = parser.value_linear_units();
|
const float value = parser.value_linear_units();
|
||||||
if (WITHIN(value, SKEW_FACTOR_MIN, SKEW_FACTOR_MAX))
|
if (WITHIN(value, SKEW_FACTOR_MIN, SKEW_FACTOR_MAX)) {
|
||||||
planner.yz_skew_factor = value;
|
if (planner.yz_skew_factor != value) {
|
||||||
|
planner.yz_skew_factor = value;
|
||||||
|
++setval;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
badval = true;
|
++badval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -9952,6 +9962,13 @@ inline void gcode_M502() {
|
||||||
if (badval)
|
if (badval)
|
||||||
SERIAL_ECHOLNPGM(MSG_SKEW_MIN " " STRINGIFY(SKEW_FACTOR_MIN) " " MSG_SKEW_MAX " " STRINGIFY(SKEW_FACTOR_MAX));
|
SERIAL_ECHOLNPGM(MSG_SKEW_MIN " " STRINGIFY(SKEW_FACTOR_MIN) " " MSG_SKEW_MAX " " STRINGIFY(SKEW_FACTOR_MAX));
|
||||||
|
|
||||||
|
// When skew is changed the current position changes
|
||||||
|
if (setval) {
|
||||||
|
set_current_from_steppers_for_axis(ALL_AXES);
|
||||||
|
SYNC_PLAN_POSITION_KINEMATIC();
|
||||||
|
report_current_position();
|
||||||
|
}
|
||||||
|
|
||||||
if (!ijk) {
|
if (!ijk) {
|
||||||
SERIAL_ECHO_START();
|
SERIAL_ECHO_START();
|
||||||
SERIAL_ECHOPAIR(MSG_SKEW_FACTOR " XY: ", planner.xy_skew_factor);
|
SERIAL_ECHOPAIR(MSG_SKEW_FACTOR " XY: ", planner.xy_skew_factor);
|
||||||
|
|
Loading…
Reference in a new issue