Browse Source

Move z_endstop_adj to Endstops

pull/1/head
Scott Lahteine 7 years ago
parent
commit
64dfb46461
  1. 4
      Marlin/src/Marlin.cpp
  2. 4
      Marlin/src/Marlin.h
  3. 6
      Marlin/src/gcode/calibrate/M666.cpp
  4. 10
      Marlin/src/module/configuration_store.cpp
  5. 4
      Marlin/src/module/endstops.cpp
  6. 1
      Marlin/src/module/endstops.h
  7. 6
      Marlin/src/module/motion.cpp

4
Marlin/src/Marlin.cpp

@ -179,10 +179,6 @@ volatile bool wait_for_heatup = true;
millis_t max_inactive_time = 0,
stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
#if ENABLED(Z_DUAL_ENDSTOPS)
float z_endstop_adj;
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
static bool filament_ran_out = false;
#endif

4
Marlin/src/Marlin.h

@ -190,10 +190,6 @@ extern volatile bool wait_for_heatup;
// Inactivity shutdown timer
extern millis_t max_inactive_time, stepper_inactive_time;
#if ENABLED(Z_DUAL_ENDSTOPS)
extern float z_endstop_adj;
#endif
#if HAS_SERVOS
#include "HAL/servo.h"
extern HAL_SERVO_LIB servo[NUM_SERVOS];

6
Marlin/src/gcode/calibrate/M666.cpp

@ -64,14 +64,14 @@
#elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS)
#include "../../Marlin.h" // for z_endstop_adj
#include "../../module/endstops.h"
/**
* M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
*/
void GcodeSuite::M666() {
if (parser.seen('Z')) z_endstop_adj = parser.value_linear_units();
SERIAL_ECHOLNPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj);
if (parser.seen('Z')) endstops.z_endstop_adj = parser.value_linear_units();
SERIAL_ECHOLNPAIR("Z Endstop Adjustment set to (mm):", endstops.z_endstop_adj);
}
#endif

10
Marlin/src/module/configuration_store.cpp

@ -103,7 +103,7 @@
* --- M665 Z delta_tower_angle_trim[C] (float) is always 0.0
*
* Z_DUAL_ENDSTOPS: 48 bytes
* 348 M666 Z z_endstop_adj (float)
* 348 M666 Z endstops.z_endstop_adj (float)
* --- dummy data (float x11)
*
* ULTIPANEL: 6 bytes
@ -426,7 +426,7 @@ void MarlinSettings::postprocess() {
dummy = 0.0f;
for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy);
#elif ENABLED(Z_DUAL_ENDSTOPS)
EEPROM_WRITE(z_endstop_adj); // 1 float
EEPROM_WRITE(endstops.z_endstop_adj); // 1 float
dummy = 0.0f;
for (uint8_t q = 11; q--;) EEPROM_WRITE(dummy);
#else
@ -811,7 +811,7 @@ void MarlinSettings::postprocess() {
dummy = 0.0f;
for (uint8_t q=3; q--;) EEPROM_READ(dummy);
#elif ENABLED(Z_DUAL_ENDSTOPS)
EEPROM_READ(z_endstop_adj);
EEPROM_READ(endstops.z_endstop_adj); // 1 float
dummy = 0.0f;
for (uint8_t q=11; q--;) EEPROM_READ(dummy);
#else
@ -1203,7 +1203,7 @@ void MarlinSettings::reset() {
#elif ENABLED(Z_DUAL_ENDSTOPS)
z_endstop_adj =
endstops.z_endstop_adj =
#ifdef Z_DUAL_ENDSTOPS_ADJUSTMENT
Z_DUAL_ENDSTOPS_ADJUSTMENT
#else
@ -1621,7 +1621,7 @@ void MarlinSettings::reset() {
SERIAL_ECHOLNPGM("Z2 Endstop adjustment:");
}
CONFIG_ECHO_START;
SERIAL_ECHOLNPAIR(" M666 Z", LINEAR_UNIT(z_endstop_adj));
SERIAL_ECHOLNPAIR(" M666 Z", LINEAR_UNIT(endstops.z_endstop_adj));
#endif // DELTA
#if ENABLED(ULTIPANEL)

4
Marlin/src/module/endstops.cpp

@ -54,6 +54,10 @@ volatile char Endstops::endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_P
volatile bool Endstops::z_probe_enabled = false;
#endif
#if ENABLED(Z_DUAL_ENDSTOPS)
float Endstops::z_endstop_adj;
#endif
/**
* Class and Instance Methods
*/

1
Marlin/src/module/endstops.h

@ -50,6 +50,7 @@ class Endstops {
static volatile char endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT value
#if ENABLED(Z_DUAL_ENDSTOPS)
static float z_endstop_adj;
typedef uint16_t esbits_t;
#else
typedef byte esbits_t;

6
Marlin/src/module/motion.cpp

@ -1099,14 +1099,14 @@ void homeaxis(const AxisEnum axis) {
#if ENABLED(Z_DUAL_ENDSTOPS)
if (axis == Z_AXIS) {
float adj = FABS(z_endstop_adj);
float adj = FABS(endstops.z_endstop_adj);
bool lockZ1;
if (axis_home_dir > 0) {
adj = -adj;
lockZ1 = (z_endstop_adj > 0);
lockZ1 = (endstops.z_endstop_adj > 0);
}
else
lockZ1 = (z_endstop_adj < 0);
lockZ1 = (endstops.z_endstop_adj < 0);
if (lockZ1) stepper.set_z_lock(true); else stepper.set_z2_lock(true);

Loading…
Cancel
Save