Преглед изворни кода

Add HAS_SOFTWARE_ENDSTOPS macro

Scott Lahteine пре 8 година
родитељ
комит
e4649c9044
3 измењених фајлова са 10 додато и 10 уклоњено
  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 Прегледај датотеку

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

+ 1
- 1
Marlin/Marlin.h Прегледај датотеку

304
 extern float soft_endstop_min[XYZ];
304
 extern float soft_endstop_min[XYZ];
305
 extern float soft_endstop_max[XYZ];
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
   extern bool soft_endstops_enabled;
308
   extern bool soft_endstops_enabled;
309
   void clamp_to_software_endstops(float target[XYZ]);
309
   void clamp_to_software_endstops(float target[XYZ]);
310
 #else
310
 #else

+ 7
- 9
Marlin/Marlin_main.cpp Прегледај датотеку

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

Loading…
Откажи
Сачувај