parent
aba0450615
commit
a15f536ff4
|
|
@ -2832,10 +2832,10 @@ static void gcode_G80()
|
|||
nProbeRetry = 10;
|
||||
}
|
||||
|
||||
const float area_min_x = code_seen('X') ? code_value() - MESH_X_DIST - X_PROBE_OFFSET_FROM_EXTRUDER : -INFINITY;
|
||||
const float area_min_y = code_seen('Y') ? code_value() - MESH_Y_DIST - Y_PROBE_OFFSET_FROM_EXTRUDER : -INFINITY;
|
||||
const float area_max_x = code_seen('W') ? area_min_x + code_value() + 2 * MESH_X_DIST : INFINITY;
|
||||
const float area_max_y = code_seen('H') ? area_min_y + code_value() + 2 * MESH_Y_DIST : INFINITY;
|
||||
const float area_min_x = code_seen('X') ? code_value() - x_mesh_density - X_PROBE_OFFSET_FROM_EXTRUDER : -INFINITY;
|
||||
const float area_min_y = code_seen('Y') ? code_value() - y_mesh_density - Y_PROBE_OFFSET_FROM_EXTRUDER : -INFINITY;
|
||||
const float area_max_x = code_seen('W') ? area_min_x + code_value() + 2 * x_mesh_density : INFINITY;
|
||||
const float area_max_y = code_seen('H') ? area_min_y + code_value() + 2 * y_mesh_density : INFINITY;
|
||||
|
||||
mbl.reset(); //reset mesh bed leveling
|
||||
mbl.z_values[0][0] = min_pos[Z_AXIS];
|
||||
|
|
|
|||
|
|
@ -2186,13 +2186,11 @@ inline void scan_bed_induction_sensor_point()
|
|||
|
||||
float __attribute__((noinline)) BED_X(const uint8_t col)
|
||||
{
|
||||
constexpr float x_mesh_density = (BED_Xn - BED_X0) / (MESH_NUM_X_POINTS - 1);
|
||||
return ((float)col * x_mesh_density + BED_X0);
|
||||
}
|
||||
|
||||
float __attribute__((noinline)) BED_Y(const uint8_t row)
|
||||
{
|
||||
constexpr float y_mesh_density = (BED_Yn - BED_Y0) / (MESH_NUM_Y_POINTS - 1);
|
||||
return ((float)row * y_mesh_density + BED_Y0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
#endif //not HEATBED_V2
|
||||
|
||||
constexpr float x_mesh_density = (BED_Xn - BED_X0) / (MESH_NUM_X_POINTS - 1);
|
||||
constexpr float y_mesh_density = (BED_Yn - BED_Y0) / (MESH_NUM_Y_POINTS - 1);
|
||||
|
||||
// Exact positions of the print head above the bed reference points, in the world coordinates.
|
||||
// The world coordinates match the machine coordinates only in case, when the machine
|
||||
// is built properly, the end stops are at the correct positions and the axes are perpendicular.
|
||||
|
|
|
|||
|
|
@ -15,26 +15,26 @@ float mesh_bed_leveling::get_z(float x, float y) {
|
|||
int i, j;
|
||||
float s, t;
|
||||
|
||||
i = int(floor((x - MESH_MIN_X) / MESH_X_DIST));
|
||||
i = int(floor((x - (BED_X0 + X_PROBE_OFFSET_FROM_EXTRUDER)) / x_mesh_density));
|
||||
if (i < 0) {
|
||||
i = 0;
|
||||
s = (x - MESH_MIN_X) / MESH_X_DIST;
|
||||
s = (x - (BED_X0 + X_PROBE_OFFSET_FROM_EXTRUDER)) / x_mesh_density;
|
||||
} else {
|
||||
if (i > MESH_NUM_X_POINTS - 2) {
|
||||
i = MESH_NUM_X_POINTS - 2;
|
||||
}
|
||||
s = (x - get_x(i)) / MESH_X_DIST;
|
||||
s = (x - get_x(i)) / x_mesh_density;
|
||||
}
|
||||
|
||||
j = int(floor((y - MESH_MIN_Y) / MESH_Y_DIST));
|
||||
j = int(floor((y - (BED_Y0 + Y_PROBE_OFFSET_FROM_EXTRUDER)) / y_mesh_density));
|
||||
if (j < 0) {
|
||||
j = 0;
|
||||
t = (y - MESH_MIN_Y) / MESH_Y_DIST;
|
||||
t = (y - (BED_Y0 + Y_PROBE_OFFSET_FROM_EXTRUDER)) / y_mesh_density;
|
||||
} else {
|
||||
if (j > MESH_NUM_Y_POINTS - 2) {
|
||||
j = MESH_NUM_Y_POINTS - 2;
|
||||
}
|
||||
t = (y - get_y(j)) / MESH_Y_DIST;
|
||||
t = (y - get_y(j)) / y_mesh_density;
|
||||
}
|
||||
|
||||
float si = 1.f-s;
|
||||
|
|
@ -51,9 +51,9 @@ void mesh_bed_leveling::upsample_3x3()
|
|||
int idx2 = MESH_NUM_X_POINTS - 1;
|
||||
{
|
||||
// First interpolate the points in X axis.
|
||||
static const float x0 = MESH_MIN_X;
|
||||
static const float x1 = 0.5f * float(MESH_MIN_X + MESH_MAX_X);
|
||||
static const float x2 = MESH_MAX_X;
|
||||
static const float x0 = (BED_X0 + X_PROBE_OFFSET_FROM_EXTRUDER);
|
||||
static const float x1 = 0.5f * float(BED_X0 + BED_Xn) + X_PROBE_OFFSET_FROM_EXTRUDER;
|
||||
static const float x2 = BED_Xn + X_PROBE_OFFSET_FROM_EXTRUDER;
|
||||
for (int j = 0; j < MESH_NUM_Y_POINTS; ++ j) {
|
||||
// Interpolate the remaining values by Largrangian polynomials.
|
||||
for (int i = 0; i < MESH_NUM_X_POINTS; ++ i) {
|
||||
|
|
@ -69,9 +69,9 @@ void mesh_bed_leveling::upsample_3x3()
|
|||
}
|
||||
{
|
||||
// Second interpolate the points in Y axis.
|
||||
static const float y0 = MESH_MIN_Y;
|
||||
static const float y1 = 0.5f * float(MESH_MIN_Y + MESH_MAX_Y);
|
||||
static const float y2 = MESH_MAX_Y;
|
||||
static const float y0 = (BED_Y0 + Y_PROBE_OFFSET_FROM_EXTRUDER);
|
||||
static const float y1 = 0.5f * float(BED_Y0 + BED_Yn) + Y_PROBE_OFFSET_FROM_EXTRUDER;
|
||||
static const float y2 = BED_Yn + Y_PROBE_OFFSET_FROM_EXTRUDER;
|
||||
for (int i = 0; i < MESH_NUM_X_POINTS; ++ i) {
|
||||
// Interpolate the remaining values by Largrangian polynomials.
|
||||
for (int j = 1; j + 1 < MESH_NUM_Y_POINTS; ++ j) {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
#include "Marlin.h"
|
||||
#include "mesh_bed_calibration.h"
|
||||
|
||||
#ifdef MESH_BED_LEVELING
|
||||
|
||||
#define MESH_X_DIST (float(MESH_MAX_X - MESH_MIN_X)/float(MESH_NUM_X_POINTS - 1))
|
||||
#define MESH_Y_DIST (float(MESH_MAX_Y - MESH_MIN_Y)/float(MESH_NUM_Y_POINTS - 1))
|
||||
|
||||
class mesh_bed_leveling {
|
||||
public:
|
||||
uint8_t active;
|
||||
|
|
@ -14,8 +12,8 @@ public:
|
|||
|
||||
void reset();
|
||||
|
||||
static float get_x(int i) { return float(MESH_MIN_X) + float(MESH_X_DIST) * float(i); }
|
||||
static float get_y(int i) { return float(MESH_MIN_Y) + float(MESH_Y_DIST) * float(i); }
|
||||
static float get_x(int i) { return BED_X(i) + X_PROBE_OFFSET_FROM_EXTRUDER; }
|
||||
static float get_y(int i) { return BED_Y(i) + Y_PROBE_OFFSET_FROM_EXTRUDER; }
|
||||
float get_z(float x, float y);
|
||||
void set_z(uint8_t ix, uint8_t iy, float z) { z_values[iy][ix] = z; }
|
||||
void upsample_3x3();
|
||||
|
|
|
|||
|
|
@ -273,12 +273,6 @@
|
|||
|
||||
#define MBL_Z_STEP 0.01
|
||||
|
||||
// Mesh definitions
|
||||
#define MESH_MIN_X 24
|
||||
#define MESH_MAX_X 228
|
||||
#define MESH_MIN_Y 6
|
||||
#define MESH_MAX_Y 210
|
||||
|
||||
// Mesh upsample definition
|
||||
#define MESH_NUM_X_POINTS 7
|
||||
#define MESH_NUM_Y_POINTS 7
|
||||
|
|
|
|||
|
|
@ -274,12 +274,6 @@
|
|||
|
||||
#define MBL_Z_STEP 0.01
|
||||
|
||||
// Mesh definitions
|
||||
#define MESH_MIN_X 24
|
||||
#define MESH_MAX_X 228
|
||||
#define MESH_MIN_Y 6
|
||||
#define MESH_MAX_Y 210
|
||||
|
||||
// Mesh upsample definition
|
||||
#define MESH_NUM_X_POINTS 7
|
||||
#define MESH_NUM_Y_POINTS 7
|
||||
|
|
|
|||
|
|
@ -273,12 +273,6 @@
|
|||
|
||||
#define MBL_Z_STEP 0.01
|
||||
|
||||
// Mesh definitions
|
||||
#define MESH_MIN_X 24
|
||||
#define MESH_MAX_X 228
|
||||
#define MESH_MIN_Y 6
|
||||
#define MESH_MAX_Y 210
|
||||
|
||||
// Mesh upsample definition
|
||||
#define MESH_NUM_X_POINTS 7
|
||||
#define MESH_NUM_Y_POINTS 7
|
||||
|
|
|
|||
|
|
@ -274,12 +274,6 @@
|
|||
|
||||
#define MBL_Z_STEP 0.01
|
||||
|
||||
// Mesh definitions
|
||||
#define MESH_MIN_X 24
|
||||
#define MESH_MAX_X 228
|
||||
#define MESH_MIN_Y 6
|
||||
#define MESH_MAX_Y 210
|
||||
|
||||
// Mesh upsample definition
|
||||
#define MESH_NUM_X_POINTS 7
|
||||
#define MESH_NUM_Y_POINTS 7
|
||||
|
|
|
|||
|
|
@ -423,12 +423,6 @@
|
|||
|
||||
#define MBL_Z_STEP 0.01
|
||||
|
||||
// Mesh definitions
|
||||
#define MESH_MIN_X 24
|
||||
#define MESH_MAX_X 228
|
||||
#define MESH_MIN_Y 6
|
||||
#define MESH_MAX_Y 210
|
||||
|
||||
// Mesh upsample definition
|
||||
#define MESH_NUM_X_POINTS 7
|
||||
#define MESH_NUM_Y_POINTS 7
|
||||
|
|
|
|||
|
|
@ -427,12 +427,6 @@
|
|||
|
||||
#define MBL_Z_STEP 0.01
|
||||
|
||||
// Mesh definitions
|
||||
#define MESH_MIN_X 24
|
||||
#define MESH_MAX_X 228
|
||||
#define MESH_MIN_Y 6
|
||||
#define MESH_MAX_Y 210
|
||||
|
||||
// Mesh upsample definition
|
||||
#define MESH_NUM_X_POINTS 7
|
||||
#define MESH_NUM_Y_POINTS 7
|
||||
|
|
|
|||
|
|
@ -202,12 +202,6 @@ BED SETTINGS
|
|||
|
||||
#define MBL_Z_STEP 0.01
|
||||
|
||||
// Mesh definitions
|
||||
#define MESH_MIN_X 35
|
||||
#define MESH_MAX_X 238
|
||||
#define MESH_MIN_Y 6
|
||||
#define MESH_MAX_Y 202
|
||||
|
||||
// Mesh upsample definition
|
||||
#define MESH_NUM_X_POINTS 7
|
||||
#define MESH_NUM_Y_POINTS 7
|
||||
|
|
|
|||
|
|
@ -201,12 +201,6 @@ BED SETTINGS
|
|||
|
||||
#define MBL_Z_STEP 0.01
|
||||
|
||||
// Mesh definitions
|
||||
#define MESH_MIN_X 35
|
||||
#define MESH_MAX_X 238
|
||||
#define MESH_MIN_Y 6
|
||||
#define MESH_MAX_Y 202
|
||||
|
||||
// Mesh upsample definition
|
||||
#define MESH_NUM_X_POINTS 7
|
||||
#define MESH_NUM_Y_POINTS 7
|
||||
|
|
|
|||
Loading…
Reference in New Issue