|
@@ -36,50 +36,50 @@
|
36
|
36
|
|
37
|
37
|
void reset();
|
38
|
38
|
|
39
|
|
- static FORCE_INLINE float get_probe_x(int8_t i) { return MESH_MIN_X + (MESH_X_DIST) * i; }
|
40
|
|
- static FORCE_INLINE float get_probe_y(int8_t i) { return MESH_MIN_Y + (MESH_Y_DIST) * i; }
|
41
|
|
- void set_z(const int8_t px, const int8_t py, const float z) { z_values[py][px] = z; }
|
|
39
|
+ static FORCE_INLINE float get_probe_x(const int8_t i) { return MESH_MIN_X + (MESH_X_DIST) * i; }
|
|
40
|
+ static FORCE_INLINE float get_probe_y(const int8_t i) { return MESH_MIN_Y + (MESH_Y_DIST) * i; }
|
|
41
|
+ void set_z(const int8_t px, const int8_t py, const float &z) { z_values[py][px] = z; }
|
42
|
42
|
|
43
|
|
- bool active() { return TEST(status, MBL_STATUS_ACTIVE_BIT); }
|
44
|
|
- void set_active(bool onOff) { if (onOff) SBI(status, MBL_STATUS_ACTIVE_BIT); else CBI(status, MBL_STATUS_ACTIVE_BIT); }
|
45
|
|
- bool has_mesh() { return TEST(status, MBL_STATUS_HAS_MESH_BIT); }
|
46
|
|
- void set_has_mesh(bool onOff) { if (onOff) SBI(status, MBL_STATUS_HAS_MESH_BIT); else CBI(status, MBL_STATUS_HAS_MESH_BIT); }
|
|
43
|
+ bool active() const { return TEST(status, MBL_STATUS_ACTIVE_BIT); }
|
|
44
|
+ void set_active(const bool onOff) { onOff ? SBI(status, MBL_STATUS_ACTIVE_BIT) : CBI(status, MBL_STATUS_ACTIVE_BIT); }
|
|
45
|
+ bool has_mesh() const { return TEST(status, MBL_STATUS_HAS_MESH_BIT); }
|
|
46
|
+ void set_has_mesh(const bool onOff) { onOff ? SBI(status, MBL_STATUS_HAS_MESH_BIT) : CBI(status, MBL_STATUS_HAS_MESH_BIT); }
|
47
|
47
|
|
48
|
|
- inline void zigzag(int8_t index, int8_t &px, int8_t &py) {
|
|
48
|
+ inline void zigzag(const int8_t index, int8_t &px, int8_t &py) const {
|
49
|
49
|
px = index % (MESH_NUM_X_POINTS);
|
50
|
50
|
py = index / (MESH_NUM_X_POINTS);
|
51
|
51
|
if (py & 1) px = (MESH_NUM_X_POINTS - 1) - px; // Zig zag
|
52
|
52
|
}
|
53
|
53
|
|
54
|
|
- void set_zigzag_z(int8_t index, float z) {
|
|
54
|
+ void set_zigzag_z(const int8_t index, const float &z) {
|
55
|
55
|
int8_t px, py;
|
56
|
56
|
zigzag(index, px, py);
|
57
|
57
|
set_z(px, py, z);
|
58
|
58
|
}
|
59
|
59
|
|
60
|
|
- int8_t cell_index_x(float x) {
|
|
60
|
+ int8_t cell_index_x(const float &x) const {
|
61
|
61
|
int8_t cx = (x - (MESH_MIN_X)) * (1.0 / (MESH_X_DIST));
|
62
|
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(const float &y) const {
|
66
|
66
|
int8_t cy = (y - (MESH_MIN_Y)) * (1.0 / (MESH_Y_DIST));
|
67
|
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(const float &x) const {
|
71
|
71
|
int8_t px = (x - (MESH_MIN_X) + (MESH_X_DIST) * 0.5) * (1.0 / (MESH_X_DIST));
|
72
|
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(const float &y) const {
|
76
|
76
|
int8_t py = (y - (MESH_MIN_Y) + (MESH_Y_DIST) * 0.5) * (1.0 / (MESH_Y_DIST));
|
77
|
77
|
return (py >= 0 && py < (MESH_NUM_Y_POINTS)) ? py : -1;
|
78
|
78
|
}
|
79
|
79
|
|
80
|
|
- float calc_z0(float a0, float a1, float z1, float a2, float z2) {
|
81
|
|
- float delta_z = (z2 - z1) / (a2 - a1);
|
82
|
|
- float delta_a = a0 - a1;
|
|
80
|
+ float calc_z0(const float &a0, const float &a1, const float &z1, const float &a2, const float &z2) const {
|
|
81
|
+ const float delta_z = (z2 - z1) / (a2 - a1);
|
|
82
|
+ const float delta_a = a0 - a1;
|
83
|
83
|
return z1 + delta_a * delta_z;
|
84
|
84
|
}
|
85
|
85
|
|