Revert double scanning

This commit is contained in:
espr14 2021-01-12 16:04:04 +01:00
parent 546812294e
commit 9dceb488b6
1 changed files with 37 additions and 36 deletions

View File

@ -923,9 +923,7 @@ bool xyzcal_scan_and_process(void){
pattern10[i] = pgm_read_word((uint16_t*)(xyzcal_point_pattern_10 + i)); pattern10[i] = pgm_read_word((uint16_t*)(xyzcal_point_pattern_10 + i));
} }
/// Lower z if pattern not found xyzcal_scan_pixels_32x32_Zhop(x, y, z, 2400, 200, matrix32);
for (int8_t lower = 0; lower < 60; lower += 50){
xyzcal_scan_pixels_32x32_Zhop(x, y, z - lower, 2400, 200, matrix32);
print_image(matrix32); print_image(matrix32);
/// SEARCH FOR BINARY CIRCLE /// SEARCH FOR BINARY CIRCLE
@ -941,7 +939,8 @@ bool xyzcal_scan_and_process(void){
float radius = 4.5f; ///< default radius float radius = 4.5f; ///< default radius
const uint8_t iterations = 20; const uint8_t iterations = 20;
dynamic_circle(matrix32, xf, yf, radius, iterations); dynamic_circle(matrix32, xf, yf, radius, iterations);
if (ABS(xf - (uc + 5.5f)) > 3 || ABS(yf - (ur + 5.5f)) > 3 || ABS(radius - 5) > 3){ if (ABS(xf - (uc + 5.5f)) > 3 || ABS(yf - (ur + 5.5f)) > 3 || ABS(radius - 5) > 3)
{
DBG(_n(" [%f %f][%f] mm divergence\n"), xf - (uc + 5.5f), yf - (ur + 5.5f), radius - 5); DBG(_n(" [%f %f][%f] mm divergence\n"), xf - (uc + 5.5f), yf - (ur + 5.5f), radius - 5);
/// dynamic algorithm diverged, use original position instead /// dynamic algorithm diverged, use original position instead
xf = uc + 5.5f; xf = uc + 5.5f;
@ -956,7 +955,6 @@ bool xyzcal_scan_and_process(void){
y = round_to_i16(yf); y = round_to_i16(yf);
xyzcal_lineXYZ_to(x, y, z, 200, 0); xyzcal_lineXYZ_to(x, y, z, 200, 0);
ret = true; ret = true;
break;
} }
} }
@ -971,9 +969,11 @@ bool xyzcal_find_bed_induction_sensor_point_xy(void){
DBG(_n("xyzcal_find_bed_induction_sensor_point_xy x=%ld y=%ld z=%ld\n"), count_position[X_AXIS], count_position[Y_AXIS], count_position[Z_AXIS]); DBG(_n("xyzcal_find_bed_induction_sensor_point_xy x=%ld y=%ld z=%ld\n"), count_position[X_AXIS], count_position[Y_AXIS], count_position[Z_AXIS]);
st_synchronize(); st_synchronize();
pos_i16_t x = _X; const pos_i16_t x = _X;
pos_i16_t y = _Y; const pos_i16_t y = _Y;
pos_i16_t z = _Z; const pos_i16_t z = _Z;
///< magic constant, lowers min_z after searchZ to obtain more dense data in scan
const pos_i16_t lower_z = 72;
uint8_t point = xyzcal_xycoords2point(x, y); uint8_t point = xyzcal_xycoords2point(x, y);
x = pgm_read_word((uint16_t *)(xyzcal_point_xcoords + point)); x = pgm_read_word((uint16_t *)(xyzcal_point_xcoords + point));
@ -983,6 +983,7 @@ bool xyzcal_find_bed_induction_sensor_point_xy(void){
xyzcal_lineXYZ_to(x, y, z, 200, 0); xyzcal_lineXYZ_to(x, y, z, 200, 0);
if (xyzcal_searchZ()){ if (xyzcal_searchZ()){
xyzcal_lineXYZ_to(_X, _Y, _Z - lower_z, 200, 0);
xyzcal_lineXYZ_to(x, y, _Z, 200, 0); xyzcal_lineXYZ_to(x, y, _Z, 200, 0);
ret = xyzcal_scan_and_process(); ret = xyzcal_scan_and_process();
} }