Browse Source

Followup to BLTouch (#13422)

InsanityAutomation 5 years ago
parent
commit
5b2c37d6c1

+ 3
- 1
Marlin/src/feature/bedlevel/abl/abl.h View File

40
   void bilinear_line_to_destination(const float fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
40
   void bilinear_line_to_destination(const float fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
41
 #endif
41
 #endif
42
 
42
 
43
-#define Z_VALUES(X,Y) z_values[X][Y]
43
+#define _GET_MESH_X(I) (bilinear_start[X_AXIS] + (I) * bilinear_grid_spacing[X_AXIS])
44
+#define _GET_MESH_Y(J) (bilinear_start[Y_AXIS] + (J) * bilinear_grid_spacing[Y_AXIS])
45
+#define Z_VALUES_ARR  z_values

+ 24
- 27
Marlin/src/feature/bedlevel/bedlevel.h View File

48
   void set_z_fade_height(const float zfh, const bool do_report=true);
48
   void set_z_fade_height(const float zfh, const bool do_report=true);
49
 #endif
49
 #endif
50
 
50
 
51
-#if EITHER(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING)
51
+#if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY)
52
+  void _manual_goto_xy(const float &x, const float &y);
53
+#endif
52
 
54
 
53
-  #include <stdint.h>
55
+#if HAS_MESH
54
 
56
 
55
-  typedef float (*element_2d_fn)(const uint8_t, const uint8_t);
57
+  typedef float (&bed_mesh_t)[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
56
 
58
 
57
-  /**
58
-   * Print calibration results for plotting or manual frame adjustment.
59
-   */
60
-  void print_2d_array(const uint8_t sx, const uint8_t sy, const uint8_t precision, element_2d_fn fn);
59
+  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
60
+    #include "abl/abl.h"
61
+  #elif ENABLED(AUTO_BED_LEVELING_UBL)
62
+    #include "ubl/ubl.h"
63
+  #elif ENABLED(MESH_BED_LEVELING)
64
+    #include "mbl/mesh_bed_leveling.h"
65
+  #endif
61
 
66
 
62
-#endif
67
+  #define Z_VALUES(X,Y) Z_VALUES_ARR[X][Y]
63
 
68
 
64
-#if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY)
65
-  void _manual_goto_xy(const float &x, const float &y);
66
-#endif
69
+  #if EITHER(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING)
67
 
70
 
68
-#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
69
-  #define _GET_MESH_X(I) (bilinear_start[X_AXIS] + (I) * bilinear_grid_spacing[X_AXIS])
70
-  #define _GET_MESH_Y(J) (bilinear_start[Y_AXIS] + (J) * bilinear_grid_spacing[Y_AXIS])
71
-#elif ENABLED(AUTO_BED_LEVELING_UBL)
72
-  #define _GET_MESH_X(I) ubl.mesh_index_to_xpos(I)
73
-  #define _GET_MESH_Y(J) ubl.mesh_index_to_ypos(J)
74
-#elif ENABLED(MESH_BED_LEVELING)
75
-  #define _GET_MESH_X(I) mbl.index_to_xpos[I]
76
-  #define _GET_MESH_Y(J) mbl.index_to_ypos[J]
77
-#endif
71
+    #include <stdint.h>
72
+
73
+    typedef float (*element_2d_fn)(const uint8_t, const uint8_t);
74
+
75
+    /**
76
+     * Print calibration results for plotting or manual frame adjustment.
77
+     */
78
+    void print_2d_array(const uint8_t sx, const uint8_t sy, const uint8_t precision, element_2d_fn fn);
79
+
80
+  #endif
78
 
81
 
79
-#if ENABLED(MESH_BED_LEVELING)
80
-  #include "mbl/mesh_bed_leveling.h"
81
-#elif ENABLED(AUTO_BED_LEVELING_UBL)
82
-  #include "ubl/ubl.h"
83
-#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
84
-  #include "abl/abl.h"
85
 #endif
82
 #endif

+ 3
- 2
Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h View File

34
 
34
 
35
 #define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X)) / (GRID_MAX_POINTS_X - 1))
35
 #define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X)) / (GRID_MAX_POINTS_X - 1))
36
 #define MESH_Y_DIST ((MESH_MAX_Y - (MESH_MIN_Y)) / (GRID_MAX_POINTS_Y - 1))
36
 #define MESH_Y_DIST ((MESH_MAX_Y - (MESH_MIN_Y)) / (GRID_MAX_POINTS_Y - 1))
37
+#define _GET_MESH_X(I) mbl.index_to_xpos[I]
38
+#define _GET_MESH_Y(J) mbl.index_to_ypos[J]
39
+#define Z_VALUES_ARR mbl.z_values
37
 
40
 
38
 class mesh_bed_leveling {
41
 class mesh_bed_leveling {
39
 public:
42
 public:
118
 };
121
 };
119
 
122
 
120
 extern mesh_bed_leveling mbl;
123
 extern mesh_bed_leveling mbl;
121
-
122
-#define Z_VALUES(X,Y) mbl.z_values[X][Y]

+ 3
- 1
Marlin/src/feature/bedlevel/ubl/ubl.h View File

335
 
335
 
336
 extern unified_bed_leveling ubl;
336
 extern unified_bed_leveling ubl;
337
 
337
 
338
-#define Z_VALUES(X,Y) ubl.z_values[X][Y]
338
+#define _GET_MESH_X(I) ubl.mesh_index_to_xpos(I)
339
+#define _GET_MESH_Y(J) ubl.mesh_index_to_ypos(J)
340
+#define Z_VALUES_ARR ubl.z_values
339
 
341
 
340
 // Prevent debugging propagating to other files
342
 // Prevent debugging propagating to other files
341
 #include "../../../core/debug_out.h"
343
 #include "../../../core/debug_out.h"

+ 9
- 9
Marlin/src/feature/bltouch.cpp View File

69
     }
69
     }
70
   }
70
   }
