Procházet zdrojové kódy

Followup to BLTouch (#13422)

InsanityAutomation před 5 roky
rodič
revize
5b2c37d6c1

+ 3
- 1
Marlin/src/feature/bedlevel/abl/abl.h Zobrazit soubor

@@ -40,4 +40,6 @@ void refresh_bed_level();
40 40
   void bilinear_line_to_destination(const float fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
41 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 Zobrazit soubor

@@ -48,38 +48,35 @@ void reset_bed_level();
48 48
   void set_z_fade_height(const float zfh, const bool do_report=true);
49 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 82
 #endif

+ 3
- 2
Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h Zobrazit soubor

@@ -34,6 +34,9 @@ enum MeshLevelingState : char {
34 34
 
35 35
 #define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X)) / (GRID_MAX_POINTS_X - 1))
36 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 41
 class mesh_bed_leveling {
39 42
 public:
@@ -118,5 +121,3 @@ public:
118 121
 };
119 122
 
120 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 Zobrazit soubor

@@ -335,7 +335,9 @@ class unified_bed_leveling {
335 335
 
336 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 342
 // Prevent debugging propagating to other files
341 343
 #include "../../../core/debug_out.h"

+ 9
- 9
Marlin/src/feature/bltouch.cpp Zobrazit soubor

@@ -69,19 +69,19 @@ bool BLTouch::set_deployed(const bool in_deploy) {
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 80
   #endif
79 81
 
80 82
   if (in_deploy) {
81 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 86
   else _stow();
87 87
 

+ 4
- 0
Marlin/src/gcode/calibrate/G34_M422.cpp Zobrazit soubor

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

+ 1
- 1
Marlin/src/lcd/extensible_ui/ui_api.cpp Zobrazit soubor

@@ -588,7 +588,7 @@ namespace ExtUI {
588 588
     void setLevelingActive(const bool state) { set_bed_leveling_enabled(state); }
589 589
     #if HAS_MESH
590 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 592
       void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zoff) {
593 593
         if (WITHIN(xpos, 0, GRID_MAX_POINTS_X) && WITHIN(ypos, 0, GRID_MAX_POINTS_Y)) {
594 594
           Z_VALUES(xpos, ypos) = zoff;

+ 0
- 1
Marlin/src/lcd/extensible_ui/ui_api.h Zobrazit soubor

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

+ 6
- 4
Marlin/src/pins/pins_RAMPS.h Zobrazit soubor

@@ -63,10 +63,12 @@
63 63
 //
64 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 72
 #endif
71 73
 #define SERVO1_PIN          6
72 74
 #define SERVO2_PIN          5

+ 1
- 1
buildroot/share/tests/DUE-tests Zobrazit soubor

@@ -15,7 +15,7 @@ exec_test $1 $2 "RAMPS4DUE_EFB S_CURVE_ACCELERATION EEPROM_SETTINGS"
15 15
 
16 16
 restore_configs
17 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 19
            Z_TRIPLE_STEPPER_DRIVERS Z_TRIPLE_ENDSTOPS Z_STEPPER_AUTO_ALIGN
20 20
 opt_add Z2_MAX_ENDSTOP_INVERTING false
21 21
 opt_add Z3_MAX_ENDSTOP_INVERTING false

Loading…
Zrušit
Uložit