瀏覽代碼

Bug fixes for Z_PROBE_AND_ENDSTOP.

Code cleanup for Z_PROBE_AND_ENDSTOP.
Added Z_PROBE_PIN to pins_RAMPS_13.h
Chris Roadfeldt 9 年之前
父節點
當前提交
324c14943b
共有 4 個檔案被更改,包括 15 行新增21 行删除
  1. 1
    2
      Marlin/Configuration.h
  2. 7
    2
      Marlin/Marlin_main.cpp
  3. 5
    0
      Marlin/pins_RAMPS_13.h
  4. 2
    17
      Marlin/stepper.cpp

+ 1
- 2
Marlin/Configuration.h 查看文件

@@ -499,9 +499,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
499 499
 // As of 3-28-2015, there are NO Z Probe pins defined in any board config files.
500 500
 // Z_PROBE_PIN is for the signal pin only. RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin in the Aux 4 section of the RAMPS board for the signal.
501 501
 // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. The Z_PROBE_PIN is setting the pin to use on the Arduino. Since the D32 pin on the RAMPS maps to D32 on Arduino, this works.
502
-// If you have RAMPS 1.3/1.4 and want to use the RAMPS D32 pin, set Z_PROBE_PIN to 32 and use ground and 5v next to it as needed. Check the RAMPS 1.3/1.4 pinout diagram for details.
502
+// D32 is currently selected in the RAMPS 1.3/1.4 pin file. Update the pins.h file for your control board to make use of this. Not doing so nullifies Z_PROBE_AND_ENDSTOP
503 503
 // WARNING: Setting the wrong pin may have unexpected and disastrous outcomes. Use with caution and do your homework.
504
-  #define Z_PROBE_PIN -1
505 504
 
506 505
 // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
507 506
     const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.

+ 7
- 2
Marlin/Marlin_main.cpp 查看文件

@@ -1359,8 +1359,13 @@ static void retract_z_probe() {
1359 1359
     
1360 1360
     st_synchronize();
1361 1361
     
1362
+    #if defined(Z_PROBE_AND_ENDSTOP)
1363
+    bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
1364
+    if (z_probe_endstop)
1365
+    #else
1362 1366
     bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1363
-    if (!z_min_endstop)
1367
+    if (z_min_endstop)
1368
+    #endif
1364 1369
     {
1365 1370
         if (!Stopped)
1366 1371
         {
@@ -3516,7 +3521,7 @@ inline void gcode_M119() {
3516 3521
   #endif
3517 3522
   #if defined(Z_PROBE_PIN) && Z_PROBE_PIN >-1
3518 3523
     SERIAL_PROTOCOLPGM(MSG_Z_PROBE);
3519
-    SERIALPROTOCOLLN(((READ(Z_PROBE_PIN)^72Z_PROBE_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
3524
+    SERIAL_PROTOCOLLN(((READ(Z_PROBE_PIN)^Z_PROBE_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
3520 3525
   #endif
3521 3526
 }
3522 3527
 

+ 5
- 0
Marlin/pins_RAMPS_13.h 查看文件

@@ -62,6 +62,11 @@
62 62
   #define FILWIDTH_PIN        5
63 63
 #endif
64 64
 
65
+#if defined(Z_PROBE_ANDENDSTOP)
66
+  // Define a pin to use as the signal pin on Arduino for the Z_PROBE endstop.
67
+ #define 32
68
+#endif
69
+
65 70
 #if defined(FILAMENT_RUNOUT_SENSOR)
66 71
   // define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector
67 72
   #define FILRUNOUT_PIN        4

+ 2
- 17
Marlin/stepper.cpp 查看文件

@@ -527,22 +527,15 @@ ISR(TIMER1_COMPA_vect) {
527 527
 
528 528
         #if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
529 529
           UPDATE_ENDSTOP(z, Z, probe, PROBE);
530
-          bool z_probe_endstop(READ(Z_PROBE_PIN) != Z_MIN_ENDSTOP_INVERTING);
530
+          z_probe_endstop=(READ(Z_PROBE_PIN) != Z_MIN_ENDSTOP_INVERTING);
531 531
           if(z_probe_endstop && old_z_probe_endstop)
532 532
           {
533 533
         	  endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
534 534
         	  endstop_z_hit=true;
535 535
 
536 536
 //        	  if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
537
-
538
-
539
-        	  if (!(performing_homing)) //if not performing home
540
-        	  {
541
-        		  step_events_completed = current_block->step_event_count;
542
-        	  }
543 537
           }
544 538
           old_z_probe_endstop = z_probe_endstop;
545
-          old_z2_probe_endstop = z2_probe_endstop;
546 539
         #endif
547 540
       }
548 541
     }
@@ -581,22 +574,14 @@ ISR(TIMER1_COMPA_vect) {
581 574
 
582 575
         #if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
583 576
           UPDATE_ENDSTOP(z, Z, probe, PROBE);
584
-          bool z_probe_endstop(READ(Z_PROBE_PIN) != Z_MAX_ENDSTOP_INVERTING);
577
+          z_probe_endstop=(READ(Z_PROBE_PIN) != Z_MAX_ENDSTOP_INVERTING);
585 578
           if(z_probe_endstop && old_z_probe_endstop)
586 579
           {
587 580
         	  endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
588 581
         	  endstop_z_hit=true;
589
-
590 582
 //        	  if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
591
-
592
-
593
-        	  if (!(performing_homing)) //if not performing home
594
-        	  {
595
-        		  step_events_completed = current_block->step_event_count;
596
-        	  }
597 583
           }
598 584
           old_z_probe_endstop = z_probe_endstop;
599
-          old_z2_probe_endstop = z2_probe_endstop;
600 585
         #endif
601 586
       }
602 587
     }

Loading…
取消
儲存