瀏覽代碼

🐛 Fix UBL 'R' parameter and adjust 'P' (#22129)

Katelyn Schiesser 4 年之前
父節點
當前提交
3a03f76f3c
沒有連結到貢獻者的電子郵件帳戶。

+ 2
- 2
Marlin/src/feature/bedlevel/ubl/ubl.cpp 查看文件

@@ -164,7 +164,7 @@ static void serial_echo_column_labels(const uint8_t sp) {
164 164
  *   2: TODO: Display on Graphical LCD
165 165
  *   4: Compact Human-Readable
166 166
  */
167
-void unified_bed_leveling::display_map(const int map_type) {
167
+void unified_bed_leveling::display_map(const uint8_t map_type) {
168 168
   const bool was = gcode.set_autoreport_paused(true);
169 169
 
170 170
   constexpr uint8_t eachsp = 1 + 6 + 1,                           // [-3.567]
@@ -263,7 +263,7 @@ bool unified_bed_leveling::sanity_check() {
263 263
   void GcodeSuite::M1004() {
264 264
 
265 265
     #define ALIGN_GCODE TERN(Z_STEPPER_AUTO_ALIGN, "G34", "")
266
-    #define PROBE_GCODE TERN(HAS_BED_PROBE, "G29P1\nG29P3", "G29P4R255")
266
+    #define PROBE_GCODE TERN(HAS_BED_PROBE, "G29P1\nG29P3", "G29P4R")
267 267
 
268 268
     #if HAS_HOTEND
269 269
       if (parser.seenval('H')) {                          // Handle H# parameter to set Hotend temp

+ 4
- 4
Marlin/src/feature/bedlevel/ubl/ubl.h 查看文件

@@ -47,10 +47,10 @@ struct mesh_index_pair;
47 47
 
48 48
 typedef struct {
49 49
   bool      C_seen;
50
-  int8_t    V_verbosity,
50
+  int8_t    KLS_storage_slot;
51
+  uint8_t   R_repetition,
52
+            V_verbosity,
51 53
             P_phase,
52
-            R_repetition,
53
-            KLS_storage_slot,
54 54
             T_map_type;
55 55
   float     B_shim_thickness,
56 56
             C_constant;
@@ -98,7 +98,7 @@ public:
98 98
   static void report_state();
99 99
   static void save_ubl_active_state_and_disable();
100 100
   static void restore_ubl_active_state_and_leave();
101
-  static void display_map(const int) _O0;
101
+  static void display_map(const uint8_t) _O0;
102 102
   static mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const xy_pos_t&, const bool=false, MeshFlags *done_flags=nullptr) _O0;
103 103
   static mesh_index_pair find_furthest_invalid_mesh_point() _O0;
104 104
   static void reset();

+ 14
- 14
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp 查看文件

@@ -305,7 +305,7 @@ void unified_bed_leveling::G29() {
305 305
   bool probe_deployed = false;
306 306
   if (G29_parse_parameters()) return; // Abort on parameter error
307 307
 
308
-  const int8_t p_val = parser.intval('P', -1);
308
+  const uint8_t p_val = parser.byteval('P');
309 309
   const bool may_move = p_val == 1 || p_val == 2 || p_val == 4 || parser.seen_test('J');
310 310
   #if ENABLED(HAS_MULTI_HOTEND)
311 311
     const uint8_t old_tool_index = active_extruder;
@@ -321,7 +321,7 @@ void unified_bed_leveling::G29() {
321 321
 
322 322
   // Invalidate one or more nearby mesh points, possibly all.
323 323
   if (parser.seen('I')) {
324
-    int16_t count = parser.has_value() ? parser.value_int() : 1;
324
+    uint8_t count = parser.has_value() ? parser.value_byte() : 1;
325 325
     bool invalidate_all = count >= GRID_MAX_POINTS;
326 326
     if (!invalidate_all) {
327 327
       while (count--) {
@@ -345,7 +345,7 @@ void unified_bed_leveling::G29() {
345 345
   }
346 346
 
347 347
   if (parser.seen('Q')) {
348
-    const int test_pattern = parser.has_value() ? parser.value_int() : -99;
348
+    const int16_t test_pattern = parser.has_value() ? parser.value_int() : -99;
349 349
     if (!WITHIN(test_pattern, -1, 2)) {
350 350
       SERIAL_ECHOLNPGM("Invalid test_pattern value. (-1 to 2)\n");
351 351
       return;
@@ -592,7 +592,7 @@ void unified_bed_leveling::G29() {
592 592
   //
593 593
 
594 594
   if (parser.seen('L')) {     // Load Current Mesh Data
595
-    param.KLS_storage_slot = parser.has_value() ? parser.value_int() : storage_slot;
595
+    param.KLS_storage_slot = parser.has_value() ? (int8_t)parser.value_int() : storage_slot;
596 596
 
597 597
     int16_t a = settings.calc_num_meshes();
598 598
 
@@ -617,10 +617,10 @@ void unified_bed_leveling::G29() {
617 617
   //
618 618
 
619 619
   if (parser.seen('S')) {     // Store (or Save) Current Mesh Data
620
-    param.KLS_storage_slot = parser.has_value() ? parser.value_int() : storage_slot;
620
+    param.KLS_storage_slot = parser.has_value() ? (int8_t)parser.value_int() : storage_slot;
621 621
 
622
-    if (param.KLS_storage_slot == -1)                     // Special case, the user wants to 'Export' the mesh to the
623
-      return report_current_mesh();                 // host program to be saved on the user's computer
622
+    if (param.KLS_storage_slot == -1)               // Special case: 'Export' the mesh to the
623
+      return report_current_mesh();                 // host so it can be saved in a file.
624 624
 
625 625
     int16_t a = settings.calc_num_meshes();
626 626
 
@@ -673,7 +673,7 @@ void unified_bed_leveling::G29() {
673 673
  */
674 674
 void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t offset) {
675 675
   float sum = 0;
676
-  int n = 0;
676
+  uint8_t n = 0;
677 677
   GRID_LOOP(x, y)
678 678
     if (!isnan(z_values[x][y])) {
679 679
       sum += z_values[x][y];
@@ -734,7 +734,7 @@ void unified_bed_leveling::shift_mesh_height() {
734 734
     do {
735 735
       if (do_ubl_mesh_map) display_map(param.T_map_type);
736 736
 
737
-      const int point_num = (GRID_MAX_POINTS) - count + 1;
737
+      const uint8_t point_num = (GRID_MAX_POINTS - count) + 1;
738 738
       SERIAL_ECHOLNPAIR("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, ".");
739 739
       TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), point_num, int(GRID_MAX_POINTS)));
740 740
 
@@ -1083,7 +1083,7 @@ bool unified_bed_leveling::G29_parse_parameters() {
1083 1083
   param.R_repetition = 0;
1084 1084
 
1085 1085
   if (parser.seen('R')) {
1086
-    param.R_repetition = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS;
1086
+    param.R_repetition = parser.has_value() ? parser.value_byte() : GRID_MAX_POINTS;
1087 1087
     NOMORE(param.R_repetition, GRID_MAX_POINTS);
1088 1088
     if (param.R_repetition < 1) {
1089 1089
       SERIAL_ECHOLNPGM("?(R)epetition count invalid (1+).\n");
@@ -1091,14 +1091,14 @@ bool unified_bed_leveling::G29_parse_parameters() {
1091 1091
     }
1092 1092
   }
1093 1093
 
1094
-  param.V_verbosity = parser.intval('V');
1094
+  param.V_verbosity = parser.byteval('V');
1095 1095
   if (!WITHIN(param.V_verbosity, 0, 4)) {
1096 1096
     SERIAL_ECHOLNPGM("?(V)erbose level implausible (0-4).\n");
1097 1097
     err_flag = true;
1098 1098
   }
1099 1099
 
1100 1100
   if (parser.seen('P')) {
1101
-    const int pv = parser.value_int();
1101
+    const uint8_t pv = parser.value_byte();
1102 1102
     #if !HAS_BED_PROBE
1103 1103
       if (pv == 1) {
1104 1104
         SERIAL_ECHOLNPGM("G29 P1 requires a probe.\n");
@@ -1181,7 +1181,7 @@ bool unified_bed_leveling::G29_parse_parameters() {
1181 1181
     }
1182 1182
   #endif
1183 1183
 
1184
-  param.T_map_type = parser.intval('T');
1184
+  param.T_map_type = parser.byteval('T');
1185 1185
   if (!WITHIN(param.T_map_type, 0, 2)) {
1186 1186
     SERIAL_ECHOLNPGM("Invalid map type.\n");
1187 1187
     return UBL_ERR;
@@ -1833,7 +1833,7 @@ void unified_bed_leveling::smart_fill_mesh() {
1833 1833
       return;
1834 1834
     }
1835 1835
 
1836
-    param.KLS_storage_slot = parser.value_int();
1836
+    param.KLS_storage_slot = (int8_t)parser.value_int();
1837 1837
 
1838 1838
     float tmp_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
1839 1839
     settings.load_mesh(param.KLS_storage_slot, &tmp_z_values);

+ 3
- 3
Marlin/src/lcd/menu/menu_ubl.cpp 查看文件

@@ -176,7 +176,7 @@ void _menu_ubl_height_adjust() {
176 176
 void _lcd_ubl_edit_mesh() {
177 177
   START_MENU();
178 178
   BACK_ITEM(MSG_UBL_TOOLS);
179
-  GCODES_ITEM(MSG_UBL_FINE_TUNE_ALL, PSTR("G29P4R999T"));
179
+  GCODES_ITEM(MSG_UBL_FINE_TUNE_ALL, PSTR("G29P4RT"));
180 180
   GCODES_ITEM(MSG_UBL_FINE_TUNE_CLOSEST, PSTR("G29P4T"));
181 181
   SUBMENU(MSG_UBL_MESH_HEIGHT_ADJUST, _menu_ubl_height_adjust);
182 182
   ACTION_ITEM(MSG_INFO_SCREEN, ui.return_to_status);
@@ -594,9 +594,9 @@ void _menu_ubl_tools() {
594 594
     GCODES_ITEM(MSG_UBL_1_BUILD_COLD_MESH, PSTR("G29NP1"));
595 595
     GCODES_ITEM(MSG_UBL_2_SMART_FILLIN, PSTR("G29P3T0"));
596 596
     SUBMENU(MSG_UBL_3_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh);
597
-    GCODES_ITEM(MSG_UBL_4_FINE_TUNE_ALL, PSTR("G29P4R999T"));
597
+    GCODES_ITEM(MSG_UBL_4_FINE_TUNE_ALL, PSTR("G29P4RT"));
598 598
     SUBMENU(MSG_UBL_5_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh);
599
-    GCODES_ITEM(MSG_UBL_6_FINE_TUNE_ALL, PSTR("G29P4R999T"));
599
+    GCODES_ITEM(MSG_UBL_6_FINE_TUNE_ALL, PSTR("G29P4RT"));
600 600
     ACTION_ITEM(MSG_UBL_7_SAVE_MESH, _lcd_ubl_save_mesh_cmd);
601 601
     END_MENU();
602 602
   }

Loading…
取消
儲存