浏览代码

Merge branch 'Development' into fixup_tr

Latest upstream commits
Scott Lahteine 10 年前
父节点
当前提交
dde7e11f8e

+ 9
- 0
.gitignore 查看文件

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
 *.o
10
 *.o
2
 applet/
11
 applet/
3
 *~
12
 *~

+ 1
- 0
ArduinoAddons/Arduino_1.5.x/hardware/marlin/avr/platform.local.txt 查看文件

1
+compiler.cpp.extra_flags=-DHAS_AUTOMATIC_VERSIONING

+ 3
- 0
Marlin/Conditionals.h 查看文件

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

+ 21
- 0
Marlin/Configuration.h 查看文件

319
   // #define ENDSTOPPULLUP_XMIN
319
   // #define ENDSTOPPULLUP_XMIN
320
   // #define ENDSTOPPULLUP_YMIN
320
   // #define ENDSTOPPULLUP_YMIN
321
   // #define ENDSTOPPULLUP_ZMIN
321
   // #define ENDSTOPPULLUP_ZMIN
322
+  // #define ENDSTOPPULLUP_ZPROBE
322
 #endif
323
 #endif
323
 
324
 
324
 // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
325
 // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
328
 const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
329
 const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
329
 const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
330
 const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
330
 const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
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
 //#define DISABLE_MAX_ENDSTOPS
333
 //#define DISABLE_MAX_ENDSTOPS
332
 //#define DISABLE_MIN_ENDSTOPS
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
 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
341
 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
335
 #define X_ENABLE_ON 0
342
 #define X_ENABLE_ON 0
492
 
499
 
493
   #endif
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
 #endif // ENABLE_AUTO_BED_LEVELING
516
 #endif // ENABLE_AUTO_BED_LEVELING
496
 
517
 
497
 
518
 

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

1244
       prepare_move_raw();
1244
       prepare_move_raw();
1245
       
1245
       
