Merge pull request #6568 from thinkyhead/rc_bilinear_extension

Add EXTRAPOLATE_BEYOND_GRID option to bilinear leveling
This commit is contained in:
Scott Lahteine 2017-05-04 00:46:05 -05:00 committed by GitHub
commit 58210c3a19
25 changed files with 118 additions and 4 deletions

View File

@ -825,6 +825,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -10585,12 +10585,25 @@ void ok_to_send() {
const float x = RAW_X_POSITION(logical[X_AXIS]) - bilinear_start[X_AXIS], const float x = RAW_X_POSITION(logical[X_AXIS]) - bilinear_start[X_AXIS],
y = RAW_Y_POSITION(logical[Y_AXIS]) - bilinear_start[Y_AXIS]; y = RAW_Y_POSITION(logical[Y_AXIS]) - bilinear_start[Y_AXIS];
#if ENABLED(EXTRAPOLATE_BEYOND_GRID)
// Keep using the last grid box
#define FAR_EDGE_OR_BOX 2
#else
// Just use the grid far edge
#define FAR_EDGE_OR_BOX 1
#endif
if (last_x != x) { if (last_x != x) {
last_x = x; last_x = x;
ratio_x = x * ABL_BG_FACTOR(X_AXIS); ratio_x = x * ABL_BG_FACTOR(X_AXIS);
const float gx = constrain(floor(ratio_x), 0, ABL_BG_POINTS_X - 1); const float gx = constrain(floor(ratio_x), 0, ABL_BG_POINTS_X - FAR_EDGE_OR_BOX);
ratio_x -= gx; // Subtract whole to get the ratio within the grid box ratio_x -= gx; // Subtract whole to get the ratio within the grid box
#if DISABLED(EXTRAPOLATE_BEYOND_GRID)
// Beyond the grid maintain height at grid edges
NOLESS(ratio_x, 0); // Never < 0.0. (> 1.0 is ok when nextx==gridx.) NOLESS(ratio_x, 0); // Never < 0.0. (> 1.0 is ok when nextx==gridx.)
#endif
gridx = gx; gridx = gx;
nextx = min(gridx + 1, ABL_BG_POINTS_X - 1); nextx = min(gridx + 1, ABL_BG_POINTS_X - 1);
} }
@ -10600,9 +10613,14 @@ void ok_to_send() {
if (last_y != y) { if (last_y != y) {
last_y = y; last_y = y;
ratio_y = y * ABL_BG_FACTOR(Y_AXIS); ratio_y = y * ABL_BG_FACTOR(Y_AXIS);
const float gy = constrain(floor(ratio_y), 0, ABL_BG_POINTS_Y - 1); const float gy = constrain(floor(ratio_y), 0, ABL_BG_POINTS_Y - FAR_EDGE_OR_BOX);
ratio_y -= gy; ratio_y -= gy;
NOLESS(ratio_y, 0);
#if DISABLED(EXTRAPOLATE_BEYOND_GRID)
// Beyond the grid maintain height at grid edges
NOLESS(ratio_y, 0); // Never < 0.0. (> 1.0 is ok when nexty==gridy.)
#endif
gridy = gy; gridy = gy;
nexty = min(gridy + 1, ABL_BG_POINTS_Y - 1); nexty = min(gridy + 1, ABL_BG_POINTS_Y - 1);
} }

View File

@ -823,6 +823,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -807,6 +807,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -807,6 +807,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -827,6 +827,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -815,6 +815,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -818,6 +818,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -853,6 +853,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -824,6 +824,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -824,6 +824,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -824,6 +824,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -823,6 +823,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -839,6 +839,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -844,6 +844,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -880,6 +880,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -815,6 +815,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -824,6 +824,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -943,6 +943,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -935,6 +935,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -941,6 +941,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -809,6 +809,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -827,6 +827,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -820,6 +820,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.

View File

@ -829,6 +829,10 @@
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
//#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.