Explorar el Código

Misc changes from struct refactor (#15289)

Scott Lahteine hace 4 años
padre
commit
c353eaa146
No account linked to committer's email address
Se han modificado 33 ficheros con 97 adiciones y 110 borrados
  1. 1
    1
      Marlin/src/HAL/shared/Delay.h
  2. 0
    11
      Marlin/src/core/enum.h
  3. 16
    6
      Marlin/src/core/macros.h
  4. 4
    5
      Marlin/src/feature/I2CPositionEncoder.cpp
  5. 0
    1
      Marlin/src/feature/babystep.h
  6. 0
    1
      Marlin/src/feature/bedlevel/abl/abl.cpp
  7. 6
    6
      Marlin/src/feature/bedlevel/bedlevel.h
  8. 2
    2
      Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h
  9. 18
    6
      Marlin/src/feature/bedlevel/ubl/ubl.cpp
  10. 3
    29
      Marlin/src/feature/bedlevel/ubl/ubl.h
  11. 7
    9
      Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
  12. 0
    1
      Marlin/src/feature/digipot/digipot_mcp4018.cpp
  13. 0
    2
      Marlin/src/feature/host_actions.h
  14. 2
    2
      Marlin/src/gcode/bedlevel/abl/G29.cpp
  15. 1
    1
      Marlin/src/gcode/bedlevel/abl/M421.cpp
  16. 1
    1
      Marlin/src/gcode/bedlevel/ubl/G29.cpp
  17. 1
    1
      Marlin/src/gcode/calibrate/G33.cpp
  18. 1
    1
      Marlin/src/gcode/calibrate/G34_M422.cpp
  19. 2
    2
      Marlin/src/gcode/calibrate/M48.cpp
  20. 9
    2
      Marlin/src/gcode/parser.h
  21. 1
    1
      Marlin/src/gcode/probe/G30.cpp
  22. 1
    2
      Marlin/src/inc/MarlinConfigPre.h
  23. 1
    1
      Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp
  24. 1
    1
      Marlin/src/lcd/dogm/ultralcd_DOGM.cpp
  25. 1
    1
      Marlin/src/lcd/extensible_ui/ui_api.cpp
  26. 2
    2
      Marlin/src/lcd/extensible_ui/ui_api.h
  27. 3
    3
      Marlin/src/lcd/fontutils.h
  28. 2
    2
      Marlin/src/lcd/menu/menu_ubl.cpp
  29. 3
    3
      Marlin/src/libs/least_squares_fit.h
  30. 4
    0
      Marlin/src/module/motion.h
  31. 1
    1
      Marlin/src/module/probe.cpp
  32. 1
    1
      Marlin/src/module/probe.h
  33. 2
    2
      Marlin/src/module/temperature.cpp

+ 1
- 1
Marlin/src/HAL/shared/Delay.h Ver fichero

@@ -29,8 +29,8 @@
29 29
  *  DELAY_US(count): Delay execution in microseconds
30 30
  */
31 31
 
32
-#include "../../core/macros.h"
33 32
 #include "../../core/millis_t.h"
33
+#include "../../core/macros.h"
34 34
 
35 35
 #if defined(__arm__) || defined(__thumb__)
36 36
 

+ 0
- 11
Marlin/src/core/enum.h Ver fichero

@@ -61,14 +61,3 @@ enum AxisEnum : unsigned char {
61 61
 #define LOOP_ABC(VAR) LOOP_S_LE_N(VAR, A_AXIS, C_AXIS)
62 62
 #define LOOP_ABCE(VAR) LOOP_S_LE_N(VAR, A_AXIS, E_AXIS)
63 63
 #define LOOP_ABCE_N(VAR) LOOP_S_L_N(VAR, A_AXIS, XYZE_N)
64
-
65
-typedef enum {
66
-  LINEARUNIT_MM,
67
-  LINEARUNIT_INCH
68
-} LinearUnit;
69
-
70
-typedef enum {
71
-  TEMPUNIT_C,
72
-  TEMPUNIT_K,
73
-  TEMPUNIT_F
74
-} TempUnit;

+ 16
- 6
Marlin/src/core/macros.h Ver fichero

@@ -198,12 +198,22 @@
198 198
   }while(0)
199 199
 
200 200
 // Macros for initializing arrays
201
-#define ARRAY_6(v1, v2, v3, v4, v5, v6, ...) { v1, v2, v3, v4, v5, v6 }
202
-#define ARRAY_5(v1, v2, v3, v4, v5, ...)     { v1, v2, v3, v4, v5 }
203
-#define ARRAY_4(v1, v2, v3, v4, ...)         { v1, v2, v3, v4 }
204
-#define ARRAY_3(v1, v2, v3, ...)             { v1, v2, v3 }
205
-#define ARRAY_2(v1, v2, ...)                 { v1, v2 }
206
-#define ARRAY_1(v1, ...)                     { v1 }
201
+#define ARRAY_16(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,...) { A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P }
202
+#define ARRAY_15(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,...) { A,B,C,D,E,F,G,H,I,J,K,L,M,N,O }
203
+#define ARRAY_14(A,B,C,D,E,F,G,H,I,J,K,L,M,N,...) { A,B,C,D,E,F,G,H,I,J,K,L,M,N }
204
+#define ARRAY_13(A,B,C,D,E,F,G,H,I,J,K,L,M,...) { A,B,C,D,E,F,G,H,I,J,K,L,M }
205
+#define ARRAY_12(A,B,C,D,E,F,G,H,I,J,K,L,...) { A,B,C,D,E,F,G,H,I,J,K,L }
206
+#define ARRAY_11(A,B,C,D,E,F,G,H,I,J,K,...) { A,B,C,D,E,F,G,H,I,J,K }
207
+#define ARRAY_10(A,B,C,D,E,F,G,H,I,J,...) { A,B,C,D,E,F,G,H,I,J }
208
+#define ARRAY_9( A,B,C,D,E,F,G,H,I,...) { A,B,C,D,E,F,G,H,I }
209
+#define ARRAY_8( A,B,C,D,E,F,G,H,...) { A,B,C,D,E,F,G,H }
210
+#define ARRAY_7( A,B,C,D,E,F,G,...) { A,B,C,D,E,F,G }
211
+#define ARRAY_6( A,B,C,D,E,F,...) { A,B,C,D,E,F }
212
+#define ARRAY_5( A,B,C,D,E,...) { A,B,C,D,E }
213
+#define ARRAY_4( A,B,C,D,...) { A,B,C,D }
214
+#define ARRAY_3( A,B,C,...) { A,B,C }
215
+#define ARRAY_2( A,B,...) { A,B }
216
+#define ARRAY_1( A,...) { A }
207 217
 
208 218
 #define _ARRAY_N(N,V...) ARRAY_##N(V)
209 219
 #define ARRAY_N(N,V...) _ARRAY_N(N,V)

+ 4
- 5
Marlin/src/feature/I2CPositionEncoder.cpp Ver fichero

@@ -334,11 +334,10 @@ bool I2CPositionEncoder::test_axis() {
334 334
 
335 335
   ec = false;
336 336
 
337
-  LOOP_NA(i) {
337
+  LOOP_XYZ(i) {
338 338
     startCoord[i] = planner.get_axis_position_mm((AxisEnum)i);
339 339
     endCoord[i] = planner.get_axis_position_mm((AxisEnum)i);
340 340
   }
341
-
342 341
   startCoord[encoderAxis] = startPosition;
343 342
   endCoord[encoderAxis] = endPosition;
344 343
 
@@ -393,9 +392,9 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) {
393 392
   endDistance = soft_endstop[encoderAxis].max - 20;
394 393
   travelDistance = endDistance - startDistance;
395 394
 
396
-  LOOP_NA(i) {
397
-    startCoord[i] = planner.get_axis_position_mm((AxisEnum)i);
398
-    endCoord[i] = planner.get_axis_position_mm((AxisEnum)i);
395
+  LOOP_XYZ(a) {
396
+    startCoord[a] = planner.get_axis_position_mm((AxisEnum)a);
397
+    endCoord[a] = planner.get_axis_position_mm((AxisEnum)a);
399 398
   }
400 399
 
401 400
   startCoord[encoderAxis] = startDistance;

+ 0
- 1
Marlin/src/feature/babystep.h Ver fichero

@@ -22,7 +22,6 @@
22 22
 #pragma once
23 23
 
24 24
 #include "../inc/MarlinConfigPre.h"
25
-#include "../core/enum.h"
26 25
 
27 26
 #if IS_CORE || EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS)
28 27
   #define BS_TODO_AXIS(A) A

+ 0
- 1
Marlin/src/feature/bedlevel/abl/abl.cpp Ver fichero

@@ -24,7 +24,6 @@
24 24
 
25 25
 #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
26 26
 
27
-#include "abl.h"
28 27
 #include "../bedlevel.h"
29 28
 
30 29
 #include "../../../module/motion.h"

+ 6
- 6
Marlin/src/feature/bedlevel/bedlevel.h Ver fichero

@@ -23,11 +23,6 @@
23 23
 
24 24
 #include "../../inc/MarlinConfigPre.h"
25 25
 
26
-typedef struct {
27
-  int8_t x_index, y_index;
28
-  float distance; // When populated, the distance from the search location
29
-} mesh_index_pair;
30
-
31 26
 #if ENABLED(PROBE_MANUALLY)
32 27
   extern bool g29_in_progress;
33 28
 #else
@@ -60,7 +55,12 @@ class TemporaryBedLevelingState {
60 55
 
61 56
 #if HAS_MESH
62 57
 
63
-  typedef float (&bed_mesh_t)[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
58
+  typedef float bed_mesh_t[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
59
+
60
+  typedef struct {
61
+    int8_t x_index, y_index;
62
+    float distance; // When populated, the distance from the search location
63
+  } mesh_index_pair;
64 64
 
65 65
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
66 66
     #include "abl/abl.h"

+ 2
- 2
Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h Ver fichero

@@ -32,8 +32,8 @@ enum MeshLevelingState : char {
32 32
   MeshReset       // G29 S5
33 33
 };
34 34
 
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))
35
+#define MESH_X_DIST (float(MESH_MAX_X - (MESH_MIN_X)) / float(GRID_MAX_POINTS_X - 1))
36
+#define MESH_Y_DIST (float(MESH_MAX_Y - (MESH_MIN_Y)) / float(GRID_MAX_POINTS_Y - 1))
37 37
 #define _GET_MESH_X(I) mbl.index_to_xpos[I]
38 38
 #define _GET_MESH_Y(J) mbl.index_to_ypos[J]
39 39
 #define Z_VALUES_ARR mbl.z_values

+ 18
- 6
Marlin/src/feature/bedlevel/ubl/ubl.cpp Ver fichero

@@ -24,13 +24,14 @@
24 24
 
25 25
 #if ENABLED(AUTO_BED_LEVELING_UBL)
26 26
 
27
-  #include "ubl.h"
27
+  #include "../bedlevel.h"
28
+
28 29
   unified_bed_leveling ubl;
29 30
 
30 31
   #include "../../../module/configuration_store.h"
31 32
   #include "../../../module/planner.h"
32 33
   #include "../../../module/motion.h"
33
-  #include "../../bedlevel/bedlevel.h"
34
+  #include "../../../module/probe.h"
34 35
 
35 36
   #if ENABLED(EXTENSIBLE_UI)
36 37
     #include "../../../lcd/extensible_ui/ui_api.h"
@@ -66,10 +67,21 @@
66 67
 
67 68
   float unified_bed_leveling::z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
68 69
 
69
-  // 15 is the maximum nubmer of grid points supported + 1 safety margin for now,
70
-  // until determinism prevails
71
-  constexpr float unified_bed_leveling::_mesh_index_to_xpos[16],
72
-                  unified_bed_leveling::_mesh_index_to_ypos[16];
70
+  #define _GRIDPOS(A,N) (MESH_MIN_##A + N * (MESH_##A##_DIST))
71
+
72
+  const float
73
+  unified_bed_leveling::_mesh_index_to_xpos[GRID_MAX_POINTS_X] PROGMEM = ARRAY_N(GRID_MAX_POINTS_X,
74
+    _GRIDPOS(X,  0), _GRIDPOS(X,  1), _GRIDPOS(X,  2), _GRIDPOS(X,  3),
75
+    _GRIDPOS(X,  4), _GRIDPOS(X,  5), _GRIDPOS(X,  6), _GRIDPOS(X,  7),
76
+    _GRIDPOS(X,  8), _GRIDPOS(X,  9), _GRIDPOS(X, 10), _GRIDPOS(X, 11),
77
+    _GRIDPOS(X, 12), _GRIDPOS(X, 13), _GRIDPOS(X, 14), _GRIDPOS(X, 15)
78
+  ),
79
+  unified_bed_leveling::_mesh_index_to_ypos[GRID_MAX_POINTS_Y] PROGMEM = ARRAY_N(GRID_MAX_POINTS_Y,
80
+    _GRIDPOS(Y,  0), _GRIDPOS(Y,  1), _GRIDPOS(Y,  2), _GRIDPOS(Y,  3),
81
+    _GRIDPOS(Y,  4), _GRIDPOS(Y,  5), _GRIDPOS(Y,  6), _GRIDPOS(Y,  7),
82
+    _GRIDPOS(Y,  8), _GRIDPOS(Y,  9), _GRIDPOS(Y, 10), _GRIDPOS(Y, 11),
83
+    _GRIDPOS(Y, 12), _GRIDPOS(Y, 13), _GRIDPOS(Y, 14), _GRIDPOS(Y, 15)
84
+  );
73 85
 
74 86
   #if HAS_LCD_MENU
75 87
     bool unified_bed_leveling::lcd_map_control = false;

+ 3
- 29
Marlin/src/feature/bedlevel/ubl/ubl.h Ver fichero

@@ -23,11 +23,7 @@
23 23
 
24 24
 //#define UBL_DEVEL_DEBUGGING
25 25
 
26
-#include "../bedlevel.h"
27
-#include "../../../module/planner.h"
28 26
 #include "../../../module/motion.h"
29
-#include "../../../lcd/ultralcd.h"
30
-#include "../../../Marlin.h"
31 27
 
32 28
 #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
33 29
 #include "../../../core/debug_out.h"
@@ -108,31 +104,9 @@ class unified_bed_leveling {
108 104
 
109 105
     static int8_t storage_slot;
110 106
 
111
-    static float z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
112
-
113
-    // 15 is the maximum nubmer of grid points supported + 1 safety margin for now,
114
-    // until determinism prevails
115
-    static constexpr float _mesh_index_to_xpos[16] PROGMEM = {
116
-                              MESH_MIN_X +  0 * (MESH_X_DIST), MESH_MIN_X +  1 * (MESH_X_DIST),
117
-                              MESH_MIN_X +  2 * (MESH_X_DIST), MESH_MIN_X +  3 * (MESH_X_DIST),
118
-                              MESH_MIN_X +  4 * (MESH_X_DIST), MESH_MIN_X +  5 * (MESH_X_DIST),
119
-                              MESH_MIN_X +  6 * (MESH_X_DIST), MESH_MIN_X +  7 * (MESH_X_DIST),
120
-                              MESH_MIN_X +  8 * (MESH_X_DIST), MESH_MIN_X +  9 * (MESH_X_DIST),
121
-                              MESH_MIN_X + 10 * (MESH_X_DIST), MESH_MIN_X + 11 * (MESH_X_DIST),
122
-                              MESH_MIN_X + 12 * (MESH_X_DIST), MESH_MIN_X + 13 * (MESH_X_DIST),
123
-                              MESH_MIN_X + 14 * (MESH_X_DIST), MESH_MIN_X + 15 * (MESH_X_DIST)
124
-                            };
125
-
126
-    static constexpr float _mesh_index_to_ypos[16] PROGMEM = {
127
-                              MESH_MIN_Y +  0 * (MESH_Y_DIST), MESH_MIN_Y +  1 * (MESH_Y_DIST),
128
-                              MESH_MIN_Y +  2 * (MESH_Y_DIST), MESH_MIN_Y +  3 * (MESH_Y_DIST),
129
-                              MESH_MIN_Y +  4 * (MESH_Y_DIST), MESH_MIN_Y +  5 * (MESH_Y_DIST),
130
-                              MESH_MIN_Y +  6 * (MESH_Y_DIST), MESH_MIN_Y +  7 * (MESH_Y_DIST),
131
-                              MESH_MIN_Y +  8 * (MESH_Y_DIST), MESH_MIN_Y +  9 * (MESH_Y_DIST),
132
-                              MESH_MIN_Y + 10 * (MESH_Y_DIST), MESH_MIN_Y + 11 * (MESH_Y_DIST),
133
-                              MESH_MIN_Y + 12 * (MESH_Y_DIST), MESH_MIN_Y + 13 * (MESH_Y_DIST),
134
-                              MESH_MIN_Y + 14 * (MESH_Y_DIST), MESH_MIN_Y + 15 * (MESH_Y_DIST)
135
-                            };
107
+    static bed_mesh_t z_values;
108
+    static const float _mesh_index_to_xpos[GRID_MAX_POINTS_X],
109
+                       _mesh_index_to_ypos[GRID_MAX_POINTS_Y];
136 110
 
137 111
     #if HAS_LCD_MENU
138 112
       static bool lcd_map_control;

+ 7
- 9
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp Ver fichero

@@ -24,7 +24,7 @@
24 24
 
25 25
 #if ENABLED(AUTO_BED_LEVELING_UBL)
26 26
 
27
-  #include "ubl.h"
27
+  #include "../bedlevel.h"
28 28
 
29 29
   #include "../../../Marlin.h"
30 30
   #include "../../../HAL/shared/persistent_store_api.h"
@@ -33,11 +33,9 @@
33 33
   #include "../../../lcd/ultralcd.h"
34 34
   #include "../../../module/stepper.h"
35 35
   #include "../../../module/planner.h"
36
+  #include "../../../module/motion.h"
36 37
   #include "../../../module/probe.h"
37 38
   #include "../../../gcode/gcode.h"
38
-  #include "../../../core/serial.h"
39
-  #include "../../../gcode/parser.h"
40
-  #include "../../../feature/bedlevel/bedlevel.h"
41 39
   #include "../../../libs/least_squares_fit.h"
42 40
 
43 41
   #if ENABLED(DUAL_X_CARRIAGE)
@@ -783,7 +781,7 @@
783 781
         if (location.x_index >= 0) {    // mesh point found and is reachable by probe
784 782
           const float rawx = mesh_index_to_xpos(location.x_index),
785 783
                       rawy = mesh_index_to_ypos(location.y_index),
786
-                      measured_z = probe_pt(rawx, rawy, stow_probe ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level); // TODO: Needs error handling
784
+                      measured_z = probe_at_point(rawx, rawy, stow_probe ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level); // TODO: Needs error handling
787 785
           z_values[location.x_index][location.y_index] = measured_z;
788 786
           #if ENABLED(EXTENSIBLE_UI)
789 787
             ExtUI::onMeshUpdate(location.x_index, location.y_index, measured_z);
@@ -1410,7 +1408,7 @@
1410 1408
           ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " 1/3"));
1411 1409
         #endif
1412 1410
 
1413
-        measured_z = probe_pt(PROBE_PT_1_X, PROBE_PT_1_Y, PROBE_PT_RAISE, g29_verbose_level);
1411
+        measured_z = probe_at_point(PROBE_PT_1_X, PROBE_PT_1_Y, PROBE_PT_RAISE, g29_verbose_level);
1414 1412
         if (isnan(measured_z))
1415 1413
           abort_flag = true;
1416 1414
         else {
@@ -1429,7 +1427,7 @@
1429 1427
             ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " 2/3"));
1430 1428
           #endif
1431 1429
 
1432
-          measured_z = probe_pt(PROBE_PT_2_X, PROBE_PT_2_Y, PROBE_PT_RAISE, g29_verbose_level);
1430
+          measured_z = probe_at_point(PROBE_PT_2_X, PROBE_PT_2_Y, PROBE_PT_RAISE, g29_verbose_level);
1433 1431
           //z2 = measured_z;
1434 1432
           if (isnan(measured_z))
1435 1433
             abort_flag = true;
@@ -1449,7 +1447,7 @@
1449 1447
             ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " 3/3"));
1450 1448
           #endif
1451 1449
 
1452
-          measured_z = probe_pt(PROBE_PT_3_X, PROBE_PT_3_Y, PROBE_PT_STOW, g29_verbose_level);
1450
+          measured_z = probe_at_point(PROBE_PT_3_X, PROBE_PT_3_Y, PROBE_PT_STOW, g29_verbose_level);
1453 1451
           //z3 = measured_z;
1454 1452
           if (isnan(measured_z))
1455 1453
             abort_flag = true;
@@ -1490,7 +1488,7 @@
1490 1488
                 ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " %i/%i"), point_num, total_points);
