@@ -305,7 +305,7 @@ void unified_bed_leveling::G29() {
305305 bool probe_deployed = false ;
306306 if (G29_parse_parameters ()) return ; // Abort on parameter error
307307
308- const int8_t p_val = parser.intval (' P' , - 1 );
308+ const uint8_t p_val = parser.byteval (' P' );
309309 const bool may_move = p_val == 1 || p_val == 2 || p_val == 4 || parser.seen_test (' J' );
310310 #if ENABLED(HAS_MULTI_HOTEND)
311311 const uint8_t old_tool_index = active_extruder;
@@ -321,7 +321,7 @@ void unified_bed_leveling::G29() {
321321
322322 // Invalidate one or more nearby mesh points, possibly all.
323323 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 ;
325325 bool invalidate_all = count >= GRID_MAX_POINTS;
326326 if (!invalidate_all) {
327327 while (count--) {
@@ -345,7 +345,7 @@ void unified_bed_leveling::G29() {
345345 }
346346
347347 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 ;
349349 if (!WITHIN (test_pattern, -1 , 2 )) {
350350 SERIAL_ECHOLNPGM (" Invalid test_pattern value. (-1 to 2)\n " );
351351 return ;
@@ -592,7 +592,7 @@ void unified_bed_leveling::G29() {
592592 //
593593
594594 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;
596596
597597 int16_t a = settings.calc_num_meshes ();
598598
@@ -617,10 +617,10 @@ void unified_bed_leveling::G29() {
617617 //
618618
619619 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;
621621
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.
624624
625625 int16_t a = settings.calc_num_meshes ();
626626
@@ -673,7 +673,7 @@ void unified_bed_leveling::G29() {
673673 */
674674void unified_bed_leveling::adjust_mesh_to_mean (const bool cflag, const_float_t offset) {
675675 float sum = 0 ;
676- int n = 0 ;
676+ uint8_t n = 0 ;
677677 GRID_LOOP (x, y)
678678 if (!isnan (z_values[x][y])) {
679679 sum += z_values[x][y];
@@ -734,7 +734,7 @@ void unified_bed_leveling::shift_mesh_height() {
734734 do {
735735 if (do_ubl_mesh_map) display_map (param.T_map_type );
736736
737- const int point_num = (GRID_MAX_POINTS) - count + 1 ;
737+ const uint8_t point_num = (GRID_MAX_POINTS - count) + 1 ;
738738 SERIAL_ECHOLNPAIR (" Probing mesh point " , point_num, " /" , GRID_MAX_POINTS, " ." );
739739 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)));
740740
@@ -1083,22 +1083,22 @@ bool unified_bed_leveling::G29_parse_parameters() {
10831083 param.R_repetition = 0 ;
10841084
10851085 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;
10871087 NOMORE (param.R_repetition , GRID_MAX_POINTS);
10881088 if (param.R_repetition < 1 ) {
10891089 SERIAL_ECHOLNPGM (" ?(R)epetition count invalid (1+).\n " );
10901090 return UBL_ERR;
10911091 }
10921092 }
10931093
1094- param.V_verbosity = parser.intval (' V' );
1094+ param.V_verbosity = parser.byteval (' V' );
10951095 if (!WITHIN (param.V_verbosity , 0 , 4 )) {
10961096 SERIAL_ECHOLNPGM (" ?(V)erbose level implausible (0-4).\n " );
10971097 err_flag = true ;
10981098 }
10991099
11001100 if (parser.seen (' P' )) {
1101- const int pv = parser.value_int ();
1101+ const uint8_t pv = parser.value_byte ();
11021102 #if !HAS_BED_PROBE
11031103 if (pv == 1 ) {
11041104 SERIAL_ECHOLNPGM (" G29 P1 requires a probe.\n " );
@@ -1181,7 +1181,7 @@ bool unified_bed_leveling::G29_parse_parameters() {
11811181 }
11821182 #endif
11831183
1184- param.T_map_type = parser.intval (' T' );
1184+ param.T_map_type = parser.byteval (' T' );
11851185 if (!WITHIN (param.T_map_type , 0 , 2 )) {
11861186 SERIAL_ECHOLNPGM (" Invalid map type.\n " );
11871187 return UBL_ERR;
@@ -1833,7 +1833,7 @@ void unified_bed_leveling::smart_fill_mesh() {
18331833 return ;
18341834 }
18351835
1836- param.KLS_storage_slot = parser.value_int ();
1836+ param.KLS_storage_slot = ( int8_t ) parser.value_int ();
18371837
18381838 float tmp_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
18391839 settings.load_mesh (param.KLS_storage_slot , &tmp_z_values);
0 commit comments