Apply Marlin coding standards to MBL class

This commit is contained in:
Scott Lahteine
2016-06-03 21:31:38 -07:00
parent c06de0f097
commit c2362c1b3c
6 changed files with 28 additions and 26 deletions

View File

@ -24,12 +24,14 @@
#if ENABLED(MESH_BED_LEVELING)
enum MBLStatus { MBL_STATUS_NONE = 0, MBL_STATUS_HAS_MESH_BIT = 0, MBL_STATUS_ACTIVE_BIT = 1 };
#define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X))/(MESH_NUM_X_POINTS - 1))
#define MESH_Y_DIST ((MESH_MAX_Y - (MESH_MIN_Y))/(MESH_NUM_Y_POINTS - 1))
class mesh_bed_leveling {
public:
uint8_t status; // Bit 0 = has mesh numbers, Bit 1 = compensation active
uint8_t status; // Has Mesh and Is Active bits
float z_offset;
float z_values[MESH_NUM_Y_POINTS][MESH_NUM_X_POINTS];
@ -41,10 +43,10 @@
static FORCE_INLINE float get_probe_y(int8_t i) { return MESH_MIN_Y + (MESH_Y_DIST) * i; }
void set_z(const int8_t px, const int8_t py, const float z) { z_values[py][px] = z; }
bool has_mesh() { return TEST(status, 0); }
void has_mesh(bool onOff) { if (onOff) SBI(status, 0); else CBI(status, 0); }
bool is_active() { return TEST(status, 1); }
void is_active(bool onOff) { if (onOff) SBI(status, 1); else CBI(status, 1); }
bool active() { return TEST(status, MBL_STATUS_ACTIVE_BIT); }
void set_active(bool onOff) { if (onOff) SBI(status, MBL_STATUS_ACTIVE_BIT); else CBI(status, MBL_STATUS_ACTIVE_BIT); }
bool has_mesh() { return TEST(status, MBL_STATUS_HAS_MESH_BIT); }
void set_has_mesh(bool onOff) { if (onOff) SBI(status, MBL_STATUS_HAS_MESH_BIT); else CBI(status, MBL_STATUS_HAS_MESH_BIT); }
inline void zigzag(int8_t index, int8_t &px, int8_t &py) {
px = index % (MESH_NUM_X_POINTS);