71
 
71
 
72
-  #if ENABLED(BLTOUCH_V3)
73
-    #if ENABLED(BLTOUCH_FORCE_5V_MODE)
74
-      set_5V_mode();                  // Assume 5V DC logic level if endstop pullup resistors are enabled
75
-    #else
76
-      set_OD_mode();
77
-    #endif
72
+  #if ENABLED(BLTOUCH_FORCE_5V_MODE)
73
+    set_5V_mode();
74
+  #elif ENABLED(BLTOUCH_FORCE_OPEN_DRAIN_MODE)
75
+    set_OD_mode();
76
+  #elif ENABLED(ENDSTOPPULLUPS) || ALL(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, ENDSTOPPULLUP_ZMIN) || (USES_Z_MIN_PROBE_ENDSTOP && ENABLED(ENDSTOPPULLUP_ZMIN_PROBE))
77
+    set_5V_mode();                  // Assume 5V DC logic level if endstop pullup resistors are enabled
78
+  #else
79
+    set_OD_mode();
78
   #endif
80
   #endif
79
 
81
 
80
   if (in_deploy) {
82
   if (in_deploy) {
81
     _deploy();
83
     _deploy();
82
-    #if ENABLED(BLTOUCH_V3)
83
-      set_SW_mode();                  // Ensure Switch mode is activated for BLTouch V3. Ignored on V2.
84
-    #endif
84
+    set_SW_mode();                  // Ensure Switch mode is activated for BLTouch V3. Ignored on V2.
85
   }
85
   }
86
   else _stow();
86
   else _stow();
87
 
87
 

+ 4
- 0
Marlin/src/gcode/calibrate/G34_M422.cpp View File

38
   #include "../../module/probe.h"
38
   #include "../../module/probe.h"
39
 #endif
39
 #endif
40
 
40
 
41
+#if ENABLED(BLTOUCH)
42
+  #include "../../feature/bltouch.h"
43
+#endif
44
+
41
 #if HAS_LEVELING
45
 #if HAS_LEVELING
