Browse Source

Merge pull request #6548 from thinkyhead/rc_fix_dual_z_endstops

Fix Dual-Z endstop conditional test
Scott Lahteine 8 years ago
parent
commit
46a5cab6fb
4 changed files with 29 additions and 13 deletions
  1. 10
    9
      Marlin/Conditionals_post.h
  2. 3
    1
      Marlin/SanityCheck.h
  3. 7
    3
      Marlin/endstops.cpp
  4. 9
    0
      Marlin/pins.h

+ 10
- 9
Marlin/Conditionals_post.h View File

413
     #endif
413
     #endif
414
   #endif
414
   #endif
415
 
415
 
416
-  #define IS_Z2_OR_PROBE(P) (   (PIN_EXISTS(Z2_MIN)      && (P) == Z2_MIN_PIN)       \
417
-                             || (PIN_EXISTS(Z2_MAX)      && (P) == Z2_MAX_PIN)       \
418
-                             || (PIN_EXISTS(Z_MIN_PROBE) && (P) == Z_MIN_PROBE_PIN))
416
+  // Is an endstop plug used for the Z2 endstop or the bed probe?
417
+  #define IS_Z2_OR_PROBE(A,M) ( \
418
+       (ENABLED(Z_DUAL_ENDSTOPS) && Z2_USE_ENDSTOP == _##A##M##_) \
419
+    || (ENABLED(Z_MIN_PROBE_ENDSTOP) && Z_MIN_PROBE_PIN == A##_##M##_PIN ) )
419
 
420
 
420
   /**
421
   /**
421
    * Set ENDSTOPPULLUPS for active endstop switches
422
    * Set ENDSTOPPULLUPS for active endstop switches
505
   #define HAS_SOLENOID_4    (PIN_EXISTS(SOL4))
506
   #define HAS_SOLENOID_4    (PIN_EXISTS(SOL4))
506
 
507
 
507
   // Endstops and bed probe
508
   // Endstops and bed probe
508
-  #define HAS_X_MIN (PIN_EXISTS(X_MIN) && !IS_Z2_OR_PROBE(X_MIN_PIN))
509
-  #define HAS_X_MAX (PIN_EXISTS(X_MAX) && !IS_Z2_OR_PROBE(X_MAX_PIN))
510
-  #define HAS_Y_MIN (PIN_EXISTS(Y_MIN) && !IS_Z2_OR_PROBE(Y_MIN_PIN))
511
-  #define HAS_Y_MAX (PIN_EXISTS(Y_MAX) && !IS_Z2_OR_PROBE(Y_MAX_PIN))
512
-  #define HAS_Z_MIN (PIN_EXISTS(Z_MIN) && !IS_Z2_OR_PROBE(Z_MIN_PIN))
513
-  #define HAS_Z_MAX (PIN_EXISTS(Z_MAX) && !IS_Z2_OR_PROBE(Z_MAX_PIN))
509
+  #define HAS_X_MIN (PIN_EXISTS(X_MIN) && !IS_Z2_OR_PROBE(X,MIN))
510
+  #define HAS_X_MAX (PIN_EXISTS(X_MAX) && !IS_Z2_OR_PROBE(X,MAX))
511
+  #define HAS_Y_MIN (PIN_EXISTS(Y_MIN) && !IS_Z2_OR_PROBE(Y,MIN))
512
+  #define HAS_Y_MAX (PIN_EXISTS(Y_MAX) && !IS_Z2_OR_PROBE(Y,MAX))
513
+  #define HAS_Z_MIN (PIN_EXISTS(Z_MIN) && !IS_Z2_OR_PROBE(Z,MIN))
514
+  #define HAS_Z_MAX (PIN_EXISTS(Z_MAX) && !IS_Z2_OR_PROBE(Z,MAX))
514
   #define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
515
   #define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
515
   #define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
516
   #define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
516
   #define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE))
517
   #define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE))

+ 3
- 1
Marlin/SanityCheck.h View File

77
 #elif defined(DISABLE_MAX_ENDSTOPS) || defined(DISABLE_MIN_ENDSTOPS)
77
 #elif defined(DISABLE_MAX_ENDSTOPS) || defined(DISABLE_MIN_ENDSTOPS)
78
   #error "DISABLE_MAX_ENDSTOPS and DISABLE_MIN_ENDSTOPS deprecated. Use individual USE_*_PLUG options instead."
78
   #error "DISABLE_MAX_ENDSTOPS and DISABLE_MIN_ENDSTOPS deprecated. Use individual USE_*_PLUG options instead."
79
 #elif ENABLED(Z_DUAL_ENDSTOPS) && !defined(Z2_USE_ENDSTOP)
79
 #elif ENABLED(Z_DUAL_ENDSTOPS) && !defined(Z2_USE_ENDSTOP)
80
-  #error "Z_DUAL_ENDSTOPS settings are simplified. Just set Z2_USE_ENDSTOP to the endstop you want to repurpose for Z2"
80
+  #error "Z_DUAL_ENDSTOPS settings are simplified. Just set Z2_USE_ENDSTOP to the endstop you want to repurpose for Z2."
81
 #elif defined(LANGUAGE_INCLUDE)
81
 #elif defined(LANGUAGE_INCLUDE)
82
   #error "LANGUAGE_INCLUDE has been replaced by LCD_LANGUAGE. Please update your configuration."
82
   #error "LANGUAGE_INCLUDE has been replaced by LCD_LANGUAGE. Please update your configuration."
83
 #elif defined(EXTRUDER_OFFSET_X) || defined(EXTRUDER_OFFSET_Y)
83
 #elif defined(EXTRUDER_OFFSET_X) || defined(EXTRUDER_OFFSET_Y)
916
 #elif ENABLED(Z_DUAL_ENDSTOPS)
916
 #elif ENABLED(Z_DUAL_ENDSTOPS)
917
   #if !Z2_USE_ENDSTOP
917
   #if !Z2_USE_ENDSTOP
918
     #error "You must set Z2_USE_ENDSTOP with Z_DUAL_ENDSTOPS."
918
     #error "You must set Z2_USE_ENDSTOP with Z_DUAL_ENDSTOPS."
919
+  #elif Z2_MAX_PIN == 0 && Z2_MIN_PIN == 0
920
+    #error "Z2_USE_ENDSTOP has been assigned to a nonexistent endstop!"
919
   #elif ENABLED(DELTA)
921
   #elif ENABLED(DELTA)
920
     #error "Z_DUAL_ENDSTOPS is not compatible with DELTA."
922
     #error "Z_DUAL_ENDSTOPS is not compatible with DELTA."
921
   #endif
923
   #endif

+ 7
- 3
Marlin/endstops.cpp View File

157
       if (TEST(endstop_hit_bits, A ##_MIN) || TEST(endstop_hit_bits, A ##_MAX)) \
157
       if (TEST(endstop_hit_bits, A ##_MIN) || TEST(endstop_hit_bits, A ##_MAX)) \
158
         _ENDSTOP_HIT_ECHO(A,C)
158
         _ENDSTOP_HIT_ECHO(A,C)
159
 
159
 
160
+    #define ENDSTOP_HIT_TEST_X() _ENDSTOP_HIT_TEST(X,'X')
161
+    #define ENDSTOP_HIT_TEST_Y() _ENDSTOP_HIT_TEST(Y,'Y')
162
+    #define ENDSTOP_HIT_TEST_Z() _ENDSTOP_HIT_TEST(Z,'Z')
163
+
160
     SERIAL_ECHO_START;
164
     SERIAL_ECHO_START;
161
     SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
165
     SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
162
-    _ENDSTOP_HIT_TEST(X, 'X');
163
-    _ENDSTOP_HIT_TEST(Y, 'Y');
164
-    _ENDSTOP_HIT_TEST(Z, 'Z');
166
+    ENDSTOP_HIT_TEST_X();
167
+    ENDSTOP_HIT_TEST_Y();
168
+    ENDSTOP_HIT_TEST_Z();
165
 
169
 
166
     #if ENABLED(Z_MIN_PROBE_ENDSTOP)
170
     #if ENABLED(Z_MIN_PROBE_ENDSTOP)
167
       #define P_AXIS Z_AXIS
171
       #define P_AXIS Z_AXIS

+ 9
- 0
Marlin/pins.h View File

461
     #define X2_STEP_PIN   _EPIN(E_STEPPERS, STEP)
461
     #define X2_STEP_PIN   _EPIN(E_STEPPERS, STEP)
462
     #define X2_DIR_PIN    _EPIN(E_STEPPERS, DIR)
462
     #define X2_DIR_PIN    _EPIN(E_STEPPERS, DIR)
463
     #define X2_ENABLE_PIN _EPIN(E_STEPPERS, ENABLE)
463
     #define X2_ENABLE_PIN _EPIN(E_STEPPERS, ENABLE)
464
+    #if X2_ENABLE_PIN == 0
465
+      #error "No E stepper plug left for X2!"
466
+    #endif
464
   #endif
467
   #endif
465
   #undef _X2_PINS
468
   #undef _X2_PINS
466
   #define _X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN,
469
   #define _X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN,
475
     #define Y2_STEP_PIN   _EPIN(Y2_E_INDEX, STEP)
478
     #define Y2_STEP_PIN   _EPIN(Y2_E_INDEX, STEP)
476
     #define Y2_DIR_PIN    _EPIN(Y2_E_INDEX, DIR)
479
     #define Y2_DIR_PIN    _EPIN(Y2_E_INDEX, DIR)
477
     #define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE)
480
     #define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE)
481
+    #if Y2_ENABLE_PIN == 0
482
+      #error "No E stepper plug left for Y2!"
483
+    #endif
478
   #endif
484
   #endif
479
   #undef _Y2_PINS
485
   #undef _Y2_PINS
480
   #define _Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN,
486
   #define _Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN,
489
     #define Z2_STEP_PIN   _EPIN(Z2_E_INDEX, STEP)
495
     #define Z2_STEP_PIN   _EPIN(Z2_E_INDEX, STEP)
490
     #define Z2_DIR_PIN    _EPIN(Z2_E_INDEX, DIR)
496
     #define Z2_DIR_PIN    _EPIN(Z2_E_INDEX, DIR)
491
     #define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE)
497
     #define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE)
498
+    #if Z2_ENABLE_PIN == 0
499
+      #error "No E stepper plug left for Z2!"
500
+    #endif
492
   #endif
501
   #endif
493
   #undef _Z2_PINS
502
   #undef _Z2_PINS
494
   #define _Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN,
503
   #define _Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN,

Loading…
Cancel
Save