Browse Source

Patch probe offset name, defines

Scott Lahteine 5 years ago
parent
commit
5288c399ce

+ 11
- 8
Marlin/src/gcode/bedlevel/abl/G29.cpp View File

391
 
391
 
392
       xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_SPEED));
392
       xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_SPEED));
393
 
393
 
394
+      const float x_min = probe_min_x(), x_max = probe_max_x(),
395
+                  y_min = probe_min_y(), y_max = probe_max_y();
396
+
394
       if (parser.seen('H')) {
397
       if (parser.seen('H')) {
395
         const int16_t size = (int16_t)parser.value_linear_units();
398
         const int16_t size = (int16_t)parser.value_linear_units();
396
-        left_probe_bed_position  = _MAX(X_CENTER - size / 2, probe_min_x());
397
-        right_probe_bed_position = _MIN(left_probe_bed_position + size, probe_max_x());
398
-        front_probe_bed_position = _MAX(Y_CENTER - size / 2, probe_min_y());
399
-        back_probe_bed_position  = _MIN(front_probe_bed_position + size, probe_max_y());
399
+        left_probe_bed_position  = _MAX(X_CENTER - size / 2, x_min);
400
+        right_probe_bed_position = _MIN(left_probe_bed_position + size, x_max);
401
+        front_probe_bed_position = _MAX(Y_CENTER - size / 2, y_min);
402
+        back_probe_bed_position  = _MIN(front_probe_bed_position + size, y_max);
400
       }
403
       }
401
       else {
404
       else {
402
-        left_probe_bed_position  = parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : _MAX(X_CENTER - X_BED_SIZE / 2, probe_min_x());
403
-        right_probe_bed_position = parser.seenval('R') ? (int)RAW_X_POSITION(parser.value_linear_units()) : _MIN(left_probe_bed_position + X_BED_SIZE, probe_max_x());
404
-        front_probe_bed_position = parser.seenval('F') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : _MAX(Y_CENTER - Y_BED_SIZE / 2, probe_min_y());
405
-        back_probe_bed_position  = parser.seenval('B') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : _MIN(front_probe_bed_position + Y_BED_SIZE, probe_max_y());
405
+        left_probe_bed_position  = parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : _MAX(X_CENTER - X_BED_SIZE / 2, x_min);
406
+        right_probe_bed_position = parser.seenval('R') ? (int)RAW_X_POSITION(parser.value_linear_units()) : _MIN(left_probe_bed_position + X_BED_SIZE, x_max);
407
+        front_probe_bed_position = parser.seenval('F') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : _MAX(Y_CENTER - Y_BED_SIZE / 2, y_min);
408
+        back_probe_bed_position  = parser.seenval('B') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : _MIN(front_probe_bed_position + Y_BED_SIZE, y_max);
406
       }
409
       }
407
 
410
 
