Browse Source

Merge pull request #8 from gudnimg/remove-unused-var-gudni

Remove unused variables
Shrink integer types where possible
Alex Voinea 2 năm trước cách đây
mục cha
commit
0f5312f927

+ 0 - 1
Firmware/Marlin.h

@@ -354,7 +354,6 @@ extern unsigned long start_pause_print;
 extern unsigned long t_fan_rising_edge;
 
 extern bool mesh_bed_leveling_flag;
-extern bool mesh_bed_run_from_menu;
 
 extern int8_t lcd_change_fil_state;
 // save/restore printing

+ 2 - 4
Firmware/Marlin_main.cpp

@@ -208,7 +208,6 @@ static ShortTimer crashDetTimer;
 //unsigned long load_filament_time;
 
 bool mesh_bed_leveling_flag = false;
-bool mesh_bed_run_from_menu = false;
 
 #ifdef PRUSA_M28
 bool prusa_sd_card_upload = false;
@@ -3448,7 +3447,6 @@ static void gcode_G80()
     lcd_setstatuspgm(_T(WELCOME_MSG));
     custom_message_type = custom_message_type_old;
     custom_message_state = custom_message_state_old;
-    mesh_bed_run_from_menu = false;
     lcd_update(2);
 
     st_synchronize();
@@ -5625,7 +5623,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
                 SERIAL_PROTOCOLPGM("\nZ search height: ");
                 SERIAL_PROTOCOL(MESH_HOME_Z_SEARCH);
                 SERIAL_PROTOCOLLNPGM("\nMeasured points:");
-                for (uint8_t y = MESH_NUM_Y_POINTS-1; y >= 0; y--) {
+                for (uint8_t y = MESH_NUM_Y_POINTS; y-- > 0;) {
                     for (uint8_t x = 0; x < MESH_NUM_X_POINTS; x++) {
                         SERIAL_PROTOCOLPGM("  ");
                         SERIAL_PROTOCOL_F(mbl.z_values[y][x], 5);
@@ -11132,7 +11130,7 @@ void uvlo_()
     eeprom_update_dword((uint32_t*)(EEPROM_FILE_POSITION), sd_position);
 
     // Store the mesh bed leveling offsets. This is 2*7*7=98 bytes, which takes 98*3.4us=333us in worst case.
-    for (int8_t mesh_point = 0; mesh_point < MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS; ++ mesh_point) {
+    for (uint8_t mesh_point = 0; mesh_point < MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS; ++ mesh_point) {
       uint8_t ix = mesh_point % MESH_NUM_X_POINTS; // from 0 to MESH_NUM_X_POINTS - 1
       uint8_t iy = mesh_point / MESH_NUM_X_POINTS;
       // Scale the z value to 1u resolution.

+ 3 - 3
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);

+ 1 - 6
Firmware/mesh_bed_leveling.h

@@ -24,12 +24,7 @@ public:
     static float get_x(int i) { return float(MESH_MIN_X) + float(MESH_X_DIST) * float(i); }
     static float get_y(int i) { return float(MESH_MIN_Y) + float(MESH_Y_DIST) * float(i); }
     
-    // Measurement point for the Z probe.
-    // If use_default=true, then the default positions for a correctly built printer are used.
-    // 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;

+ 0 - 1
Firmware/ultralcd.cpp

@@ -4493,7 +4493,6 @@ static void lcd_language_menu()
 
 void lcd_mesh_bedleveling()
 {
-	mesh_bed_run_from_menu = true;
 	enquecommand_P(PSTR("G80"));
 	lcd_return_to_status();
 }