Make MBL a static class, use lookup for index-to-point conversion

This commit is contained in:
Scott Lahteine
2017-03-31 01:28:07 -05:00
parent de9d2cddc3
commit c9eb1d6ab7
4 changed files with 52 additions and 47 deletions

View File

@@ -652,7 +652,7 @@ static bool send_ok[BUFSIZE];
#endif
#if ENABLED(HOST_KEEPALIVE_FEATURE)
static MarlinBusyState busy_state = NOT_BUSY;
MarlinBusyState busy_state = NOT_BUSY;
static millis_t next_busy_signal_ms = 0;
uint8_t host_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL;
#else
@@ -3839,7 +3839,7 @@ inline void gcode_G28() {
// If there's another point to sample, move there with optional lift.
if (probe_index < (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
mbl.zigzag(probe_index, px, py);
_mbl_goto_xy(mbl.get_probe_x(px), mbl.get_probe_y(py));
_mbl_goto_xy(mbl.index_to_xpos[px], mbl.index_to_ypos[py]);
#if HAS_SOFTWARE_ENDSTOPS
// Disable software endstops to allow manual adjustment
@@ -9649,14 +9649,14 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
const int8_t gcx = max(cx1, cx2), gcy = max(cy1, cy2);
if (cx2 != cx1 && TEST(x_splits, gcx)) {
COPY(end, destination);
destination[X_AXIS] = LOGICAL_X_POSITION(mbl.get_probe_x(gcx));
destination[X_AXIS] = LOGICAL_X_POSITION(mbl.index_to_xpos[gcx]);
normalized_dist = (destination[X_AXIS] - current_position[X_AXIS]) / (end[X_AXIS] - current_position[X_AXIS]);
destination[Y_AXIS] = MBL_SEGMENT_END(Y);
CBI(x_splits, gcx);
}
else if (cy2 != cy1 && TEST(y_splits, gcy)) {
COPY(end, destination);
destination[Y_AXIS] = LOGICAL_Y_POSITION(mbl.get_probe_y(gcy));
destination[Y_AXIS] = LOGICAL_Y_POSITION(mbl.index_to_ypos[gcy]);
normalized_dist = (destination[Y_AXIS] - current_position[Y_AXIS]) / (end[Y_AXIS] - current_position[Y_AXIS]);
destination[X_AXIS] = MBL_SEGMENT_END(X);
CBI(y_splits, gcy);