Float ABL mesh boundaries, no probe position rounding (#16018)

2.0.x
Jason Smith 5 years ago committed by Scott Lahteine
parent ce9a4afe95
commit 752a1e76ab

@ -35,7 +35,7 @@
#include "../../../lcd/extensible_ui/ui_api.h" #include "../../../lcd/extensible_ui/ui_api.h"
#endif #endif
xy_int_t bilinear_grid_spacing, bilinear_start; xy_pos_t bilinear_grid_spacing, bilinear_start;
xy_float_t bilinear_grid_factor; xy_float_t bilinear_grid_factor;
bed_mesh_t z_values; bed_mesh_t z_values;
@ -153,7 +153,7 @@ void print_bilinear_leveling_grid() {
#define ABL_TEMP_POINTS_X (GRID_MAX_POINTS_X + 2) #define ABL_TEMP_POINTS_X (GRID_MAX_POINTS_X + 2)
#define ABL_TEMP_POINTS_Y (GRID_MAX_POINTS_Y + 2) #define ABL_TEMP_POINTS_Y (GRID_MAX_POINTS_Y + 2)
float z_values_virt[ABL_GRID_POINTS_VIRT_X][ABL_GRID_POINTS_VIRT_Y]; float z_values_virt[ABL_GRID_POINTS_VIRT_X][ABL_GRID_POINTS_VIRT_Y];
xy_int_t bilinear_grid_spacing_virt; xy_pos_t bilinear_grid_spacing_virt;
xy_float_t bilinear_grid_factor_virt; xy_float_t bilinear_grid_factor_virt;
void print_bilinear_leveling_grid_virt() { void print_bilinear_leveling_grid_virt() {

@ -23,7 +23,7 @@
#include "../../../inc/MarlinConfigPre.h" #include "../../../inc/MarlinConfigPre.h"
extern xy_int_t bilinear_grid_spacing, bilinear_start; extern xy_pos_t bilinear_grid_spacing, bilinear_start;
extern xy_float_t bilinear_grid_factor; extern xy_float_t bilinear_grid_factor;
extern bed_mesh_t z_values; extern bed_mesh_t z_values;
float bilinear_z_offset(const xy_pos_t &raw); float bilinear_z_offset(const xy_pos_t &raw);

@ -465,7 +465,7 @@ G29_TYPE GcodeSuite::G29() {
reset_bed_level(); reset_bed_level();
// Initialize a grid with the given dimensions // Initialize a grid with the given dimensions
bilinear_grid_spacing = gridSpacing.asInt(); bilinear_grid_spacing = gridSpacing;
bilinear_start = probe_position_lf; bilinear_start = probe_position_lf;
// Can't re-enable (on error) until the new grid is written // Can't re-enable (on error) until the new grid is written
@ -583,10 +583,7 @@ G29_TYPE GcodeSuite::G29() {
if (zig) PR_INNER_VAR = (PR_INNER_END - 1) - PR_INNER_VAR; if (zig) PR_INNER_VAR = (PR_INNER_END - 1) - PR_INNER_VAR;
const xy_pos_t base = probe_position_lf.asFloat() + gridSpacing * meshCount.asFloat(); probePos = probe_position_lf + gridSpacing * meshCount.asFloat();
probePos.set(FLOOR(base.x + (base.x < 0 ? 0 : 0.5)),
FLOOR(base.y + (base.y < 0 ? 0 : 0.5)));
#if ENABLED(AUTO_BED_LEVELING_LINEAR) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
indexIntoAB[meshCount.x][meshCount.y] = abl_probe_index; indexIntoAB[meshCount.x][meshCount.y] = abl_probe_index;
@ -694,10 +691,7 @@ G29_TYPE GcodeSuite::G29() {
// Inner loop is X with PROBE_Y_FIRST disabled // Inner loop is X with PROBE_Y_FIRST disabled
for (PR_INNER_VAR = inStart; PR_INNER_VAR != inStop; pt_index++, PR_INNER_VAR += inInc) { for (PR_INNER_VAR = inStart; PR_INNER_VAR != inStop; pt_index++, PR_INNER_VAR += inInc) {
const xy_pos_t base = probe_position_lf.asFloat() + gridSpacing * meshCount.asFloat(); probePos = probe_position_lf + gridSpacing * meshCount.asFloat();
probePos.set(FLOOR(base.x + (base.x < 0 ? 0 : 0.5)),
FLOOR(base.y + (base.y < 0 ? 0 : 0.5)));
#if ENABLED(AUTO_BED_LEVELING_LINEAR) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
indexIntoAB[meshCount.x][meshCount.y] = ++abl_probe_index; // 0... indexIntoAB[meshCount.x][meshCount.y] = ++abl_probe_index; // 0...

@ -37,7 +37,7 @@
*/ */
// Change EEPROM version if the structure changes // Change EEPROM version if the structure changes
#define EEPROM_VERSION "V73" #define EEPROM_VERSION "V74"
#define EEPROM_OFFSET 100 #define EEPROM_OFFSET 100
// Check the integrity of data offsets. // Check the integrity of data offsets.
@ -192,7 +192,7 @@ typedef struct SettingsDataStruct {
// AUTO_BED_LEVELING_BILINEAR // AUTO_BED_LEVELING_BILINEAR
// //
uint8_t grid_max_x, grid_max_y; // GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y uint8_t grid_max_x, grid_max_y; // GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y
xy_int_t bilinear_grid_spacing, bilinear_start; // G29 L F xy_pos_t bilinear_grid_spacing, bilinear_start; // G29 L F
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
bed_mesh_t z_values; // G29 bed_mesh_t z_values; // G29
#else #else
@ -658,7 +658,7 @@ void MarlinSettings::postprocess() {
#else #else
// For disabled Bilinear Grid write an empty 3x3 grid // For disabled Bilinear Grid write an empty 3x3 grid
const uint8_t grid_max_x = 3, grid_max_y = 3; const uint8_t grid_max_x = 3, grid_max_y = 3;
const xy_int_t bilinear_start{0}, bilinear_grid_spacing{0}; const xy_pos_t bilinear_start{0}, bilinear_grid_spacing{0};
dummy = 0; dummy = 0;
EEPROM_WRITE(grid_max_x); EEPROM_WRITE(grid_max_x);
EEPROM_WRITE(grid_max_y); EEPROM_WRITE(grid_max_y);
@ -1469,7 +1469,7 @@ void MarlinSettings::postprocess() {
#endif // AUTO_BED_LEVELING_BILINEAR #endif // AUTO_BED_LEVELING_BILINEAR
{ {
// Skip past disabled (or stale) Bilinear Grid data // Skip past disabled (or stale) Bilinear Grid data
xy_int_t bgs, bs; xy_pos_t bgs, bs;
EEPROM_READ(bgs); EEPROM_READ(bgs);
EEPROM_READ(bs); EEPROM_READ(bs);
for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_READ(dummy); for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_READ(dummy);

@ -359,7 +359,6 @@ void homeaxis(const AxisEnum axis);
#if !HAS_BED_PROBE #if !HAS_BED_PROBE
FORCE_INLINE bool position_is_reachable_by_probe(const float &rx, const float &ry) { return position_is_reachable(rx, ry); } FORCE_INLINE bool position_is_reachable_by_probe(const float &rx, const float &ry) { return position_is_reachable(rx, ry); }
#endif #endif
FORCE_INLINE bool position_is_reachable_by_probe(const xy_int_t &pos) { return position_is_reachable_by_probe(pos.x, pos.y); }
FORCE_INLINE bool position_is_reachable_by_probe(const xy_pos_t &pos) { return position_is_reachable_by_probe(pos.x, pos.y); } FORCE_INLINE bool position_is_reachable_by_probe(const xy_pos_t &pos) { return position_is_reachable_by_probe(pos.x, pos.y); }
/** /**

Loading…
Cancel
Save