1491 1489
               #endif
1492 1490
 
1493
-              measured_z = probe_pt(rx, ry, parser.seen('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level); // TODO: Needs error handling
1491
+              measured_z = probe_at_point(rx, ry, parser.seen('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level); // TODO: Needs error handling
1494 1492
 
1495 1493
               abort_flag = isnan(measured_z);
1496 1494
 

+ 0
- 1
Marlin/src/feature/digipot/digipot_mcp4018.cpp Ver fichero

@@ -24,7 +24,6 @@
24 24
 
25 25
 #if BOTH(DIGIPOT_I2C, DIGIPOT_MCP4018)
26 26
 
27
-#include "../../core/enum.h"
28 27
 #include "Stream.h"
29 28
 #include "utility/twi.h"
30 29
 #include <SlowSoftI2CMaster.h>  //https://github.com/stawel/SlowSoftI2CMaster

+ 0
- 2
Marlin/src/feature/host_actions.h Ver fichero

@@ -23,8 +23,6 @@
23 23
 
24 24
 #include "../inc/MarlinConfigPre.h"
25 25
 
26
-#include <stddef.h>
27
-
28 26
 void host_action(const char * const pstr, const bool eol=true);
29 27
 
30 28
 #ifdef ACTION_ON_KILL

+ 2
- 2
Marlin/src/gcode/bedlevel/abl/G29.cpp Ver fichero

@@ -714,7 +714,7 @@ G29_TYPE GcodeSuite::G29() {
714 714
             ui.status_printf_P(0, PSTR(MSG_PROBING_MESH " %i/%i"), int(pt_index), int(GRID_MAX_POINTS));
715 715
           #endif
716 716
 
717
-          measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, raise_after, verbose_level);
717
+          measured_z = faux ? 0.001 * random(-100, 101) : probe_at_point(xProbe, yProbe, raise_after, verbose_level);
718 718
 
719 719
           if (isnan(measured_z)) {
720 720
             set_bed_leveling_enabled(abl_should_enable);
@@ -759,7 +759,7 @@ G29_TYPE GcodeSuite::G29() {
759 759
         // Retain the last probe position
760 760
         xProbe = points[i].x;
761 761
         yProbe = points[i].y;
762
-        measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, raise_after, verbose_level);
762
+        measured_z = faux ? 0.001 * random(-100, 101) : probe_at_point(xProbe, yProbe, raise_after, verbose_level);
763 763
         if (isnan(measured_z)) {
764 764
           set_bed_leveling_enabled(abl_should_enable);
765 765
           break;

+ 1
- 1
Marlin/src/gcode/bedlevel/abl/M421.cpp Ver fichero

@@ -29,7 +29,7 @@
29 29
 #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
30 30
 
31 31
 #include "../../gcode.h"
32
-#include "../../../feature/bedlevel/abl/abl.h"
32
+#include "../../../feature/bedlevel/bedlevel.h"
33 33
 
34 34
 #if ENABLED(EXTENSIBLE_UI)
35 35
   #include "../../../lcd/extensible_ui/ui_api.h"

+ 1
- 1
Marlin/src/gcode/bedlevel/ubl/G29.cpp Ver fichero

@@ -29,7 +29,7 @@
29 29
 #if ENABLED(AUTO_BED_LEVELING_UBL)
30 30
 
31 31
 #include "../../gcode.h"
32
-#include "../../../feature/bedlevel/ubl/ubl.h"
32
+#include "../../../feature/bedlevel/bedlevel.h"
33 33
 
34 34
 void GcodeSuite::G29() { ubl.G29(); }
35 35
 

+ 1
- 1
Marlin/src/gcode/calibrate/G33.cpp Ver fichero

@@ -190,7 +190,7 @@ static float std_dev_points(float z_pt[NPP + 1], const bool _0p_cal, const bool
190 190
  */
191 191
 static float calibration_probe(const float &nx, const float &ny, const bool stow) {
192 192
   #if HAS_BED_PROBE
193
-    return probe_pt(nx, ny, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, false);
193
+    return probe_at_point(nx, ny, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, false);
194 194
   #else
195 195
     UNUSED(stow);
196 196
     return lcd_probe_pt(nx, ny);

+ 1
- 1
Marlin/src/gcode/calibrate/G34_M422.cpp Ver fichero

@@ -162,7 +162,7 @@ void GcodeSuite::G34() {
162 162
         if (iteration == 0 || izstepper > 0) do_blocking_move_to_z(z_probe);
163 163
 
164 164
         // Probe a Z height for each stepper.
165
-        const float z_probed_height = probe_pt(z_auto_align_xpos[zstepper], z_auto_align_ypos[zstepper], raise_after, 0, true);
165
+        const float z_probed_height = probe_at_point(z_auto_align_xpos[zstepper], z_auto_align_ypos[zstepper], raise_after, 0, true);
166 166
         if (isnan(z_probed_height)) {
167 167
           SERIAL_ECHOLNPGM("Probing failed.");
168 168
           err_break = true;

+ 2
- 2
Marlin/src/gcode/calibrate/M48.cpp Ver fichero

@@ -116,7 +116,7 @@ void GcodeSuite::M48() {
116 116
   float mean = 0.0, sigma = 0.0, min = 99999.9, max = -99999.9, sample_set[n_samples];
117 117
 
118 118
   // Move to the first point, deploy, and probe
119
-  const float t = probe_pt(X_probe_location, Y_probe_location, raise_after, verbose_level);
119
+  const float t = probe_at_point(X_probe_location, Y_probe_location, raise_after, verbose_level);
120 120
   bool probing_good = !isnan(t);
121 121
 
122 122
   if (probing_good) {
@@ -190,7 +190,7 @@ void GcodeSuite::M48() {
190 190
       } // n_legs
191 191
 
192 192
       // Probe a single point
193
-      sample_set[n] = probe_pt(X_probe_location, Y_probe_location, raise_after, 0);
193
+      sample_set[n] = probe_at_point(X_probe_location, Y_probe_location, raise_after, 0);
194 194
 
195 195
       // Break the loop if the probe fails
196 196
       probing_good = !isnan(sample_set[n]);

+ 9
- 2
Marlin/src/gcode/parser.h Ver fichero

@@ -34,6 +34,14 @@
34 34
   #include "../libs/hex_print_routines.h"
35 35
 #endif
36 36
 
37
+#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
38
+  typedef enum : uint8_t { TEMPUNIT_C, TEMPUNIT_K, TEMPUNIT_F } TempUnit;
39
+#endif
40
+
41
+#if ENABLED(INCH_MODE_SUPPORT)
42
+  typedef enum : uint8_t { LINEARUNIT_MM, LINEARUNIT_INCH } LinearUnit;
43
+#endif
44
+
37 45
 /**
38 46
  * GCode parser
39 47
  *
@@ -254,7 +262,6 @@ public:
254 262
   // Units modes: Inches, Fahrenheit, Kelvin
255 263
 
256 264
   #if ENABLED(INCH_MODE_SUPPORT)
257
-
258 265
     static inline float mm_to_linear_unit(const float mm)     { return mm / linear_unit_factor; }
259 266
     static inline float mm_to_volumetric_unit(const float mm) { return mm / (volumetric_enabled ? volumetric_unit_factor : linear_unit_factor); }
260 267
 
@@ -298,7 +305,7 @@ public:
298 305
 
299 306
   #if ENABLED(TEMPERATURE_UNITS_SUPPORT)
300 307
 
301
-    static inline void set_input_temp_units(TempUnit units) { input_temp_units = units; }
308
+    static inline void set_input_temp_units(const TempUnit units) { input_temp_units = units; }
302 309
 
303 310
     #if HAS_LCD_MENU && DISABLED(DISABLE_M503)
304 311
 

+ 1
- 1
Marlin/src/gcode/probe/G30.cpp Ver fichero

@@ -52,7 +52,7 @@ void GcodeSuite::G30() {
52 52
   setup_for_endstop_or_probe_move();
53 53
 
54 54
   const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
55
-  const float measured_z = probe_pt(xpos, ypos, raise_after, 1);
55
+  const float measured_z = probe_at_point(xpos, ypos, raise_after, 1);
56 56
 
57 57
   if (!isnan(measured_z))
58 58
     SERIAL_ECHOLNPAIR("Bed X: ", FIXFLOAT(xpos), " Y: ", FIXFLOAT(ypos), " Z: ", FIXFLOAT(measured_z));

+ 1
- 2
Marlin/src/inc/MarlinConfigPre.h Ver fichero

@@ -28,6 +28,7 @@
28 28
 //
29 29
 // Prefix header to acquire configurations
30 30
 //
31
+#include <stdint.h>
31 32
 
32 33
 #include "../HAL/platforms.h"
33 34
 
@@ -45,5 +46,3 @@
45 46
 
46 47
 #include "Conditionals_adv.h"
47 48
 #include HAL_PATH(../HAL, inc/Conditionals_adv.h)
48
-
49
-#include <stdint.h>

+ 1
- 1
Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp Ver fichero

@@ -47,7 +47,7 @@
47 47
 #endif
48 48
 
49 49
 #if ENABLED(AUTO_BED_LEVELING_UBL)
50
-  #include "../../feature/bedlevel/ubl/ubl.h"
50
+  #include "../../feature/bedlevel/bedlevel.h"
51 51
 #endif
52 52
 
53 53
 //

+ 1
- 1
Marlin/src/lcd/dogm/ultralcd_DOGM.cpp Ver fichero

@@ -60,7 +60,7 @@
60 60
 #endif
61 61
 
62 62
 #if ENABLED(AUTO_BED_LEVELING_UBL)
63
-  #include "../../feature/bedlevel/ubl/ubl.h"
63
+  #include "../../feature/bedlevel/bedlevel.h"
64 64
 #endif
65 65
 
66 66
 /**

+ 1
- 1
Marlin/src/lcd/extensible_ui/ui_api.cpp Ver fichero

@@ -809,7 +809,7 @@ namespace ExtUI {
809 809
     void setLevelingActive(const bool state) { set_bed_leveling_enabled(state); }
810 810
     bool getMeshValid() { return leveling_is_valid(); }
811 811
     #if HAS_MESH
812
-      bed_mesh_t getMeshArray() { return Z_VALUES_ARR; }
812
+      bed_mesh_t& getMeshArray() { return Z_VALUES_ARR; }
813 813
       float getMeshPoint(const uint8_t xpos, const uint8_t ypos) { return Z_VALUES(xpos,ypos); }
814 814
       void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zoff) {
815 815
         if (WITHIN(xpos, 0, GRID_MAX_POINTS_X) && WITHIN(ypos, 0, GRID_MAX_POINTS_Y)) {

+ 2
- 2
Marlin/src/lcd/extensible_ui/ui_api.h Ver fichero

@@ -61,7 +61,7 @@ namespace ExtUI {
61 61
   constexpr uint8_t fanCount      = FAN_COUNT;
62 62
 
63 63
   #if HAS_MESH
64
-    typedef float (&bed_mesh_t)[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
64
+    typedef float bed_mesh_t[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
65 65
   #endif
66 66
 
67 67
   bool isMoving();
@@ -128,7 +128,7 @@ namespace ExtUI {
128 128
     void setLevelingActive(const bool);
129 129
     bool getMeshValid();
130 130
     #if HAS_MESH
131
-      bed_mesh_t getMeshArray();
131
+      bed_mesh_t& getMeshArray();
132 132
       float getMeshPoint(const uint8_t xpos, const uint8_t ypos);
133 133
       void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zval);
134 134
       void onMeshUpdate(const uint8_t xpos, const uint8_t ypos, const float zval);

+ 3
- 3
Marlin/src/lcd/fontutils.h Ver fichero

@@ -8,13 +8,13 @@
8 8
  */
9 9
 #pragma once
10 10
 
11
-#include "../HAL/shared/Marduino.h"
12
-#include "../core/macros.h"
13
-
14 11
 #include <stdlib.h>
15 12
 #include <stddef.h> // wchar_t
16 13
 #include <stdint.h> // uint32_t
17 14
 
15
+#include "../HAL/shared/Marduino.h"
16
+#include "../core/macros.h"
17
+
18 18
 // read a byte from ROM or RAM
19 19
 typedef uint8_t (*read_byte_cb_t)(uint8_t * str);
20 20
 

+ 2
- 2
Marlin/src/lcd/menu/menu_ubl.cpp Ver fichero

@@ -420,8 +420,8 @@ void _lcd_ubl_map_homing() {
420 420
  */
421 421
 void _lcd_ubl_map_lcd_edit_cmd() {
422 422
   char ubl_lcd_gcode[50], str[10], str2[10];
423
-  dtostrf(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), 0, 2, str);
424
-  dtostrf(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]), 0, 2, str2);
423
+  dtostrf(ubl.mesh_index_to_xpos(x_plot), 0, 2, str);
424
+  dtostrf(ubl.mesh_index_to_ypos(y_plot), 0, 2, str2);
425 425
   snprintf_P(ubl_lcd_gcode, sizeof(ubl_lcd_gcode), PSTR("G29 P4 X%s Y%s R%i"), str, str2, int(n_edit_pts));
426 426
   lcd_enqueue_one_now(ubl_lcd_gcode);
427 427
 }

+ 3
- 3
Marlin/src/libs/least_squares_fit.h Ver fichero

@@ -44,11 +44,11 @@ struct linear_fit_data {
44 44
         A, B, D, N;
45 45
 };
46 46
 
47
-void inline incremental_LSF_reset(struct linear_fit_data *lsf) {
47
+inline void incremental_LSF_reset(struct linear_fit_data *lsf) {
48 48
   memset(lsf, 0, sizeof(linear_fit_data));
49 49
 }
50 50
 
51
-void inline incremental_WLSF(struct linear_fit_data *lsf, const float &x, const float &y, const float &z, const float &w) {
51
+inline void incremental_WLSF(struct linear_fit_data *lsf, const float &x, const float &y, const float &z, const float &w) {
52 52
   // weight each accumulator by factor w, including the "number" of samples
53 53
   // (analogous to calling inc_LSF twice with same values to weight it by 2X)
54 54
   const float wx = w * x, wy = w * y, wz = w * z;
@@ -66,7 +66,7 @@ void inline incremental_WLSF(struct linear_fit_data *lsf, const float &x, const
66 66
   lsf->max_absy = _MAX(ABS(wy), lsf->max_absy);
67 67
 }
68 68
 
69
-void inline incremental_LSF(struct linear_fit_data *lsf, const float &x, const float &y, const float &z) {
69
+inline void incremental_LSF(struct linear_fit_data *lsf, const float &x, const float &y, const float &z) {
70 70
   lsf->xbar += x;
71 71
   lsf->ybar += y;
72 72
   lsf->zbar += z;

+ 4
- 0
Marlin/src/module/motion.h Ver fichero

@@ -34,6 +34,10 @@
34 34
   #include "scara.h"
35 35
 #endif
36 36
 
37
+#if HAS_BED_PROBE
38
+  #include "probe.h"
39
+#endif
40
+
37 41
 // Axis homed and known-position states
38 42
 extern uint8_t axis_homed, axis_known_position;
39 43
 constexpr uint8_t xyz_bits = _BV(X_AXIS) | _BV(Y_AXIS) | _BV(Z_AXIS);

+ 1
- 1
Marlin/src/module/probe.cpp Ver fichero

@@ -683,7 +683,7 @@ static float run_z_probe() {
683 683
  *   - Raise to the BETWEEN height
684 684
  * - Return the probed Z position
685 685
  */
686
-float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/*=PROBE_PT_NONE*/, const uint8_t verbose_level/*=0*/, const bool probe_relative/*=true*/) {
686
+float probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_after/*=PROBE_PT_NONE*/, const uint8_t verbose_level/*=0*/, const bool probe_relative/*=true*/) {
687 687
   if (DEBUGGING(LEVELING)) {
688 688
     DEBUG_ECHOLNPAIR(
689 689
       ">>> probe_pt(", LOGICAL_X_POSITION(rx), ", ", LOGICAL_Y_POSITION(ry),

+ 1
- 1
Marlin/src/module/probe.h Ver fichero

@@ -39,7 +39,7 @@
39 39
     PROBE_PT_RAISE, // Raise to "between" clearance after run_z_probe
40 40
     PROBE_PT_BIG_RAISE  // Raise to big clearance after run_z_probe
41 41
   };
42
-  float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true);
42
+  float probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true);
43 43
   #define DEPLOY_PROBE() set_probe_deployed(true)
44 44
   #define STOW_PROBE() set_probe_deployed(false)
45 45
   #if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)

+ 2
- 2
Marlin/src/module/temperature.cpp Ver fichero

@@ -245,7 +245,7 @@ Temperature thermalManager;
245 245
       int16_t Temperature::maxtemp_raw_CHAMBER = HEATER_CHAMBER_RAW_HI_TEMP;
246 246
     #endif
247 247
     #if WATCH_CHAMBER
248
-      heater_watch_t Temperature::watch_chamber = { 0 };
248
+      heater_watch_t Temperature::watch_chamber{0};
249 249
     #endif
250 250
     millis_t Temperature::next_chamber_check_ms;
251 251
   #endif // HAS_HEATED_CHAMBER
@@ -930,7 +930,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
930 930
 
931 931
     #if DISABLED(PID_OPENLOOP)
932 932
 
933
-      static PID_t work_pid = { 0 };
933
+      static PID_t work_pid{0};
934 934
       static float temp_iState = 0, temp_dState = 0;
935 935
       static bool pid_reset = true;
936 936
       float pid_output = 0;

Loading…
Cancelar
Guardar