42
   #include "../../feature/bedlevel/bedlevel.h"
46
   #include "../../feature/bedlevel/bedlevel.h"
43
 #endif
47
 #endif

+ 1
- 1
Marlin/src/lcd/extensible_ui/ui_api.cpp View File

588
     void setLevelingActive(const bool state) { set_bed_leveling_enabled(state); }
588
     void setLevelingActive(const bool state) { set_bed_leveling_enabled(state); }
589
     #if HAS_MESH
589
     #if HAS_MESH
590
       bool getMeshValid() { return leveling_is_valid(); }
590
       bool getMeshValid() { return leveling_is_valid(); }
591
-      bed_mesh_t getMeshArray() { return Z_VALUES; }
591
+      bed_mesh_t getMeshArray() { return Z_VALUES_ARR; }
592
       void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zoff) {
592
       void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zoff) {
593
         if (WITHIN(xpos, 0, GRID_MAX_POINTS_X) && WITHIN(ypos, 0, GRID_MAX_POINTS_Y)) {
593
         if (WITHIN(xpos, 0, GRID_MAX_POINTS_X) && WITHIN(ypos, 0, GRID_MAX_POINTS_Y)) {
594
           Z_VALUES(xpos, ypos) = zoff;
594
           Z_VALUES(xpos, ypos) = zoff;

+ 0
- 1
Marlin/src/lcd/extensible_ui/ui_api.h View File

95
     bool getLevelingActive();
95
     bool getLevelingActive();
96
     void setLevelingActive(const bool);
96
     void setLevelingActive(const bool);
97
     #if HAS_MESH
97
     #if HAS_MESH
98
-      typedef float (&bed_mesh_t)[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
99
       bool getMeshValid();
98
       bool getMeshValid();
100
       bed_mesh_t getMeshArray();
99
       bed_mesh_t getMeshArray();
101
       void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zval);
100
       void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zval);

+ 6
- 4
Marlin/src/pins/pins_RAMPS.h View File

63
 //
63
 //
64
 // Servos
64
 // Servos
65
 //
65
 //
66
-#ifdef IS_RAMPS_13
67
-  #define SERVO0_PIN        7   // RAMPS_13 // Will conflict with BTN_EN2 on LCD_I2C_VIKI
68
-#else
69
-  #define SERVO0_PIN       11
66
+#ifndef SERVO0_PIN
67
+  #ifdef IS_RAMPS_13
68
+    #define SERVO0_PIN      7   // RAMPS_13 // Will conflict with BTN_EN2 on LCD_I2C_VIKI
69
+  #else
70
+    #define SERVO0_PIN     11
71
+  #endif
70
 #endif
72
 #endif
71
 #define SERVO1_PIN          6
73
 #define SERVO1_PIN          6
72
 #define SERVO2_PIN          5
74
 #define SERVO2_PIN          5

+ 1
- 1
buildroot/share/tests/DUE-tests View File

15
 
15
 
16
 restore_configs
16
 restore_configs
17
 opt_set MOTHERBOARD BOARD_RADDS
17
 opt_set MOTHERBOARD BOARD_RADDS
18
-opt_enable USE_XMAX_PLUG USE_YMAX_PLUG FIX_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR \
18
+opt_enable USE_XMAX_PLUG USE_YMAX_PLUG BLTOUCH AUTO_BED_LEVELING_BILINEAR \
19
            Z_TRIPLE_STEPPER_DRIVERS Z_TRIPLE_ENDSTOPS Z_STEPPER_AUTO_ALIGN
19
            Z_TRIPLE_STEPPER_DRIVERS Z_TRIPLE_ENDSTOPS Z_STEPPER_AUTO_ALIGN
20
 opt_add Z2_MAX_ENDSTOP_INVERTING false
20
 opt_add Z2_MAX_ENDSTOP_INVERTING false
21
 opt_add Z3_MAX_ENDSTOP_INVERTING false
21
 opt_add Z3_MAX_ENDSTOP_INVERTING false

Loading…
Cancel
Save