Skip to content

Commit

Permalink
🐛 Fix UBL probe_entire_mesh skips points (MarlinFirmware#26141)
Browse files Browse the repository at this point in the history
  • Loading branch information
mriscoc authored and Pragma8123 committed Oct 24, 2023
1 parent 45a0a0e commit c1a235d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,14 +786,18 @@ void unified_bed_leveling::shift_mesh_height() {
}
#endif

best = do_furthest
#ifndef HUGE_VALF
#define HUGE_VALF (10e100F)
#endif

best = do_furthest // Points with valid data or HUGE_VALF are skipped
? find_furthest_invalid_mesh_point()
: find_closest_mesh_point_of_type(INVALID, nearby, true);

if (best.pos.x >= 0) { // mesh point found and is reachable by probe
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(best.pos, ExtUI::G29_POINT_START));
const float measured_z = probe.probe_at_point(best.meshpos(), stow_probe ? PROBE_PT_STOW : PROBE_PT_RAISE, param.V_verbosity);
z_values[best.pos.x][best.pos.y] = measured_z;
z_values[best.pos.x][best.pos.y] = isnan(measured_z) ? HUGE_VALF : measured_z; // Mark invalid point already probed with HUGE_VALF to omit it in the next loop
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onMeshUpdate(best.pos, ExtUI::G29_POINT_FINISH);
ExtUI::onMeshUpdate(best.pos, measured_z);
Expand All @@ -803,6 +807,8 @@ void unified_bed_leveling::shift_mesh_height() {

} while (best.pos.x >= 0 && --count);

GRID_LOOP(x, y) if (z_values[x][y] == HUGE_VALF) z_values[x][y] = NAN; // Restore NAN for HUGE_VALF marks

TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(best.pos, ExtUI::G29_FINISH));

// Release UI during stow to allow for PAUSE_BEFORE_DEPLOY_STOW
Expand Down

0 comments on commit c1a235d

Please sign in to comment.