measurements points moved 10mm to the left; measure only chosen points (e.g. not points affected by magnets proximity)

This commit is contained in:
PavelSindler 2019-03-05 20:40:08 +01:00
parent 17f095b957
commit d9e93e8a77
3 changed files with 35 additions and 3 deletions

View file

@ -4467,6 +4467,12 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
// Get coords of a measuring point.
uint8_t ix = mesh_point % nMeasPoints; // from 0 to MESH_NUM_X_POINTS - 1
uint8_t iy = mesh_point / nMeasPoints;
if (!mbl_point_measurement_valid(ix, iy, nMeasPoints)) {
printf_P(PSTR("Skipping point [%d;%d] \n"), ix, iy);
custom_message_state--;
mesh_point++;
continue; //skip
}
if (iy & 1) ix = (nMeasPoints - 1) - ix; // Zig zag
float z0 = 0.f;
if (has_z && (mesh_point > 0)) {
@ -4686,7 +4692,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
}
// SERIAL_ECHOLNPGM("Bed leveling correction finished");
if (nMeasPoints == 3) {
mbl.upsample_3x3(); //bilinear interpolation from 3x3 to 7x7 points while using the same array z_values[iy][ix] for storing (just coppying measured data to new destination and interpolating between them)
mbl.upsample_3x3(); //interpolation from 3x3 to 7x7 points using largrangian polynomials while using the same array z_values[iy][ix] for storing (just coppying measured data to new destination and interpolating between them)
}
// SERIAL_ECHOLNPGM("Upsample finished");
mbl.active = 1; //activate mesh bed leveling

View file

@ -3065,4 +3065,28 @@ void mbl_mode_init() {
uint8_t mbl_type = eeprom_read_byte((uint8_t*)EEPROM_MBL_TYPE);
if (mbl_type == 0xFF) e_mbl_type = e_MBL_OPTIMAL;
else e_mbl_type = mbl_type;
}
bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points) {
//"human readable" heatbed plan
//magnet proximity influence Z coordinate measurements significantly (40 - 100 um)
//0 - measurement point is above magnet and Z coordinate can be influenced negatively
//1 - we should be in safe distance from magnets, measurement should be accurate
uint8_t valid_points_mask[7] = {
//[X_MAX,Y_MAX]
0b1111101,
0b1110111,
0b1111111,
0b0111011,
0b1110111,
0b1111111,
0b1110111,
//[0,0]
};
if (meas_points == 3) {
ix *= 3;
iy *= 3;
}
if((iy%2) == 0) return (valid_points_mask[6 - iy] & (1 << (6 - ix)));
else return (valid_points_mask[6 - iy] & (1 << ix));
}

View file

@ -6,9 +6,9 @@
#ifdef HEATBED_V2
#define BED_X0 (13.f - BED_ZERO_REF_X)
#define BED_X0 (3.f - BED_ZERO_REF_X)
#define BED_Y0 (10.4f - BED_ZERO_REF_Y)
#define BED_Xn (216.f - BED_ZERO_REF_X)
#define BED_Xn (206.f - BED_ZERO_REF_X)
#define BED_Yn (202.4f - BED_ZERO_REF_Y)
#else
@ -210,4 +210,6 @@ extern e_MBL_TYPE e_mbl_type;
extern void mbl_mode_set();
extern void mbl_mode_init();
extern bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points);
#endif /* MESH_BED_CALIBRATION_H */