Skip to content

Commit

Permalink
🩹 Simple IA-Creality babystep patch
Browse files Browse the repository at this point in the history
See #26896 (comment)

Co-Authored-By: ellensp <530024+ellensp@users.noreply.github.com>
thinkyhead and ellensp committed Apr 24, 2024
1 parent cecc745 commit 489ef6e
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp
Original file line number Diff line number Diff line change
@@ -793,7 +793,7 @@ void RTS::handleData() {
tmp_zprobe_offset = (float(recdat.data[0]) - 65536) / 100;
else
tmp_zprobe_offset = float(recdat.data[0]) / 100;
if (WITHIN((tmp_zprobe_offset), PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX)) {
if (WITHIN(tmp_zprobe_offset, PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX)) {
int16_t tmpSteps = mmToWholeSteps(getZOffset_mm() - tmp_zprobe_offset, axis_t(Z));
if (tmpSteps == 0) tmpSteps = getZOffset_mm() < tmp_zprobe_offset ? 1 : -1;
smartAdjustAxis_steps(-tmpSteps, axis_t(Z), false);
12 changes: 9 additions & 3 deletions Marlin/src/lcd/tft/ui_common.cpp
Original file line number Diff line number Diff line change
@@ -71,12 +71,16 @@ void moveAxis(const AxisEnum axis, const int8_t direction) {
}
#endif

const float diff = motionAxisState.currentStepSize * direction;
float diff = motionAxisState.currentStepSize * direction;

#if HAS_BED_PROBE

if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {

#if ENABLED(BABYSTEP_ZPROBE_OFFSET)

diff = 0;

const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z;
const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
const float bsDiff = planner.mm_per_step[Z_AXIS] * babystep_increment,
@@ -97,7 +101,8 @@ void moveAxis(const AxisEnum axis, const int8_t direction) {
else
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));

#else
#else // !BABYSTEP_ZPROBE_OFFSET

// Only change probe.offset.z
probe.offset.z += diff;
if (direction < 0 && current_position.z < PROBE_OFFSET_ZMIN) {
@@ -112,7 +117,8 @@ void moveAxis(const AxisEnum axis, const int8_t direction) {
drawMessage_P(NUL_STR); // Clear the error

drawAxisValue(axis);
#endif

#endif // !BABYSTEP_ZPROBE_OFFSET
}

#endif // HAS_BED_PROBE

0 comments on commit 489ef6e

Please sign in to comment.