Encapsulate probe as singleton class (#16751)
This commit is contained in:
@@ -587,12 +587,12 @@ void MarlinSettings::postprocess() {
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
const bool &runout_sensor_enabled = runout.enabled;
|
||||
#else
|
||||
const bool runout_sensor_enabled = true;
|
||||
constexpr bool runout_sensor_enabled = true;
|
||||
#endif
|
||||
#if HAS_FILAMENT_SENSOR && defined(FILAMENT_RUNOUT_DISTANCE_MM)
|
||||
const float &runout_distance_mm = runout.runout_distance();
|
||||
#else
|
||||
const float runout_distance_mm = 0;
|
||||
constexpr float runout_distance_mm = 0;
|
||||
#endif
|
||||
_FIELD_TEST(runout_sensor_enabled);
|
||||
EEPROM_WRITE(runout_sensor_enabled);
|
||||
@@ -643,7 +643,12 @@ void MarlinSettings::postprocess() {
|
||||
//
|
||||
{
|
||||
_FIELD_TEST(probe_offset);
|
||||
EEPROM_WRITE(probe_offset);
|
||||
#if HAS_BED_PROBE
|
||||
const xyz_pos_t &zpo = probe.offset;
|
||||
#else
|
||||
constexpr xyz_pos_t zpo{0};
|
||||
#endif
|
||||
EEPROM_WRITE(zpo);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1458,7 +1463,7 @@ void MarlinSettings::postprocess() {
|
||||
//
|
||||
{
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
bool &runout_sensor_enabled = runout.enabled;
|
||||
const bool &runout_sensor_enabled = runout.enabled;
|
||||
#else
|
||||
bool runout_sensor_enabled;
|
||||
#endif
|
||||
@@ -1515,7 +1520,7 @@ void MarlinSettings::postprocess() {
|
||||
{
|
||||
_FIELD_TEST(probe_offset);
|
||||
#if HAS_BED_PROBE
|
||||
xyz_pos_t &zpo = probe_offset;
|
||||
const xyz_pos_t &zpo = probe.offset;
|
||||
#else
|
||||
xyz_pos_t zpo;
|
||||
#endif
|
||||
@@ -1609,7 +1614,7 @@ void MarlinSettings::postprocess() {
|
||||
{
|
||||
_FIELD_TEST(bltouch_last_written_mode);
|
||||
#if ENABLED(BLTOUCH)
|
||||
bool &bltouch_last_written_mode = bltouch.last_written_mode;
|
||||
const bool &bltouch_last_written_mode = bltouch.last_written_mode;
|
||||
#else
|
||||
bool bltouch_last_written_mode;
|
||||
#endif
|
||||
@@ -2120,14 +2125,14 @@ void MarlinSettings::postprocess() {
|
||||
//
|
||||
{
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
xyz_float_t &backlash_distance_mm = backlash.distance_mm;
|
||||
uint8_t &backlash_correction = backlash.correction;
|
||||
const xyz_float_t &backlash_distance_mm = backlash.distance_mm;
|
||||
const uint8_t &backlash_correction = backlash.correction;
|
||||
#else
|
||||
float backlash_distance_mm[XYZ];
|
||||
uint8_t backlash_correction;
|
||||
#endif
|
||||
#if ENABLED(BACKLASH_GCODE) && defined(BACKLASH_SMOOTHING_MM)
|
||||
float &backlash_smoothing_mm = backlash.smoothing_mm;
|
||||
const float &backlash_smoothing_mm = backlash.smoothing_mm;
|
||||
#else
|
||||
float backlash_smoothing_mm;
|
||||
#endif
|
||||
@@ -2461,10 +2466,10 @@ void MarlinSettings::reset() {
|
||||
constexpr float dpo[] = NOZZLE_TO_PROBE_OFFSET;
|
||||
static_assert(COUNT(dpo) == 3, "NOZZLE_TO_PROBE_OFFSET must contain offsets for X, Y, and Z.");
|
||||
#if HAS_PROBE_XY_OFFSET
|
||||
LOOP_XYZ(a) probe_offset[a] = dpo[a];
|
||||
LOOP_XYZ(a) probe.offset[a] = dpo[a];
|
||||
#else
|
||||
probe_offset.x = probe_offset.y = 0;
|
||||
probe_offset.z = dpo[Z_AXIS];
|
||||
probe.offset.x = probe.offset.y = 0;
|
||||
probe.offset.z = dpo[Z_AXIS];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -3216,13 +3221,13 @@ void MarlinSettings::reset() {
|
||||
CONFIG_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR_P(
|
||||
#if HAS_PROBE_XY_OFFSET
|
||||
PSTR(" M851 X"), LINEAR_UNIT(probe_offset_xy.x),
|
||||
SP_Y_STR, LINEAR_UNIT(probe_offset_xy.y),
|
||||
PSTR(" M851 X"), LINEAR_UNIT(probe.offset_xy.x),
|
||||
SP_Y_STR, LINEAR_UNIT(probe.offset_xy.y),
|
||||
SP_Z_STR
|
||||
#else
|
||||
PSTR(" M851 X0 Y0 Z")
|
||||
#endif
|
||||
, LINEAR_UNIT(probe_offset.z)
|
||||
, LINEAR_UNIT(probe.offset.z)
|
||||
);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user