Browse Source

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 years ago
parent
commit
324c14943b
4 changed files with 15 additions and 21 deletions
  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 View File

499
 // As of 3-28-2015, there are NO Z Probe pins defined in any board config files.
499
 // As of 3-28-2015, there are NO Z Probe pins defined in any board config files.
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.
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
 // 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.
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
 // WARNING: Setting the wrong pin may have unexpected and disastrous outcomes. Use with caution and do your homework.
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
 // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
505
 // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
507
     const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
506
     const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.

+ 7
- 2
Marlin/Marlin_main.cpp View File

1359
     
1359
     
1360
     st_synchronize();
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
     bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
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
         if (!Stopped)
1370
         if (!Stopped)
1366
         {
1371
         {
3516
   #endif
3521
   #endif
3517
   #if defined(Z_PROBE_PIN) && Z_PROBE_PIN >-1
3522
   #if defined(Z_PROBE_PIN) && Z_PROBE_PIN >-1
3518
     SERIAL_PROTOCOLPGM(MSG_Z_PROBE);
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
   #endif
3525
   #endif
3521
 }
3526
 }
3522
 
3527
 

+ 5
- 0
Marlin/pins_RAMPS_13.h View File

62
   #define FILWIDTH_PIN        5
62
   #define FILWIDTH_PIN        5
63
 #endif
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
 #if defined(FILAMENT_RUNOUT_SENSOR)
70
 #if defined(FILAMENT_RUNOUT_SENSOR)
66
   // define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector
71
   // define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector
67
   #define FILRUNOUT_PIN        4
72
   #define FILRUNOUT_PIN        4

+ 2
- 17
Marlin/stepper.cpp View File

527
 
527
 
528
         #if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
528
         #if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
529
           UPDATE_ENDSTOP(z, Z, probe, PROBE);
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
           if(z_probe_endstop && old_z_probe_endstop)
531
           if(z_probe_endstop && old_z_probe_endstop)
532
           {
532
           {
533
         	  endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
533
         	  endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
534
         	  endstop_z_hit=true;
534
         	  endstop_z_hit=true;
535
 
535
 
536
 //        	  if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
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
           old_z_probe_endstop = z_probe_endstop;
538
           old_z_probe_endstop = z_probe_endstop;
545
-          old_z2_probe_endstop = z2_probe_endstop;
546
         #endif
539
         #endif
547
       }
540
       }
548
     }
541
     }
581
 
574
 
582
         #if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
575
         #if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
583
           UPDATE_ENDSTOP(z, Z, probe, PROBE);
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
           if(z_probe_endstop && old_z_probe_endstop)
578
           if(z_probe_endstop && old_z_probe_endstop)
586
           {
579
           {
587
         	  endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
580
         	  endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
588
         	  endstop_z_hit=true;
581
         	  endstop_z_hit=true;
589
-
590
 //        	  if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
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
           old_z_probe_endstop = z_probe_endstop;
584
           old_z_probe_endstop = z_probe_endstop;
599
-          old_z2_probe_endstop = z2_probe_endstop;
600
         #endif
585
         #endif
601
       }
586
       }
602
     }
587
     }

Loading…
Cancel
Save