Refactor Hilbert curve. Enhance Touch UI Bed Level Screen. (#21453)

This commit is contained in:
Marcio T
2021-03-27 21:57:12 -06:00
committed by GitHub
parent 5d0e6c21aa
commit c45b91aa94
13 changed files with 341 additions and 144 deletions

View File

@@ -849,10 +849,13 @@ namespace ExtUI {
}
#if HAS_LEVELING
bool getLevelingActive() { return planner.leveling_active; }
void setLevelingActive(const bool state) { set_bed_leveling_enabled(state); }
bool getMeshValid() { return leveling_is_valid(); }
#if HAS_MESH
bed_mesh_t& getMeshArray() { return Z_VALUES_ARR; }
float getMeshPoint(const xy_uint8_t &pos) { return Z_VALUES(pos.x, pos.y); }
void setMeshPoint(const xy_uint8_t &pos, const float &zoff) {
@@ -861,17 +864,23 @@ namespace ExtUI {
TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate());
}
}
void moveToMeshPoint(const xy_uint8_t &pos, const float &z) {
#if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL)
const feedRate_t old_feedrate = feedrate_mm_s;
feedrate_mm_s = Z_PROBE_FEEDRATE_FAST;
destination = current_position;
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
prepare_line_to_destination();
feedrate_mm_s = XY_PROBE_FEEDRATE;
destination[X_AXIS] = MESH_MIN_X + pos.x * MESH_X_DIST;
destination[Y_AXIS] = MESH_MIN_Y + pos.y * MESH_Y_DIST;
prepare_line_to_destination();
const float x_target = MESH_MIN_X + pos.x * (MESH_X_DIST),
y_target = MESH_MIN_Y + pos.y * (MESH_Y_DIST);
if (x_target != current_position[X_AXIS] || y_target != current_position[Y_AXIS]) {
// If moving across bed, raise nozzle to safe height over bed
feedrate_mm_s = Z_PROBE_FEEDRATE_FAST;
destination = current_position;
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
prepare_line_to_destination();
feedrate_mm_s = XY_PROBE_FEEDRATE;
destination[X_AXIS] = x_target;
destination[Y_AXIS] = y_target;
prepare_line_to_destination();
}
feedrate_mm_s = Z_PROBE_FEEDRATE_FAST;
destination[Z_AXIS] = z;
prepare_line_to_destination();
@@ -881,8 +890,10 @@ namespace ExtUI {
UNUSED(z);
#endif
}
#endif
#endif
#endif // HAS_MESH
#endif // HAS_LEVELING
#if ENABLED(HOST_PROMPT_SUPPORT)
void setHostResponse(const uint8_t response) { host_response_handler(response); }