From c705d4aa106e1eefd87b36fc45947b0df8fc7618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sat, 29 Jan 2022 14:58:39 +0000 Subject: [PATCH] Change set_z() parameters to uin8_t Saves 24 bytes of flash --- Firmware/mesh_bed_calibration.cpp | 6 +++--- Firmware/mesh_bed_leveling.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 23d7c873..892415e5 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -2872,14 +2872,14 @@ bool sample_mesh_and_store_reference() } mbl.set_z(0, 0, current_position[Z_AXIS]); } - for (int8_t mesh_point = 1; mesh_point != MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS; ++ mesh_point) { + for (uint8_t mesh_point = 1; mesh_point != MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS; ++ mesh_point) { // Don't let the manage_inactivity() function remove power from the motors. refresh_cmd_timeout(); // Print the decrasing ID of the measurement point. current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; go_to_current(homing_feedrate[Z_AXIS]/60); - int8_t ix = mesh_point % MESH_MEAS_NUM_X_POINTS; - int8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS; + uint8_t ix = mesh_point % MESH_MEAS_NUM_X_POINTS; + uint8_t iy = mesh_point / MESH_MEAS_NUM_X_POINTS; if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix; // Zig zag current_position[X_AXIS] = BED_X(ix, MESH_MEAS_NUM_X_POINTS); current_position[Y_AXIS] = BED_Y(iy, MESH_MEAS_NUM_Y_POINTS); diff --git a/Firmware/mesh_bed_leveling.h b/Firmware/mesh_bed_leveling.h index bf372955..37d9ade7 100644 --- a/Firmware/mesh_bed_leveling.h +++ b/Firmware/mesh_bed_leveling.h @@ -29,7 +29,7 @@ public: // Otherwise a correction matrix is pulled from the EEPROM if available. static void get_meas_xy(int ix, int iy, float &x, float &y, bool use_default); - void set_z(int ix, int iy, float z) { z_values[iy][ix] = z; } + void set_z(uint8_t ix, uint8_t iy, float z) { z_values[iy][ix] = z; } int select_x_index(float x) { int i = 1;