408
       if (
411
       if (

+ 1
- 3
Marlin/src/gcode/calibrate/G28.cpp View File

39
   #include "../../feature/tmc_util.h"
39
   #include "../../feature/tmc_util.h"
40
 #endif
40
 #endif
41
 
41
 
42
-#if HOMING_Z_WITH_PROBE || ENABLED(BLTOUCH)
43
-  #include "../../module/probe.h"
44
-#endif
42
+#include "../../module/probe.h"
45
 
43
 
46
 #if ENABLED(BLTOUCH)
44
 #if ENABLED(BLTOUCH)
47
   #include "../../feature/bltouch.h"
45
   #include "../../feature/bltouch.h"

+ 2
- 39
Marlin/src/module/probe.cpp View File

28
 
28
 
29
 #if HAS_BED_PROBE
29
 #if HAS_BED_PROBE
30
 
30
 
31
-#include "../libs/buzzer.h"
32
-
33
 #include "probe.h"
31
 #include "probe.h"
32
+
33
+#include "../libs/buzzer.h"
34
 #include "motion.h"
34
 #include "motion.h"
35
 #include "temperature.h"
35
 #include "temperature.h"
36
 #include "endstops.h"
36
 #include "endstops.h"
86
 #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
86
 #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
87
 #include "../core/debug_out.h"
87
 #include "../core/debug_out.h"
88
 
88
 
89
-float probe_min_x() {
90
-  return _MAX(
91
-    #if ENABLED(DELTA) || IS_SCARA
92
-      PROBE_X_MIN, MESH_MIN_X
93
-    #else
94
-      (X_MIN_BED) + (MIN_PROBE_EDGE), (X_MIN_POS) + probe_offset[X_AXIS]
95
-    #endif
96
-  );
97
-}
98
-float probe_max_x() {
99
-  return _MIN(
100
-    #if ENABLED(DELTA) || IS_SCARA
101
-      PROBE_X_MAX, MESH_MAX_X
102
-    #else
103
-      (X_MAX_BED) - (MIN_PROBE_EDGE), (X_MAX_POS) + probe_offset[X_AXIS]
104
-    #endif
105
-  );
106
-}
107
-float probe_min_y() {
108
-  return _MAX(
109
-    #if ENABLED(DELTA) || IS_SCARA
110
-      PROBE_Y_MIN, MESH_MIN_Y
111
-    #else
112
-      (Y_MIN_BED) + (MIN_PROBE_EDGE), (Y_MIN_POS) + probe_offset[Y_AXIS]
113
-    #endif
114
-  );
115
-}
116
-float probe_max_y() {
117
-  return _MIN(
118
-    #if ENABLED(DELTA) || IS_SCARA
119
-      PROBE_Y_MAX, MESH_MAX_Y
120
-    #else
121
-      (Y_MAX_BED) - (MIN_PROBE_EDGE), (Y_MAX_POS) + probe_offset[Y_AXIS]
122
-    #endif
123
-  );
124
-}
125
-
126
 #if ENABLED(Z_PROBE_SLED)
89
 #if ENABLED(Z_PROBE_SLED)
127
 
90
 
128
   #ifndef SLED_DOCKING_OFFSET
91
   #ifndef SLED_DOCKING_OFFSET

+ 41
- 1
Marlin/src/module/probe.h View File

47
     extern const char msg_wait_for_bed_heating[25];
47
     extern const char msg_wait_for_bed_heating[25];
48
   #endif
48
   #endif
49
 
49
 
50
-  float probe_min_x(), probe_max_x(), probe_min_y(), probe_max_y();
50
+  inline float probe_min_x() {
51
+    return _MAX(
52
+      #if ENABLED(DELTA) || IS_SCARA
53
+        PROBE_X_MIN, MESH_MIN_X
54
+      #else
55
+        (X_MIN_BED) + (MIN_PROBE_EDGE), (X_MIN_POS) + probe_offset[X_AXIS]
56
+      #endif
57
+    );
58
+  }
59
+  inline float probe_max_x() {
60
+    return _MIN(
61
+      #if ENABLED(DELTA) || IS_SCARA
62
+        PROBE_X_MAX, MESH_MAX_X
63
+      #else
64
+        (X_MAX_BED) - (MIN_PROBE_EDGE), (X_MAX_POS) + probe_offset[X_AXIS]
65
+      #endif
66
+    );
67
+  }
68
+  inline float probe_min_y() {
69
+    return _MAX(
70
+      #if ENABLED(DELTA) || IS_SCARA
71
+        PROBE_Y_MIN, MESH_MIN_Y
72
+      #else
73
+        (Y_MIN_BED) + (MIN_PROBE_EDGE), (Y_MIN_POS) + probe_offset[Y_AXIS]
74
+      #endif
75
+    );
76
+  }
77
+  inline float probe_max_y() {
78
+    return _MIN(
79
+      #if ENABLED(DELTA) || IS_SCARA
80
+        PROBE_Y_MAX, MESH_MAX_Y
81
+      #else
82
+        (Y_MAX_BED) - (MIN_PROBE_EDGE), (Y_MAX_POS) + probe_offset[Y_AXIS]
83
+      #endif
84
+    );
85
+  }
51
 
86
 
52
 #else
87
 #else
53
 
88
 
55
   #define DEPLOY_PROBE()
90
   #define DEPLOY_PROBE()
56
   #define STOW_PROBE()
91
   #define STOW_PROBE()
57
 
92
 
93
+  inline float probe_min_x() { return 0; };
94
+  inline float probe_max_x() { return 0; };
95
+  inline float probe_min_y() { return 0; };
96
+  inline float probe_max_y() { return 0; };
97
+
58
 #endif
98
 #endif
59
 
99
 
60
 #if HAS_Z_SERVO_PROBE
100
 #if HAS_Z_SERVO_PROBE

Loading…
Cancel
Save