Sfoglia il codice sorgente

Merge branch 'Development' into fixup_probing

Latest upstream commits
Scott Lahteine 9 anni fa
parent
commit
c0ca26cd50

+ 9
- 0
.gitignore Vedi File

@@ -1,3 +1,12 @@
1
+// Our automatic versioning scheme generates the following file
2
+// NEVER put it in the repository
3
+_Version.h
4
+
5
+// All of the following OS, IDE and compiler generated file
6
+// references should be moved from this file
7
+// They are needed, but they belong in your global .gitignore
8
+// rather than in a per-project file such as this
9
+
1 10
 *.o
2 11
 applet/
3 12
 *~

+ 1
- 0
ArduinoAddons/Arduino_1.5.x/hardware/marlin/avr/platform.local.txt Vedi File

@@ -0,0 +1 @@
1
+compiler.cpp.extra_flags=-DHAS_AUTOMATIC_VERSIONING

+ 3
- 0
Marlin/Conditionals.h Vedi File

@@ -191,6 +191,9 @@
191 191
       #define ENDSTOPPULLUP_YMIN
192 192
       #define ENDSTOPPULLUP_ZMIN
193 193
     #endif
194
+    #ifndef DISABLE_Z_PROBE_ENDSTOP
195
+      #define ENDSTOPPULLUP_ZPROBE
196
+    #endif
194 197
   #endif
195 198
 
196 199
   /**

+ 21
- 0
Marlin/Configuration.h Vedi File

@@ -319,6 +319,7 @@ your extruder heater takes 2 minutes to hit the target on heating.
319 319
   // #define ENDSTOPPULLUP_XMIN
320 320
   // #define ENDSTOPPULLUP_YMIN
321 321
   // #define ENDSTOPPULLUP_ZMIN
322
+  // #define ENDSTOPPULLUP_ZPROBE
322 323
 #endif
323 324
 
324 325
 // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
@@ -328,8 +329,14 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
328 329
 const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
329 330
 const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
330 331
 const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
332
+const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
331 333
 //#define DISABLE_MAX_ENDSTOPS
332 334
 //#define DISABLE_MIN_ENDSTOPS
335
+// If you want to enable the Z Probe pin, but disable its use, uncomment the line below.
336
+// This only affects a Z Probe Endstop if you have separate Z min endstop as well and have
337
+// activated Z_PROBE_ENDSTOP below. If you are using the Z Min endstop on your Z Probe,
338
+// this has no effect.
339
+//#define DISABLE_Z_PROBE_ENDSTOP
333 340
 
334 341
 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
335 342
 #define X_ENABLE_ON 0
@@ -492,6 +499,20 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
492 499
 
493 500
   #endif
494 501
 
502
+// Support for a dedicated Z PROBE endstop separate from the Z MIN endstop.
503
+// If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below.
504
+// If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28.
505
+// WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print.
506
+// To use a separte Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
507
+// If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
508
+// 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. Use 5V for powered sensors, otherwise connect to ground and D32
509
+// for normally closed configuration and 5V and D32 for normally open configurations. Normally closed configuration is advised and assumed.
510
+// The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. 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.
511
+// D32 is currently selected in the RAMPS 1.3/1.4 pin file. All other boards will need changes to the respective pins_XXXXX.h file.
512
+// WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework.
513
+
514
+//  #define Z_PROBE_ENDSTOP
515
+
495 516
 #endif // ENABLE_AUTO_BED_LEVELING
496 517
 
497 518
 

+ 25
- 6
Marlin/Marlin_main.cpp Vedi File

@@ -1225,9 +1225,14 @@ inline void sync_plan_position() {
1225 1225
       prepare_move_raw();
1226 1226
       
1227 1227
       st_synchronize();
1228
-      
1228
+
1229
+    #if defined(Z_PROBE_ENDSTOP)
1230
+      bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
1231
+      if (z_probe_endstop) {
1232
+    #else
1229 1233
       bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1230 1234
       if (z_min_endstop) {
1235
+    #endif
1231 1236
         if (!Stopped) {
1232 1237
           SERIAL_ERROR_START;
1233 1238
           SERIAL_ERRORLNPGM("Z-Probe failed to engage!");
@@ -1294,9 +1299,14 @@ inline void sync_plan_position() {
1294 1299
       prepare_move_raw();
1295 1300
       
1296 1301
       st_synchronize();
1297
-      
1302
+
1303
+    #if defined(Z_PROBE_ENDSTOP)
1304
+      bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
1305
+      if (!z_probe_endstop) {
1306
+    #else
1298 1307
       bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1299 1308
       if (!z_min_endstop) {
1309
+    #endif
1300 1310
         if (!Stopped) {
1301 1311
           SERIAL_ERROR_START;
1302 1312
           SERIAL_ERRORLNPGM("Z-Probe failed to retract!");
@@ -2765,11 +2775,17 @@ inline void gcode_M42() {
2765 2775
   } // code_seen('S')
2766 2776
 }
2767 2777
 
2768
-
2769 2778
 #if defined(ENABLE_AUTO_BED_LEVELING) && defined(Z_PROBE_REPEATABILITY_TEST)
2770 2779
 
2771
-  #if Z_MIN_PIN == -1
2772
-    #error "You must have a Z_MIN endstop in order to enable calculation of Z-Probe repeatability."
2780
+  // This is redudant since the SanityCheck.h already checks for a valid Z_PROBE_PIN, but here for clarity.
2781
+  #if defined (Z_PROBE_ENDSTOP)
2782
+    #if (! defined (Z_PROBE_PIN) || Z_PROBE_PIN == -1)
2783
+      #error "You must have a Z_PROBE_PIN defined in order to enable calculation of Z-Probe repeatability."
2784
+    #endif
2785
+  #else
2786
+    #if (Z_MIN_PIN == -1)
2787
+      #error "You must have a Z_MIN_PIN defined in order to enable calculation of Z-Probe repeatability."
2788
+    #endif
2773 2789
   #endif
2774 2790
 
2775 2791
   /**
@@ -3499,7 +3515,10 @@ inline void gcode_M119() {
3499 3515
     SERIAL_PROTOCOLPGM(MSG_Z2_MAX);
3500 3516
     SERIAL_PROTOCOLLN(((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
3501 3517
   #endif
3502
-  
3518
+  #if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
3519
+    SERIAL_PROTOCOLPGM(MSG_Z_PROBE);
3520
+    SERIAL_PROTOCOLLN(((READ(Z_PROBE_PIN)^Z_PROBE_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
3521
+  #endif
3503 3522
 }
3504 3523
 
3505 3524
 /**

+ 30
- 4
Marlin/SanityCheck.h Vedi File

@@ -100,14 +100,40 @@
100 100
      * Require a Z Min pin
101 101
      */
