소스 검색

Merge pull request #5097 from thinkyhead/rc_fix_endstop_issue

Don't trigger endstops that are actually Z2 or probe
Scott Lahteine 8 년 전
부모
커밋
1e00f5a4bd
1개의 변경된 파일35개의 추가작업 그리고 33개의 파일을 삭제
  1. 35
    33
      Marlin/Conditionals_post.h

+ 35
- 33
Marlin/Conditionals_post.h 파일 보기

@@ -329,66 +329,68 @@
329 329
     #define _XMAX_ 101
330 330
     #define _YMAX_ 201
331 331
     #define _ZMAX_ 301
332
-    #if Z2_USE_ENDSTOP == _XMAX_
333
-      #define USE_XMAX_PLUG
334
-    #elif Z2_USE_ENDSTOP == _YMAX_
335
-      #define USE_YMAX_PLUG
336
-    #elif Z2_USE_ENDSTOP == _ZMAX_
337
-      #define USE_ZMAX_PLUG
338
-    #elif Z2_USE_ENDSTOP == _XMIN_
332
+    #if Z2_USE_ENDSTOP == _XMIN_
339 333
       #define USE_XMIN_PLUG
334
+    #elif Z2_USE_ENDSTOP == _XMAX_
335
+      #define USE_XMAX_PLUG
340 336
     #elif Z2_USE_ENDSTOP == _YMIN_
341 337
       #define USE_YMIN_PLUG
338
+    #elif Z2_USE_ENDSTOP == _YMAX_
339
+      #define USE_YMAX_PLUG
342 340
     #elif Z2_USE_ENDSTOP == _ZMIN_
343 341
       #define USE_ZMIN_PLUG
342
+    #elif Z2_USE_ENDSTOP == _ZMAX_
343
+      #define USE_ZMAX_PLUG
344 344
     #endif
345 345
     #if Z_HOME_DIR > 0
346
-      #if Z2_USE_ENDSTOP == _XMAX_
347
-        #define Z2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
348
-        #define Z2_MAX_PIN X_MAX_PIN
349
-      #elif Z2_USE_ENDSTOP == _YMAX_
350
-        #define Z2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
351
-        #define Z2_MAX_PIN Y_MAX_PIN
352
-      #elif Z2_USE_ENDSTOP == _ZMAX_
353
-        #define Z2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
354
-        #define Z2_MAX_PIN Z_MAX_PIN
355
-      #elif Z2_USE_ENDSTOP == _XMIN_
346
+      #if Z2_USE_ENDSTOP == _XMIN_
356 347
         #define Z2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
357 348
         #define Z2_MAX_PIN X_MIN_PIN
349
+      #elif Z2_USE_ENDSTOP == _XMAX_
350
+        #define Z2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
351
+        #define Z2_MAX_PIN X_MAX_PIN
358 352
       #elif Z2_USE_ENDSTOP == _YMIN_
359 353
         #define Z2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
360 354
         #define Z2_MAX_PIN Y_MIN_PIN
355
+      #elif Z2_USE_ENDSTOP == _YMAX_
356
+        #define Z2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
357
+        #define Z2_MAX_PIN Y_MAX_PIN
361 358
       #elif Z2_USE_ENDSTOP == _ZMIN_
362 359
         #define Z2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
363 360
         #define Z2_MAX_PIN Z_MIN_PIN
361
+      #elif Z2_USE_ENDSTOP == _ZMAX_
362
+        #define Z2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
363
+        #define Z2_MAX_PIN Z_MAX_PIN
364 364
       #else
365 365
         #define Z2_MAX_ENDSTOP_INVERTING false
366 366
       #endif
367 367
     #else
368
-      #if Z2_USE_ENDSTOP == _XMAX_
369
-        #define Z2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
370
-        #define Z2_MIN_PIN X_MAX_PIN
371
-      #elif Z2_USE_ENDSTOP == _YMAX_
372
-        #define Z2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
373
-        #define Z2_MIN_PIN Y_MAX_PIN
374
-      #elif Z2_USE_ENDSTOP == _ZMAX_
375
-        #define Z2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
376
-        #define Z2_MIN_PIN Z_MAX_PIN
377
-      #elif Z2_USE_ENDSTOP == _XMIN_
368
+      #if Z2_USE_ENDSTOP == _XMIN_
378 369
         #define Z2_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
379 370
         #define Z2_MIN_PIN X_MIN_PIN
371
+      #elif Z2_USE_ENDSTOP == _XMAX_
372
+        #define Z2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
373
+        #define Z2_MIN_PIN X_MAX_PIN
380 374
       #elif Z2_USE_ENDSTOP == _YMIN_
381 375
         #define Z2_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
382 376
         #define Z2_MIN_PIN Y_MIN_PIN
377
+      #elif Z2_USE_ENDSTOP == _YMAX_
378
+        #define Z2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
379
+        #define Z2_MIN_PIN Y_MAX_PIN
383 380
       #elif Z2_USE_ENDSTOP == _ZMIN_
384 381
         #define Z2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
385 382
         #define Z2_MIN_PIN Z_MIN_PIN
383
+      #elif Z2_USE_ENDSTOP == _ZMAX_
384
+        #define Z2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
385
+        #define Z2_MIN_PIN Z_MAX_PIN
386 386
       #else
387 387
         #define Z2_MIN_ENDSTOP_INVERTING false
388 388
       #endif
389 389
     #endif
390 390
   #endif
391 391
 
392
+  #define IS_Z2_OR_PROBE(P) (P == Z2_MIN_PIN || P == Z2_MAX_PIN || P == Z_MIN_PROBE_PIN)
393
+
392 394
   /**
393 395
    * Set ENDSTOPPULLUPS for active endstop switches
394 396
    */
@@ -452,12 +454,12 @@
452 454
   #define HAS_KILL (PIN_EXISTS(KILL))
453 455
   #define HAS_SUICIDE (PIN_EXISTS(SUICIDE))
454 456
   #define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH))
455
-  #define HAS_X_MIN (PIN_EXISTS(X_MIN))
456
-  #define HAS_X_MAX (PIN_EXISTS(X_MAX))
457
-  #define HAS_Y_MIN (PIN_EXISTS(Y_MIN))
458
-  #define HAS_Y_MAX (PIN_EXISTS(Y_MAX))
459
-  #define HAS_Z_MIN (PIN_EXISTS(Z_MIN))
460
-  #define HAS_Z_MAX (PIN_EXISTS(Z_MAX))
457
+  #define HAS_X_MIN (PIN_EXISTS(X_MIN) && !IS_Z2_OR_PROBE(X_MIN_PIN))
458
+  #define HAS_X_MAX (PIN_EXISTS(X_MAX) && !IS_Z2_OR_PROBE(X_MAX_PIN))
459
+  #define HAS_Y_MIN (PIN_EXISTS(Y_MIN) && !IS_Z2_OR_PROBE(Y_MIN_PIN))
460
+  #define HAS_Y_MAX (PIN_EXISTS(Y_MAX) && !IS_Z2_OR_PROBE(Y_MAX_PIN))
461
+  #define HAS_Z_MIN (PIN_EXISTS(Z_MIN) && !IS_Z2_OR_PROBE(Z_MIN_PIN))
462
+  #define HAS_Z_MAX (PIN_EXISTS(Z_MAX) && !IS_Z2_OR_PROBE(Z_MAX_PIN))
461 463
   #define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
462 464
   #define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
463 465
   #define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE))

Loading…
취소
저장