Add HAS_SOFTWARE_ENDSTOPS macro

This commit is contained in:
Scott Lahteine 2017-03-16 17:20:24 -05:00
parent 3e927ff204
commit e4649c9044
3 changed files with 10 additions and 10 deletions

View File

@ -369,4 +369,6 @@
#undef Z_MIN_PROBE_ENDSTOP #undef Z_MIN_PROBE_ENDSTOP
#endif #endif
#define HAS_SOFTWARE_ENDSTOPS (ENABLED(min_software_endstops) || ENABLED(max_software_endstops))
#endif //CONDITIONALS_LCD_H #endif //CONDITIONALS_LCD_H

View File

@ -304,7 +304,7 @@ extern float current_position[NUM_AXIS];
extern float soft_endstop_min[XYZ]; extern float soft_endstop_min[XYZ];
extern float soft_endstop_max[XYZ]; extern float soft_endstop_max[XYZ];
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) #if HAS_SOFTWARE_ENDSTOPS
extern bool soft_endstops_enabled; extern bool soft_endstops_enabled;
void clamp_to_software_endstops(float target[XYZ]); void clamp_to_software_endstops(float target[XYZ]);
#else #else

View File

@ -414,7 +414,7 @@ float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DI
#endif #endif
// Software Endstops are based on the configured limits. // Software Endstops are based on the configured limits.
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) #if HAS_SOFTWARE_ENDSTOPS
bool soft_endstops_enabled = true; bool soft_endstops_enabled = true;
#endif #endif
float soft_endstop_min[XYZ] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS }, float soft_endstop_min[XYZ] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS },
@ -3698,7 +3698,7 @@ inline void gcode_G28() {
inline void gcode_G29() { inline void gcode_G29() {
static int probe_index = -1; static int probe_index = -1;
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) #if HAS_SOFTWARE_ENDSTOPS
static bool enable_soft_endstops; static bool enable_soft_endstops;
#endif #endif
@ -3733,7 +3733,7 @@ inline void gcode_G28() {
} }
// For each G29 S2... // For each G29 S2...
if (probe_index == 0) { if (probe_index == 0) {
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) #if HAS_SOFTWARE_ENDSTOPS
// For the initial G29 S2 save software endstop state // For the initial G29 S2 save software endstop state
enable_soft_endstops = soft_endstops_enabled; enable_soft_endstops = soft_endstops_enabled;
#endif #endif
@ -3741,7 +3741,7 @@ inline void gcode_G28() {
else { else {
// For G29 S2 after adjusting Z. // For G29 S2 after adjusting Z.
mbl.set_zigzag_z(probe_index - 1, current_position[Z_AXIS]); mbl.set_zigzag_z(probe_index - 1, current_position[Z_AXIS]);
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) #if HAS_SOFTWARE_ENDSTOPS
soft_endstops_enabled = enable_soft_endstops; soft_endstops_enabled = enable_soft_endstops;
#endif #endif
} }
@ -3750,7 +3750,7 @@ inline void gcode_G28() {
mbl.zigzag(probe_index, px, py); mbl.zigzag(probe_index, px, py);
_mbl_goto_xy(mbl.get_probe_x(px), mbl.get_probe_y(py)); _mbl_goto_xy(mbl.get_probe_x(px), mbl.get_probe_y(py));
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) #if HAS_SOFTWARE_ENDSTOPS
// Disable software endstops to allow manual adjustment // Disable software endstops to allow manual adjustment
// If G29 is not completed, they will not be re-enabled // If G29 is not completed, they will not be re-enabled
soft_endstops_enabled = false; soft_endstops_enabled = false;
@ -6372,10 +6372,8 @@ inline void gcode_M205() {
*/ */
inline void gcode_M211() { inline void gcode_M211() {
SERIAL_ECHO_START; SERIAL_ECHO_START;
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) #if HAS_SOFTWARE_ENDSTOPS
if (code_seen('S')) soft_endstops_enabled = code_value_bool(); if (code_seen('S')) soft_endstops_enabled = code_value_bool();
#endif
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
SERIAL_ECHOPGM(MSG_SOFT_ENDSTOPS); SERIAL_ECHOPGM(MSG_SOFT_ENDSTOPS);
serialprintPGM(soft_endstops_enabled ? PSTR(MSG_ON) : PSTR(MSG_OFF)); serialprintPGM(soft_endstops_enabled ? PSTR(MSG_ON) : PSTR(MSG_OFF));
#else #else
@ -8978,7 +8976,7 @@ void ok_to_send() {
SERIAL_EOL; SERIAL_EOL;
} }
#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops) #if HAS_SOFTWARE_ENDSTOPS
/** /**
* Constrain the given coordinates to the software endstops. * Constrain the given coordinates to the software endstops.