Browse Source

Remove premature cast to int

Scott Lahteine 8 years ago
parent
commit
dce6026e0e
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      Marlin/mesh_bed_leveling.h

+ 4
- 4
Marlin/mesh_bed_leveling.h View File

58
     }
58
     }
59
 
59
 
60
     int8_t cell_index_x(float x) {
60
     int8_t cell_index_x(float x) {
61
-      int8_t cx = int(x - (MESH_MIN_X)) / (MESH_X_DIST);
61
+      int8_t cx = (x - (MESH_MIN_X)) / (MESH_X_DIST);
62
       return constrain(cx, 0, (MESH_NUM_X_POINTS) - 2);
62
       return constrain(cx, 0, (MESH_NUM_X_POINTS) - 2);
63
     }
63
     }
64
 
64
 
65
     int8_t cell_index_y(float y) {
65
     int8_t cell_index_y(float y) {
66
-      int8_t cy = int(y - (MESH_MIN_Y)) / (MESH_Y_DIST);
66
+      int8_t cy = (y - (MESH_MIN_Y)) / (MESH_Y_DIST);
67
       return constrain(cy, 0, (MESH_NUM_Y_POINTS) - 2);
67
       return constrain(cy, 0, (MESH_NUM_Y_POINTS) - 2);
68
     }
68
     }
69
 
69
 
70
     int8_t probe_index_x(float x) {
70
     int8_t probe_index_x(float x) {
71
-      int8_t px = int(x - (MESH_MIN_X) + (MESH_X_DIST) / 2) / (MESH_X_DIST);
71
+      int8_t px = (x - (MESH_MIN_X) + (MESH_X_DIST) * 0.5) / (MESH_X_DIST);
72
       return (px >= 0 && px < (MESH_NUM_X_POINTS)) ? px : -1;
72
       return (px >= 0 && px < (MESH_NUM_X_POINTS)) ? px : -1;
73
     }
73
     }
74
 
74
 
75
     int8_t probe_index_y(float y) {
75
     int8_t probe_index_y(float y) {
76
-      int8_t py = int(y - (MESH_MIN_Y) + (MESH_Y_DIST) / 2) / (MESH_Y_DIST);
76
+      int8_t py = (y - (MESH_MIN_Y) + (MESH_Y_DIST) * 0.5) / (MESH_Y_DIST);
77
       return (py >= 0 && py < (MESH_NUM_Y_POINTS)) ? py : -1;
77
       return (py >= 0 && py < (MESH_NUM_Y_POINTS)) ? py : -1;
78
     }
78
     }
79
 
79
 

Loading…
Cancel
Save