102 102
     #if Z_MIN_PIN == -1
103
-      #ifdef Z_PROBE_REPEATABILITY_TEST
104
-        #error You must have a Z_MIN endstop to enable Z_PROBE_REPEATABILITY_TEST.
105
-      #else
106
-        #error ENABLE_AUTO_BED_LEVELING requires a Z_MIN endstop. Z_MIN_PIN must point to a valid hardware pin.
103
+      #if Z_PROBE_PIN == -1 || (! defined (Z_PROBE_ENDSTOP) || defined (DISABLE_Z_PROBE_ENDSTOP)) // It's possible for someone to set a pin for the Z Probe, but not enable it.
104
+        #ifdef Z_PROBE_REPEATABILITY_TEST
105
+          #error You must have a Z_MIN or Z_PROBE endstop to enable Z_PROBE_REPEATABILITY_TEST.
106
+        #else
107
+          #error ENABLE_AUTO_BED_LEVELING requires a Z_MIN or Z_PROBE endstop. Z_MIN_PIN or Z_PROBE_PIN must point to a valid hardware pin.
108
+        #endif
107 109
       #endif
108 110
     #endif
109 111
 
110 112
     /**
113
+     * Require a Z Probe Pin if Z_PROBE_ENDSTOP is enabled.
114
+     */
115
+    #if defined(Z_PROBE_ENDSTOP)
116
+      #ifndef Z_PROBE_PIN
117
+        #error You must have a Z_PROBE_PIN defined in your pins_XXXX.h file if you enable Z_PROBE_ENDSTOP
118
+      #endif
119
+      #if Z_PROBE_PIN == -1
120
+        #error You must set Z_PROBE_PIN to a valid pin if you enable Z_PROBE_ENDSTOP
121
+      #endif
122
+// Forcing Servo definitions can break some hall effect sensor setups. Leaving these here for further comment.
123
+//      #ifndef NUM_SERVOS
124
+//        #error You must have NUM_SERVOS defined and there must be at least 1 configured to use Z_PROBE_ENDSTOP
125
+//      #endif
126
+//      #if defined(NUM_SERVOS) && NUM_SERVOS < 1
127
+//        #error You must have at least 1 servo defined for NUM_SERVOS to use Z_PROBE_ENDSTOP
128
+//      #endif
129
+//      #ifndef SERVO_ENDSTOPS
130
+//        #error You must have SERVO_ENDSTOPS defined and have the Z index set to at least 0 or above to use Z_PROBE_ENDSTOP
131
+//      #endif
132
+//      #ifndef SERVO_ENDSTOP_ANGLES
133
+//        #error You must have SERVO_ENDSTOP_ANGLES defined for Z Extend and Retract to use Z_PROBE_AND_ENSTOP
134
+//      #endif
135
+    #endif
136
+    /**
111 137
      * Check if Probe_Offset * Grid Points is greater than Probing Range
112 138
      */
