Add M851 X Y probe offsets (#15202)

This commit is contained in:
InsanityAutomation
2019-09-24 22:29:21 -04:00
committed by Scott Lahteine
parent ebc9a8a0b0
commit df1e51258a
151 changed files with 1009 additions and 1878 deletions

View File

@@ -37,7 +37,7 @@
*/
// Change EEPROM version if the structure changes
#define EEPROM_VERSION "V69"
#define EEPROM_VERSION "V70"
#define EEPROM_OFFSET 100
// Check the integrity of data offsets.
@@ -60,6 +60,8 @@
#include "../HAL/shared/persistent_store_api.h"
#endif
#include "probe.h"
#if HAS_LEVELING
#include "../feature/bedlevel/bedlevel.h"
#endif
@@ -78,10 +80,6 @@
#define EEPROM_NUM_SERVOS NUM_SERVO_PLUGS
#endif
#if HAS_BED_PROBE
#include "probe.h"
#endif
#include "../feature/fwretract.h"
#if ENABLED(POWER_LOSS_RECOVERY)
@@ -178,7 +176,7 @@ typedef struct SettingsDataStruct {
// HAS_BED_PROBE
//
float zprobe_zoffset;
float zprobe_offset[XYZ];
//
// ABL_PLANAR
@@ -615,12 +613,8 @@ void MarlinSettings::postprocess() {
// Probe Z Offset
//
{
_FIELD_TEST(zprobe_zoffset);
#if !HAS_BED_PROBE
const float zprobe_zoffset = 0;
#endif
EEPROM_WRITE(zprobe_zoffset);
_FIELD_TEST(zprobe_offset[Z_AXIS]);
EEPROM_WRITE(zprobe_offset);
}
//
@@ -1421,12 +1415,14 @@ void MarlinSettings::postprocess() {
// Probe Z Offset
//
{
_FIELD_TEST(zprobe_zoffset);
_FIELD_TEST(zprobe_offset[Z_AXIS]);
#if !HAS_BED_PROBE
float zprobe_zoffset;
#if HAS_BED_PROBE
float (&zpo)[XYZ] = zprobe_offset;
#else
float zpo[XYZ];
#endif
EEPROM_READ(zprobe_zoffset);
EEPROM_READ(zpo);
}
//
@@ -2321,7 +2317,12 @@ void MarlinSettings::reset() {
#endif
#if HAS_BED_PROBE
zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
#ifndef NOZZLE_TO_PROBE_OFFSET
#define NOZZLE_TO_PROBE_OFFSET { 0, 0, 0 }
#endif
constexpr float dpo[XYZ] = NOZZLE_TO_PROBE_OFFSET;
static_assert(COUNT(dpo) == 3, "NOZZLE_TO_PROBE_OFFSET must contain offsets for X, Y, and Z.");
LOOP_XYZ(a) zprobe_offset[a] = dpo[a];
#endif
//
@@ -3070,7 +3071,9 @@ void MarlinSettings::reset() {
say_units(true);
}
CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR(" M851 Z", LINEAR_UNIT(zprobe_zoffset));
SERIAL_ECHOLNPAIR(" M851 X", LINEAR_UNIT(zprobe_offset[X_AXIS]),
" Y", LINEAR_UNIT(zprobe_offset[Y_AXIS]),
" Z", LINEAR_UNIT(zprobe_offset[Z_AXIS]));
#endif
/**