Skip to content

Commit eb4cf1a

Browse files
espr14DRracer
authored andcommitted
Calibration: return XY back after Z search
PFW-1217
1 parent 6489c6f commit eb4cf1a

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

Firmware/xyzcal.cpp

+13-19
Original file line numberDiff line numberDiff line change
@@ -699,31 +699,29 @@ uint8_t xyzcal_find_pattern_12x12_in_32x32(uint8_t* pixels, uint16_t* pattern, u
699699
const uint16_t xyzcal_point_pattern_10[12] PROGMEM = {0x000, 0x0f0, 0x1f8, 0x3fc, 0x7fe, 0x7fe, 0x7fe, 0x7fe, 0x3fc, 0x1f8, 0x0f0, 0x000};
700700
const uint16_t xyzcal_point_pattern_08[12] PROGMEM = {0x000, 0x000, 0x0f0, 0x1f8, 0x3fc, 0x3fc, 0x3fc, 0x3fc, 0x1f8, 0x0f0, 0x000, 0x000};
701701

702-
bool xyzcal_searchZ(void)
703-
{
704-
//@size=118
702+
bool xyzcal_searchZ(void) {
703+
//@size=118
705704
DBG(_n("xyzcal_searchZ x=%ld y=%ld z=%ld\n"), count_position[X_AXIS], count_position[Y_AXIS], count_position[Z_AXIS]);
706705
int16_t x0 = _X;
707706
int16_t y0 = _Y;
708-
int16_t z0 = _Z;
707+
int16_t z = _Z;
709708
// int16_t min_z = -6000;
710709
// int16_t dz = 100;
711-
int16_t z = z0;
712-
while (z > -2300) //-6mm + 0.25mm
713-
{
710+
while (z > -2300) { //-6mm + 0.25mm
714711
uint16_t ad = 0;
715-
if (xyzcal_spiral8(x0, y0, z, 100, 900, 320, 1, &ad)) //dz=100 radius=900 delay=400
716-
{
717-
int16_t x_on = _X;
718-
int16_t y_on = _Y;
719-
int16_t z_on = _Z;
712+
if (xyzcal_spiral8(x0, y0, z, 100, 900, 320, 1, &ad)) { //dz=100 radius=900 delay=400
720713
//@size=82
721-
DBG(_n(" ON-SIGNAL at x=%d y=%d z=%d ad=%d\n"), x_on, y_on, z_on, ad);
714+
DBG(_n(" ON-SIGNAL at x=%d y=%d z=%d ad=%d\n"), _X, _Y, _Z, ad);
715+
716+
/// return to starting XY position
717+
/// magic constant, lowers min_z after searchZ to obtain more dense data in scan
718+
const pos_i16_t lower_z = 72;
719+
xyzcal_lineXYZ_to(x0, y0, _Z - lower_z, 200, 0);
722720
return true;
723721
}
724722
z -= 400;
725723
}
726-
//@size=138
724+
//@size=138
727725
DBG(_n("xyzcal_searchZ no signal\n x=%ld y=%ld z=%ld\n"), count_position[X_AXIS], count_position[Y_AXIS], count_position[Z_AXIS]);
728726
return false;
729727
}
@@ -972,14 +970,10 @@ bool xyzcal_find_bed_induction_sensor_point_xy(void){
972970
//@size=258
973971
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]);
974972
st_synchronize();
975-
///< magic constant, lowers min_z after searchZ to obtain more dense data in scan
976-
const pos_i16_t lower_z = 72;
977973

978974
xyzcal_meassure_enter();
979-
if (xyzcal_searchZ()){
980-
xyzcal_lineXYZ_to(_X, _Y, _Z - lower_z, 200, 0);
975+
if (xyzcal_searchZ())
981976
ret = xyzcal_scan_and_process();
982-
}
983977
xyzcal_meassure_leave();
984978
return ret;
985979
}

0 commit comments

Comments
 (0)