113 139
     #ifdef AUTO_BED_LEVELING_GRID

+ 1
- 0
Marlin/boards.h Vedi File

@@ -37,6 +37,7 @@
37 37
 #define BOARD_BRAINWAVE         82   // Brainwave (AT90USB646)
38 38
 #define BOARD_SAV_MKI           83   // SAV Mk-I (AT90USB1286)
39 39
 #define BOARD_TEENSY2           84   // Teensy++2.0 (AT90USB1286) - CLI compile: DEFINES=AT90USBxx_TEENSYPP_ASSIGNMENTS HARDWARE_MOTHERBOARD=84  make
40
+#define BOARD_BRAINWAVE_PRO     85   // Brainwave Pro (AT90USB1286)
40 41
 #define BOARD_GEN3_PLUS         9    // Gen3+
41 42
 #define BOARD_GEN3_MONOLITHIC   22   // Gen3 Monolithic Electronics
42 43
 #define BOARD_MEGATRONICS       70   // Megatronics

+ 29
- 5
Marlin/language.h Vedi File

@@ -36,8 +36,11 @@
36 36
   #define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en)
37 37
 #endif
38 38
 
39
+#ifdef HAS_AUTOMATIC_VERSIONING
40
+  #include "_Version.h"
41
+#endif
42
+
39 43
 #define PROTOCOL_VERSION "1.0"
40
-#define FIRMWARE_URL "https://github.com/MarlinFirmware/Marlin"
41 44
 
42 45
 #if MB(ULTIMAKER)|| MB(ULTIMAKER_OLD)|| MB(ULTIMAIN_2)
43 46
   #undef FIRMWARE_URL
@@ -65,13 +68,33 @@
65 68
   #define MACHINE_NAME "HEPHESTOS"
66 69
   #undef FIRMWARE_URL
67 70
   #define FIRMWARE_URL "http://www.bq.com/gb/downloads-prusa-i3-hephestos.html"
68
-#else // Default firmware set to Mendel
69
-  #define MACHINE_NAME "Mendel"
71
+#elif MB(BRAINWAVE_PRO)
72
+  #define MACHINE_NAME "Kossel Pro"
73
+  #ifndef FIRMWARE_URL
74
+    #define FIRMWARE_URL "https://github.com/OpenBeamUSA/Marlin/"
75
+  #endif
76
+#else
77
+  #ifndef MACHINE_NAME
78
+    #define MACHINE_NAME "Mendel"
79
+  #endif
70 80
 #endif
71 81
 
72 82
 #ifdef CUSTOM_MENDEL_NAME
83
+  #warning CUSTOM_MENDEL_NAME deprecated - use CUSTOM_MACHINE_NAME
84
+  #define CUSTOM_MACHINE_NAME CUSTOM_MENDEL_NAME
85
+#endif
86
+
87
+#ifdef CUSTOM_MACHINE_NAME
73 88
   #undef MACHINE_NAME
74
-  #define MACHINE_NAME CUSTOM_MENDEL_NAME
89
+  #define MACHINE_NAME CUSTOM_MACHINE_NAME
90
+#endif
91
+
92
+#ifndef FIRMWARE_URL
93
+  #define FIRMWARE_URL "https://github.com/MarlinFirmware/Marlin"
94
+#endif
95
+
96
+#ifndef BUILD_VERSION
97
+  #define BUILD_VERSION "V1; Sprinter/grbl mashup for gen6"
75 98
 #endif
76 99
 
77 100
 #ifndef MACHINE_UUID
@@ -122,7 +145,7 @@
122 145
 #define MSG_HEATING_COMPLETE                "Heating done."
123 146
 #define MSG_BED_HEATING                     "Bed Heating."
124 147
 #define MSG_BED_DONE                        "Bed done."
125
-#define MSG_M115_REPORT                     "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
148
+#define MSG_M115_REPORT                     "FIRMWARE_NAME:Marlin " BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
126 149
 #define MSG_COUNT_X                         " Count X: "
127 150
 #define MSG_ERR_KILLED                      "Printer halted. kill() called!"
128 151
 #define MSG_ERR_STOPPED                     "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"
@@ -138,6 +161,7 @@
138 161
 #define MSG_Z_MIN                           "z_min: "
139 162
 #define MSG_Z_MAX                           "z_max: "
140 163
 #define MSG_Z2_MAX                          "z2_max: "
164
+#define MSG_Z_PROBE                         "z_probe: "
141 165
 #define MSG_M119_REPORT                     "Reporting endstop status"
142 166
 #define MSG_ENDSTOP_HIT                     "TRIGGERED"
143 167
 #define MSG_ENDSTOP_OPEN                    "open"

+ 5
- 1
Marlin/pins.h Vedi File

@@ -187,6 +187,10 @@
187 187
   #define Z_MIN_PIN          -1
188 188
 #endif
189 189
 
190
+#if defined (DISABLE_Z_PROBE_ENDSTOP) || ! defined (Z_PROBE_ENDSTOP) // Allow code to compile regardless of Z_PROBE_ENDSTOP setting.
191
+  #define Z_PROBE_PIN        -1
192
+#endif
193
+
190 194
 #ifdef DISABLE_XMAX_ENDSTOP
191 195
   #undef X_MAX_PIN
192 196
   #define X_MAX_PIN          -1
@@ -216,7 +220,7 @@
216 220
   #define Z_MIN_PIN          -1
217 221
 #endif
218 222
 
219
-#define SENSITIVE_PINS { 0, 1, X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, PS_ON_PIN, \
223
+#define SENSITIVE_PINS { 0, 1, X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_PROBE_PIN, PS_ON_PIN, \
220 224
                         HEATER_BED_PIN, FAN_PIN, \
221 225
                         _E0_PINS _E1_PINS _E2_PINS _E3_PINS \
222 226
                         analogInputToDigitalPin(TEMP_BED_PIN) \

+ 6
- 0
Marlin/pins_RAMPS_13.h Vedi File

@@ -34,6 +34,7 @@
34 34
 #define Z_ENABLE_PIN       62
35 35
 #define Z_MIN_PIN          18
36 36
 #define Z_MAX_PIN          19
37
+#define Z_PROBE_PIN        -1
37 38
 
38 39
 #define Y2_STEP_PIN        36
39 40
 #define Y2_DIR_PIN         34
@@ -61,6 +62,11 @@
61 62
   #define FILWIDTH_PIN        5
62 63
 #endif
63 64
 
65
+#if defined(Z_PROBE_ENDSTOP)
66
+  // Define a pin to use as the signal pin on Arduino for the Z_PROBE endstop.
67
+ #define Z_PROBE_PIN 32
68
+#endif
69
+
64 70
 #if defined(FILAMENT_RUNOUT_SENSOR)
65 71
   // define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector
66 72
   #define FILRUNOUT_PIN        4

+ 46
- 3
Marlin/stepper.cpp Vedi File

@@ -76,6 +76,7 @@ volatile long endstops_stepsTotal, endstops_stepsDone;
76 76
 static volatile bool endstop_x_hit = false;
77 77
 static volatile bool endstop_y_hit = false;
78 78
 static volatile bool endstop_z_hit = false;
79
+static volatile bool endstop_z_probe_hit = false; // Leaving this in even if Z_PROBE_ENDSTOP isn't defined, keeps code below cleaner. #ifdef it and usage below to save space.
79 80
 
80 81
 #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
81 82
   bool abort_on_endstop_hit = false;
@@ -112,6 +113,10 @@ static volatile bool endstop_z_hit = false;
112 113
   #endif
113 114
 #endif
114 115
 
116
+#ifdef Z_PROBE_ENDSTOP // No need to check for valid pin, SanityCheck.h already does this.
117
+static bool old_z_probe_endstop = false;
118
+#endif
119
+
115 120
 static bool check_endstops = true;
116 121
 
117 122
 volatile long count_position[NUM_AXIS] = { 0 };
@@ -254,11 +259,11 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
254 259
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 &= ~BIT(OCIE1A)
255 260
 
256 261
 void endstops_hit_on_purpose() {
257
-  endstop_x_hit = endstop_y_hit = endstop_z_hit = false;
262
+  endstop_x_hit = endstop_y_hit = endstop_z_hit = endstop_z_probe_hit = false; // #ifdef endstop_z_probe_hit = to save space if needed.
258 263
 }
259 264
 
260 265
 void checkHitEndstops() {
261
-  if (endstop_x_hit || endstop_y_hit || endstop_z_hit) {
266
+  if (endstop_x_hit || endstop_y_hit || endstop_z_hit || endstop_z_probe_hit) { // #ifdef || endstop_z_probe_hit to save space if needed.
262 267
     SERIAL_ECHO_START;
263 268
     SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
264 269
     if (endstop_x_hit) {
@@ -273,6 +278,12 @@ void checkHitEndstops() {
273 278
       SERIAL_ECHOPAIR(" Z:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
274 279
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
275 280
     }
281
+    #ifdef Z_PROBE_ENDSTOP
282
+    if (endstop_z_probe_hit) {
283
+    	SERIAL_ECHOPAIR(" Z_PROBE:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
284
+    	LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP");
285
+    }
286
+    #endif
276 287
     SERIAL_EOL;
277 288
 
278 289
     endstops_hit_on_purpose();
@@ -551,6 +562,19 @@ ISR(TIMER1_COMPA_vect) {
551 562
 
552 563
         #endif // Z_MIN_PIN
553 564
 
565
+        #ifdef Z_PROBE_ENDSTOP
566
+          UPDATE_ENDSTOP(z, Z, probe, PROBE);
567
+          z_probe_endstop=(READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
568
+          if(z_probe_endstop && old_z_probe_endstop)
569
+          {
570
+        	  endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
571
+        	  endstop_z_probe_hit=true;
572
+
573
+//        	  if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
574
+          }
575
+          old_z_probe_endstop = z_probe_endstop;
576
+        #endif
577
+        
554 578
       } // check_endstops
555 579
 
556 580
     }
@@ -596,6 +620,18 @@ ISR(TIMER1_COMPA_vect) {
596 620
           #endif // !Z_DUAL_ENDSTOPS
597 621
 
598 622
         #endif // Z_MAX_PIN
623
+        
624
+        #ifdef Z_PROBE_ENDSTOP
625
+          UPDATE_ENDSTOP(z, Z, probe, PROBE);
626
+          z_probe_endstop=(READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
627
+          if(z_probe_endstop && old_z_probe_endstop)
628
+          {
629
+        	  endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
630
+        	  endstop_z_probe_hit=true;
631
+//        	  if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
632
+          }
633
+          old_z_probe_endstop = z_probe_endstop;
634
+        #endif
599 635
 
600 636
       } // check_endstops
601 637
 
@@ -679,7 +715,7 @@ ISR(TIMER1_COMPA_vect) {
679 715
       step_events_completed++;
680 716
       if (step_events_completed >= current_block->step_event_count) break;
681 717
     }
682
-    // Calculare new timer value
718
+    // Calculate new timer value
683 719
     unsigned short timer;
684 720
     unsigned short step_rate;
685 721
     if (step_events_completed <= (unsigned long int)current_block->accelerate_until) {
@@ -962,6 +998,13 @@ void st_init() {
962 998
     #endif
963 999
   #endif  
964 1000
   
1001
+#if (defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0) && defined(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
1002
+  SET_INPUT(Z_PROBE_PIN);
1003
+  #ifdef ENDSTOPPULLUP_ZPROBE
1004
+    WRITE(Z_PROBE_PIN,HIGH);
1005
+  #endif
1006
+#endif
1007
+
965 1008
   #define AXIS_INIT(axis, AXIS, PIN) \
966 1009
     AXIS ##_STEP_INIT; \
967 1010
     AXIS ##_STEP_WRITE(INVERT_## PIN ##_STEP_PIN); \

Loading…
Annulla
Salva