1246
       st_synchronize();
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
       bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1252
       bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1249
       if (z_min_endstop) {
1253
       if (z_min_endstop) {
1254
+    #endif
1250
         if (!Stopped) {
1255
         if (!Stopped) {
1251
           SERIAL_ERROR_START;
1256
           SERIAL_ERROR_START;
1252
           SERIAL_ERRORLNPGM("Z-Probe failed to engage!");
1257
           SERIAL_ERRORLNPGM("Z-Probe failed to engage!");
1313
       prepare_move_raw();
1318
       prepare_move_raw();
1314
       
1319
       
1315
       st_synchronize();
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
       bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1326
       bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1318
       if (!z_min_endstop) {
1327
       if (!z_min_endstop) {
1328
+    #endif
1319
         if (!Stopped) {
1329
         if (!Stopped) {
1320
           SERIAL_ERROR_START;
1330
           SERIAL_ERROR_START;
1321
           SERIAL_ERRORLNPGM("Z-Probe failed to retract!");
1331
           SERIAL_ERRORLNPGM("Z-Probe failed to retract!");
1592
     else {
1602
     else {
1593
 
1603
 
1594
       if (retract_zlift > 0.01) {
1604
       if (retract_zlift > 0.01) {
1595
-        current_position[Z_AXIS] + =retract_zlift;
1605
+        current_position[Z_AXIS] += retract_zlift;
1596
         #ifdef DELTA
1606
         #ifdef DELTA
1597
           sync_plan_position_delta();
1607
           sync_plan_position_delta();
1598
         #else
1608
         #else
2793
   } // code_seen('S')
2803
   } // code_seen('S')
2794
 }
2804
 }
2795
 
2805
 
2796
-
2797
 #if defined(ENABLE_AUTO_BED_LEVELING) && defined(Z_PROBE_REPEATABILITY_TEST)
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
   #endif
2817
   #endif
2802
 
2818
 
2803
   /**
2819
   /**
3525
     SERIAL_PROTOCOLPGM(MSG_Z2_MAX);
3541
     SERIAL_PROTOCOLPGM(MSG_Z2_MAX);
3526
     SERIAL_PROTOCOLLN(((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
3542
     SERIAL_PROTOCOLLN(((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
3527
   #endif
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
      * Require a Z Min pin
93
      * Require a Z Min pin
94
      */
94
      */
95
     #if Z_MIN_PIN == -1
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
       #endif
102
       #endif
101
     #endif
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
      * Check if Probe_Offset * Grid Points is greater than Probing Range
130
      * Check if Probe_Offset * Grid Points is greater than Probing Range
105
      */
131
      */
106
     #ifdef AUTO_BED_LEVELING_GRID
132
     #ifdef AUTO_BED_LEVELING_GRID

+ 1
- 0
Marlin/boards.h 查看文件

37
 #define BOARD_BRAINWAVE         82   // Brainwave (AT90USB646)
37
 #define BOARD_BRAINWAVE         82   // Brainwave (AT90USB646)
38
 #define BOARD_SAV_MKI           83   // SAV Mk-I (AT90USB1286)
38
 #define BOARD_SAV_MKI           83   // SAV Mk-I (AT90USB1286)
39
 #define BOARD_TEENSY2           84   // Teensy++2.0 (AT90USB1286) - CLI compile: DEFINES=AT90USBxx_TEENSYPP_ASSIGNMENTS HARDWARE_MOTHERBOARD=84  make
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
 #define BOARD_GEN3_PLUS         9    // Gen3+
41
 #define BOARD_GEN3_PLUS         9    // Gen3+
41
 #define BOARD_GEN3_MONOLITHIC   22   // Gen3 Monolithic Electronics
42
 #define BOARD_GEN3_MONOLITHIC   22   // Gen3 Monolithic Electronics
42
 #define BOARD_MEGATRONICS       70   // Megatronics
43
 #define BOARD_MEGATRONICS       70   // Megatronics

+ 29
- 5
Marlin/language.h 查看文件

36
   #define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en)
36
   #define LANGUAGE_INCLUDE GENERATE_LANGUAGE_INCLUDE(en)
37
 #endif
37
 #endif
38
 
38
 
39
+#ifdef HAS_AUTOMATIC_VERSIONING
40
+  #include "_Version.h"
41
+#endif
42
+
39
 #define PROTOCOL_VERSION "1.0"
43
 #define PROTOCOL_VERSION "1.0"
40
-#define FIRMWARE_URL "https://github.com/MarlinFirmware/Marlin"
41
 
44
 
42
 #if MB(ULTIMAKER)|| MB(ULTIMAKER_OLD)|| MB(ULTIMAIN_2)
45
 #if MB(ULTIMAKER)|| MB(ULTIMAKER_OLD)|| MB(ULTIMAIN_2)
43
   #undef FIRMWARE_URL
46
   #undef FIRMWARE_URL
65
   #define MACHINE_NAME "HEPHESTOS"
68
   #define MACHINE_NAME "HEPHESTOS"
66
   #undef FIRMWARE_URL
69
   #undef FIRMWARE_URL
67
   #define FIRMWARE_URL "http://www.bq.com/gb/downloads-prusa-i3-hephestos.html"
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
 #endif
80
 #endif
71
 
81
 
72
 #ifdef CUSTOM_MENDEL_NAME
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
   #undef MACHINE_NAME
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
 #endif
98
 #endif
76
 
99
 
77
 #ifndef MACHINE_UUID
100
 #ifndef MACHINE_UUID
122
 #define MSG_HEATING_COMPLETE                "Heating done."
145
 #define MSG_HEATING_COMPLETE                "Heating done."
123
 #define MSG_BED_HEATING                     "Bed Heating."
146
 #define MSG_BED_HEATING                     "Bed Heating."
124
 #define MSG_BED_DONE                        "Bed done."
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
 #define MSG_COUNT_X                         " Count X: "
149
 #define MSG_COUNT_X                         " Count X: "
127
 #define MSG_ERR_KILLED                      "Printer halted. kill() called!"
150
 #define MSG_ERR_KILLED                      "Printer halted. kill() called!"
128
 #define MSG_ERR_STOPPED                     "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"
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
 #define MSG_Z_MIN                           "z_min: "
161
 #define MSG_Z_MIN                           "z_min: "
139
 #define MSG_Z_MAX                           "z_max: "
162
 #define MSG_Z_MAX                           "z_max: "
140
 #define MSG_Z2_MAX                          "z2_max: "
163
 #define MSG_Z2_MAX                          "z2_max: "
164
+#define MSG_Z_PROBE                         "z_probe: "
141
 #define MSG_M119_REPORT                     "Reporting endstop status"
165
 #define MSG_M119_REPORT                     "Reporting endstop status"
142
 #define MSG_ENDSTOP_HIT                     "TRIGGERED"
166
 #define MSG_ENDSTOP_HIT                     "TRIGGERED"
143
 #define MSG_ENDSTOP_OPEN                    "open"
167
 #define MSG_ENDSTOP_OPEN                    "open"

+ 5
- 1
Marlin/pins.h 查看文件

187
   #define Z_MIN_PIN          -1
187
   #define Z_MIN_PIN          -1
188
 #endif
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
 #ifdef DISABLE_XMAX_ENDSTOP
194
 #ifdef DISABLE_XMAX_ENDSTOP
191
   #undef X_MAX_PIN
195
   #undef X_MAX_PIN
192
   #define X_MAX_PIN          -1
196
   #define X_MAX_PIN          -1
216
   #define Z_MIN_PIN          -1
220
   #define Z_MIN_PIN          -1
217
 #endif
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
                         HEATER_BED_PIN, FAN_PIN, \
224
                         HEATER_BED_PIN, FAN_PIN, \
221
                         _E0_PINS _E1_PINS _E2_PINS _E3_PINS \
225
                         _E0_PINS _E1_PINS _E2_PINS _E3_PINS \
222
                         analogInputToDigitalPin(TEMP_BED_PIN) \
226
                         analogInputToDigitalPin(TEMP_BED_PIN) \

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

34
 #define Z_ENABLE_PIN       62
34
 #define Z_ENABLE_PIN       62
35
 #define Z_MIN_PIN          18
35
 #define Z_MIN_PIN          18
36
 #define Z_MAX_PIN          19
36
 #define Z_MAX_PIN          19
37
+#define Z_PROBE_PIN        -1
37
 
38
 
38
 #define Y2_STEP_PIN        36
39
 #define Y2_STEP_PIN        36
39
 #define Y2_DIR_PIN         34
40
 #define Y2_DIR_PIN         34
61
   #define FILWIDTH_PIN        5
62
   #define FILWIDTH_PIN        5
62
 #endif
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
 #if defined(FILAMENT_RUNOUT_SENSOR)
70
 #if defined(FILAMENT_RUNOUT_SENSOR)
65
   // 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
66
   #define FILRUNOUT_PIN        4
72
   #define FILRUNOUT_PIN        4

+ 46
- 3
Marlin/stepper.cpp 查看文件

76
 static volatile bool endstop_x_hit = false;
76
 static volatile bool endstop_x_hit = false;
77
 static volatile bool endstop_y_hit = false;
77
 static volatile bool endstop_y_hit = false;
78
 static volatile bool endstop_z_hit = false;
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
 #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
81
 #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
81
   bool abort_on_endstop_hit = false;
82
   bool abort_on_endstop_hit = false;
112
   #endif
113
   #endif
113
 #endif
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
 static bool check_endstops = true;
120
 static bool check_endstops = true;
116
 
121
 
117
 volatile long count_position[NUM_AXIS] = { 0 };
122
 volatile long count_position[NUM_AXIS] = { 0 };
254
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 &= ~BIT(OCIE1A)
259
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 &= ~BIT(OCIE1A)
255
 
260
 
256
 void endstops_hit_on_purpose() {
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
 void checkHitEndstops() {
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
     SERIAL_ECHO_START;
267
     SERIAL_ECHO_START;
263
     SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
268
     SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
264
     if (endstop_x_hit) {
269
     if (endstop_x_hit) {
273
       SERIAL_ECHOPAIR(" Z:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
278
       SERIAL_ECHOPAIR(" Z:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
274
       LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
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
     SERIAL_EOL;
287
     SERIAL_EOL;
277
 
288
 
278
     endstops_hit_on_purpose();
289
     endstops_hit_on_purpose();
551
 
562
 
552
         #endif // Z_MIN_PIN
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
       } // check_endstops
578
       } // check_endstops
555
 
579
 
556
     }
580
     }
596
           #endif // !Z_DUAL_ENDSTOPS
620
           #endif // !Z_DUAL_ENDSTOPS
597
 
621
 
598
         #endif // Z_MAX_PIN
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
       } // check_endstops
636
       } // check_endstops
601
 
637
 
679
       step_events_completed++;
715
       step_events_completed++;
680
       if (step_events_completed >= current_block->step_event_count) break;
716
       if (step_events_completed >= current_block->step_event_count) break;
681
     }
717
     }
682
-    // Calculare new timer value
718
+    // Calculate new timer value
683
     unsigned short timer;
719
     unsigned short timer;
684
     unsigned short step_rate;
720
     unsigned short step_rate;
685
     if (step_events_completed <= (unsigned long int)current_block->accelerate_until) {
721
     if (step_events_completed <= (unsigned long int)current_block->accelerate_until) {
962
     #endif
998
     #endif
963
   #endif  
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
   #define AXIS_INIT(axis, AXIS, PIN) \
1008
   #define AXIS_INIT(axis, AXIS, PIN) \
966
     AXIS ##_STEP_INIT; \
1009
     AXIS ##_STEP_INIT; \
967
     AXIS ##_STEP_WRITE(INVERT_## PIN ##_STEP_PIN); \
1010
     AXIS ##_STEP_WRITE(INVERT_## PIN ##_STEP_PIN); \

正在加载...
取消
保存