Reverse the sign of zprobe_zoffset

- When editing on the LCD, minus now means below the nozzle
- Stores the opposite sign in EEPROM, so bumped to “V20”
master
Scott Lahteine 10 years ago committed by Richard Wackerbarth
parent 1ad2c5bfc0
commit 96a3fba8ac

@ -286,7 +286,7 @@ bool target_direction;
#ifdef ENABLE_AUTO_BED_LEVELING #ifdef ENABLE_AUTO_BED_LEVELING
int xy_travel_speed = XY_TRAVEL_SPEED; int xy_travel_speed = XY_TRAVEL_SPEED;
float zprobe_zoffset = -Z_PROBE_OFFSET_FROM_EXTRUDER; float zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
#endif #endif
#if defined(Z_DUAL_ENDSTOPS) && !defined(DELTA) #if defined(Z_DUAL_ENDSTOPS) && !defined(DELTA)
@ -1060,7 +1060,7 @@ static void axis_is_at_home(AxisEnum axis) {
max_pos[axis] = base_max_pos(axis) + home_offset[axis]; max_pos[axis] = base_max_pos(axis) + home_offset[axis];
#if defined(ENABLE_AUTO_BED_LEVELING) && Z_HOME_DIR < 0 #if defined(ENABLE_AUTO_BED_LEVELING) && Z_HOME_DIR < 0
if (axis == Z_AXIS) current_position[Z_AXIS] += zprobe_zoffset; if (axis == Z_AXIS) current_position[Z_AXIS] -= zprobe_zoffset;
#endif #endif
} }
} }
@ -4648,7 +4648,7 @@ inline void gcode_M400() { st_synchronize(); }
#ifdef SERVO_ENDSTOPS #ifdef SERVO_ENDSTOPS
void raise_z_for_servo() { void raise_z_for_servo() {
float zpos = current_position[Z_AXIS], z_dest = Z_RAISE_BEFORE_HOMING; float zpos = current_position[Z_AXIS], z_dest = Z_RAISE_BEFORE_HOMING;
z_dest += axis_known_position[Z_AXIS] ? -zprobe_zoffset : zpos; z_dest += axis_known_position[Z_AXIS] ? zprobe_zoffset : zpos;
if (zpos < z_dest) if (zpos < z_dest)
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_dest); // also updates current_position do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_dest); // also updates current_position
} }
@ -4869,7 +4869,7 @@ inline void gcode_M503() {
if (code_seen('Z')) { if (code_seen('Z')) {
value = code_value(); value = code_value();
if (Z_PROBE_OFFSET_RANGE_MIN <= value && value <= Z_PROBE_OFFSET_RANGE_MAX) { if (Z_PROBE_OFFSET_RANGE_MIN <= value && value <= Z_PROBE_OFFSET_RANGE_MAX) {
zprobe_zoffset = -value; zprobe_zoffset = value;
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_ZPROBE_ZOFFSET " " MSG_OK); SERIAL_ECHOLNPGM(MSG_ZPROBE_ZOFFSET " " MSG_OK);
SERIAL_EOL; SERIAL_EOL;
@ -4886,8 +4886,8 @@ inline void gcode_M503() {
} }
else { else {
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_ZPROBE_ZOFFSET " : "); SERIAL_ECHOPGM(MSG_ZPROBE_ZOFFSET " : ");
SERIAL_ECHO(-zprobe_zoffset); SERIAL_ECHO(zprobe_zoffset);
SERIAL_EOL; SERIAL_EOL;
} }
} }

@ -14,7 +14,7 @@
* *
*/ */
#define EEPROM_VERSION "V19" #define EEPROM_VERSION "V20"
/** /**
* V19 EEPROM Layout: * V19 EEPROM Layout:
@ -499,7 +499,7 @@ void Config_ResetDefault() {
#endif #endif
#ifdef ENABLE_AUTO_BED_LEVELING #ifdef ENABLE_AUTO_BED_LEVELING
zprobe_zoffset = -Z_PROBE_OFFSET_FROM_EXTRUDER; zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
#endif #endif
#ifdef DELTA #ifdef DELTA
@ -866,12 +866,11 @@ void Config_PrintSettings(bool forReplay) {
SERIAL_ECHOLNPGM("Z-Probe Offset (mm):"); SERIAL_ECHOLNPGM("Z-Probe Offset (mm):");
} }
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOPAIR(" M", (unsigned long)CUSTOM_M_CODE_SET_Z_PROBE_OFFSET); SERIAL_ECHOPAIR(" M" STRINGIFY(CUSTOM_M_CODE_SET_Z_PROBE_OFFSET), zprobe_zoffset);
SERIAL_ECHOPAIR(" Z", -zprobe_zoffset);
#else #else
if (!forReplay) { if (!forReplay) {
CONFIG_ECHO_START; CONFIG_ECHO_START;
SERIAL_ECHOPAIR("Z-Probe Offset (mm):", -zprobe_zoffset); SERIAL_ECHOPAIR("Z-Probe Offset (mm):", zprobe_zoffset);
} }
#endif #endif
SERIAL_EOL; SERIAL_EOL;

Loading…
Cancel
Save