Browse Source

Add HAS_SOFTWARE_ENDSTOPS macro

Scott Lahteine 8 years ago
parent
commit
e4649c9044
3 changed files with 10 additions and 10 deletions
  1. 2
    0
      Marlin/Conditionals_LCD.h
  2. 1
    1
      Marlin/Marlin.h
  3. 7
    9
      Marlin/Marlin_main.cpp

+ 2
- 0
Marlin/Conditionals_LCD.h View File

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

+ 1
- 1
Marlin/Marlin.h View File

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

+ 7
- 9
Marlin/Marlin_main.cpp View File

@@ -414,7 +414,7 @@ float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DI
414 414
 #endif
415 415
 
416 416
 // Software Endstops are based on the configured limits.
417
-#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
417
+#if HAS_SOFTWARE_ENDSTOPS
418 418
   bool soft_endstops_enabled = true;
419 419
 #endif
420 420
 float soft_endstop_min[XYZ] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS },
@@ -3698,7 +3698,7 @@ inline void gcode_G28() {
3698 3698
   inline void gcode_G29() {
3699 3699
 
3700 3700
     static int probe_index = -1;
3701
-    #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
3701
+    #if HAS_SOFTWARE_ENDSTOPS
3702 3702
       static bool enable_soft_endstops;
3703 3703
     #endif
3704 3704
 
@@ -3733,7 +3733,7 @@ inline void gcode_G28() {
3733 3733
         }
3734 3734
         // For each G29 S2...
3735 3735
         if (probe_index == 0) {
3736
-          #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
3736
+          #if HAS_SOFTWARE_ENDSTOPS
3737 3737
             // For the initial G29 S2 save software endstop state
3738 3738
             enable_soft_endstops = soft_endstops_enabled;
3739 3739
           #endif
@@ -3741,7 +3741,7 @@ inline void gcode_G28() {
3741 3741
         else {
3742 3742
           // For G29 S2 after adjusting Z.
3743 3743
           mbl.set_zigzag_z(probe_index - 1, current_position[Z_AXIS]);
3744
-          #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
3744
+          #if HAS_SOFTWARE_ENDSTOPS
3745 3745
             soft_endstops_enabled = enable_soft_endstops;
3746 3746
           #endif
3747 3747
         }
@@ -3750,7 +3750,7 @@ inline void gcode_G28() {
3750 3750
           mbl.zigzag(probe_index, px, py);
3751 3751
           _mbl_goto_xy(mbl.get_probe_x(px), mbl.get_probe_y(py));
3752 3752
 
3753
-          #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
3753
+          #if HAS_SOFTWARE_ENDSTOPS
3754 3754
             // Disable software endstops to allow manual adjustment
3755 3755
             // If G29 is not completed, they will not be re-enabled
3756 3756
             soft_endstops_enabled = false;
@@ -6372,10 +6372,8 @@ inline void gcode_M205() {
6372 6372
  */
6373 6373
 inline void gcode_M211() {
6374 6374
   SERIAL_ECHO_START;
6375
-  #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
6375
+  #if HAS_SOFTWARE_ENDSTOPS
6376 6376
     if (code_seen('S')) soft_endstops_enabled = code_value_bool();
6377
-  #endif
6378
-  #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
6379 6377
     SERIAL_ECHOPGM(MSG_SOFT_ENDSTOPS);
6380 6378
     serialprintPGM(soft_endstops_enabled ? PSTR(MSG_ON) : PSTR(MSG_OFF));
6381 6379
   #else
@@ -8978,7 +8976,7 @@ void ok_to_send() {
8978 8976
   SERIAL_EOL;
8979 8977
 }
8980 8978
 
8981
-#if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
8979
+#if HAS_SOFTWARE_ENDSTOPS
8982 8980
 
8983 8981
   /**
8984 8982
    * Constrain the given coordinates to the software endstops.

Loading…
Cancel
Save