Function for decision if we have valid Z-calibration data in eeprom fixed, mesh bed leveling: possible crash fix, temporaty debug info on serial line.
This commit is contained in:
parent
2f3c5e15ed
commit
a9ce38df71
2 changed files with 58 additions and 27 deletions
Firmware
|
@ -678,11 +678,13 @@ void reset_bed_offset_and_skew()
|
|||
|
||||
bool is_bed_z_jitter_data_valid()
|
||||
// offsets of the Z heiths of the calibration points from the first point are saved as 16bit signed int, scaled to tenths of microns
|
||||
{
|
||||
for (int8_t i = 0; i < 8; ++ i)
|
||||
if (eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER+i*2)) == 0x0FFFF)
|
||||
return false;
|
||||
return true;
|
||||
// if at least one 16bit integer has different value then -1 (0x0FFFF), data are considered valid and function returns true, otherwise it returns false
|
||||
{
|
||||
bool data_valid = false;
|
||||
for (int8_t i = 0; i < 8; ++i) {
|
||||
if (eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + i * 2)) != 0x0FFFF) data_valid = true;
|
||||
}
|
||||
return data_valid;
|
||||
}
|
||||
|
||||
static void world2machine_update(const float vec_x[2], const float vec_y[2], const float cntr[2])
|
||||
|
@ -946,7 +948,7 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i
|
|||
#ifdef TMC2130
|
||||
FORCE_HIGH_POWER_START;
|
||||
#endif
|
||||
|
||||
printf_P(PSTR("Min. Z: %f\n"), minimum_z);
|
||||
#ifdef SUPPORT_VERBOSITY
|
||||
if(verbosity_level >= 10) SERIAL_ECHOLNPGM("find bed induction sensor point z");
|
||||
#endif // SUPPORT_VERBOSITY
|
||||
|
@ -961,9 +963,16 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i
|
|||
// we have to let the planner know where we are right now as it is not where we said to go.
|
||||
update_current_position_z();
|
||||
if (! endstop_z_hit_on_purpose())
|
||||
goto error;
|
||||
{
|
||||
printf_P(PSTR("endstop not hit 1, current_pos[Z]: %f \n"), current_position[Z_AXIS]);
|
||||
goto error;
|
||||
}
|
||||
#ifdef TMC2130
|
||||
if (READ(Z_TMC2130_DIAG) != 0) goto error; //crash Z detected
|
||||
if (READ(Z_TMC2130_DIAG) != 0)
|
||||
{
|
||||
printf_P(PSTR("crash detected 1, current_pos[Z]: %f \n"), current_position[Z_AXIS]);
|
||||
goto error; //crash Z detected
|
||||
}
|
||||
#endif //TMC2130
|
||||
for (uint8_t i = 0; i < n_iter; ++ i)
|
||||
{
|
||||
|
@ -973,12 +982,13 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i
|
|||
go_to_current(homing_feedrate[Z_AXIS]/60);
|
||||
// Move back down slowly to find bed.
|
||||
current_position[Z_AXIS] = minimum_z;
|
||||
printf_P(PSTR("init Z = %f, min_z = %f\n"), z_bckp, minimum_z);
|
||||
go_to_current(homing_feedrate[Z_AXIS]/(4*60));
|
||||
// we have to let the planner know where we are right now as it is not where we said to go.
|
||||
update_current_position_z();
|
||||
//printf_P(PSTR("Zs: %f, Z: %f, delta Z: %f"), z_bckp, current_position[Z_AXIS], (z_bckp - current_position[Z_AXIS]));
|
||||
if (abs(current_position[Z_AXIS] - z_bckp) < 0.025) {
|
||||
//printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n"));
|
||||
printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n"));
|
||||
current_position[Z_AXIS] += 0.5;
|
||||
go_to_current(homing_feedrate[Z_AXIS]/60);
|
||||
current_position[Z_AXIS] = minimum_z;
|
||||
|
@ -989,10 +999,16 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i
|
|||
|
||||
|
||||
|
||||
if (! endstop_z_hit_on_purpose())
|
||||
goto error;
|
||||
if (!endstop_z_hit_on_purpose())
|
||||
{
|
||||
printf_P(PSTR("i = %d, endstop not hit 2, current_pos[Z]: %f \n"), i, current_position[Z_AXIS]);
|
||||
goto error;
|
||||
}
|
||||
#ifdef TMC2130
|
||||
if (READ(Z_TMC2130_DIAG) != 0) goto error; //crash Z detected
|
||||
if (READ(Z_TMC2130_DIAG) != 0) {
|
||||
printf_P(PSTR("crash detected 2, current_pos[Z]: %f \n"), current_position[Z_AXIS]);
|
||||
goto error; //crash Z detected
|
||||
}
|
||||
#endif //TMC2130
|
||||
// SERIAL_ECHOPGM("Bed find_bed_induction_sensor_point_z low, height: ");
|
||||
// MYSERIAL.print(current_position[Z_AXIS], 5);
|
||||
|
@ -1000,7 +1016,11 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i
|
|||
float dz = i?abs(current_position[Z_AXIS] - (z / i)):0;
|
||||
z += current_position[Z_AXIS];
|
||||
//printf_P(PSTR("Z[%d] = %d, dz=%d\n"), i, (int)(current_position[Z_AXIS] * 1000), (int)(dz * 1000));
|
||||
if (dz > 0.05) goto error;//deviation > 50um
|
||||
if (dz > 0.05) {
|
||||
printf_P(PSTR("big deviation \n"));
|
||||
goto error;//deviation > 50um
|
||||
}
|
||||
printf_P(PSTR("PINDA triggered at %f\n"), current_position[Z_AXIS]);
|
||||
}
|
||||
current_position[Z_AXIS] = z;
|
||||
if (n_iter > 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue