Переглянути джерело

Merge branch 'Development' into fixup_tr

Latest upstream commits
Scott Lahteine 10 роки тому
джерело
коміт
dde7e11f8e

+ 9
- 0
.gitignore Переглянути файл

@@ -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 Переглянути файл

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

+ 3
- 0
Marlin/Conditionals.h Переглянути файл

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

+ 21
- 0
Marlin/Configuration.h Переглянути файл

@@ -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
 

+ 26
- 7
Marlin/Marlin_main.cpp Переглянути файл

@@ -1244,9 +1244,14 @@ inline void sync_plan_position() {
1244 1244
       prepare_move_raw();
1245 1245
       
1246 1246
       st_synchronize();
1247
-      
1247
+
1248
+    #if defined(Z_PROBE_ENDSTOP)
1249
+      bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
1250
+      if (z_probe_endstop) {
1251
+    #else
1248 1252
       bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1249 1253
       if (z_min_endstop) {
1254
+    #endif
1250 1255
         if (!Stopped) {
1251 1256
           SERIAL_ERROR_START;
1252 1257
           SERIAL_ERRORLNPGM("Z-Probe failed to engage!");
@@ -1313,9 +1318,14 @@ inline void sync_plan_position() {
1313 1318
       prepare_move_raw();
1314 1319
       
1315 1320
       st_synchronize();
1316
-      
1321
+
1322
+    #if defined(Z_PROBE_ENDSTOP)
1323
+      bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
1324
+      if (!z_probe_endstop) {
1325
+    #else
1317 1326
       bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1318 1327
       if (!z_min_endstop) {
1328
+    #endif
1319 1329
         if (!Stopped) {
1320 1330
           SERIAL_ERROR_START;
1321 1331
           SERIAL_ERRORLNPGM("Z-Probe failed to retract!");
@@ -1592,7 +1602,7 @@ void refresh_cmd_timeout(void) { previous_millis_cmd = millis(); }
1592 1602
     else {
1593 1603
 
1594 1604
       if (retract_zlift > 0.01) {
1595
-        current_position[Z_AXIS] + =retract_zlift;
1605
+        current_position[Z_AXIS] += retract_zlift;
1596 1606
         #ifdef DELTA
1597 1607
           sync_plan_position_delta();
1598 1608
         #else
@@ -2793,11 +2803,17 @@ inline void gcode_M42() {
2793 2803
   } // code_seen('S')
2794 2804
 }
2795 2805
 
2796
-
2797 2806
 #if defined(ENABLE_AUTO_BED_LEVELING) && defined(Z_PROBE_REPEATABILITY_TEST)
2798 2807
 
2799
-  #if Z_MIN_PIN == -1
2800
-    #error "You must have a Z_MIN endstop in order to enable calculation of Z-Probe repeatability."
2808
+  // This is redudant since the SanityCheck.h already checks for a valid Z_PROBE_PIN, but here for clarity.
2809
+  #if defined (Z_PROBE_ENDSTOP)
2810
+    #if (! defined (Z_PROBE_PIN) || Z_PROBE_PIN == -1)
2811
+      #error "You must have a Z_PROBE_PIN defined in order to enable calculation of Z-Probe repeatability."
2812
+    #endif
2813
+  #else
2814
+    #if (Z_MIN_PIN == -1)
2815
+      #error "You must have a Z_MIN_PIN defined in order to enable calculation of Z-Probe repeatability."
2816
+    #endif
2801 2817
   #endif
2802 2818
 
2803 2819
   /**
@@ -3525,7 +3541,10 @@ inline void gcode_M119() {
3525 3541
     SERIAL_PROTOCOLPGM(MSG_Z2_MAX);
3526 3542
     SERIAL_PROTOCOLLN(((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
3527 3543
   #endif
3528
-  
3544
+  #if defined(Z_PROBE_PIN) && Z_PROBE_PIN > -1
3545
+    SERIAL_PROTOCOLPGM(MSG_Z_PROBE);
3546
+    SERIAL_PROTOCOLLN(((READ(Z_PROBE_PIN)^Z_PROBE_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
3547
+  #endif
3529 3548
 }
3530 3549
 
3531 3550
 /**

+ 30
- 4
Marlin/SanityCheck.h Переглянути файл

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

+ 1
- 0
Marlin/boards.h Переглянути файл

@@ -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 Переглянути файл

@@ -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 Переглянути файл

@@ -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 Переглянути файл

@@ -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 Переглянути файл

@@ -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); \

Завантаження…
Відмінити
Зберегти