remove / comment debug code

This commit is contained in:
PavelSindler 2019-03-27 20:41:45 +01:00
parent 5863297538
commit e259967991
2 changed files with 19 additions and 23 deletions

View file

@ -4478,18 +4478,16 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
uint16_t z_offset_u = 0;
if (nMeasPoints == 7) {
z_offset_u = eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + 2 * ((ix/3) + iy - 1)));
printf_P(PSTR("[%d;%d]: Z_offset = %d \n"), ix, iy, z_offset_u);
}
else {
z_offset_u = eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + 2 * (ix + iy * 3 - 1)));
printf_P(PSTR("[%d;%d]: Z_offset = %d \n"), ix, iy, z_offset_u);
}
z0 = mbl.z_values[0][0] + *reinterpret_cast<int16_t*>(&z_offset_u) * 0.01;
//#ifdef SUPPORT_VERBOSITY
//if (verbosity_level >= 1) {
#ifdef SUPPORT_VERBOSITY
if (verbosity_level >= 1) {
printf_P(PSTR("Bed leveling, point: %d, calibration Z stored in eeprom: %d, calibration z: %f \n"), mesh_point, z_offset_u, z0);
//}
//#endif // SUPPORT_VERBOSITY
}
#endif // SUPPORT_VERBOSITY
}
// Move Z up to MESH_HOME_Z_SEARCH.
@ -4503,7 +4501,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
current_position[X_AXIS] = BED_X(ix, nMeasPoints);
current_position[Y_AXIS] = BED_Y(iy, nMeasPoints);
printf_P(PSTR("[%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]);
//printf_P(PSTR("[%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]);
#ifdef SUPPORT_VERBOSITY
@ -4516,26 +4514,24 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]);
#endif // SUPPORT_VERBOSITY
printf_P(PSTR("after clamping: [%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]);
//printf_P(PSTR("after clamping: [%f;%f]\n"), current_position[X_AXIS], current_position[Y_AXIS]);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], XY_AXIS_FEEDRATE, active_extruder);
st_synchronize();
// Go down until endstop is hit
const float Z_CALIBRATION_THRESHOLD = 1.f;
if (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point
//printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
printf_P("Point too low 1 \n");
printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
break;
}
if (init_z_bckp - current_position[Z_AXIS] < 0.1f) { //broken cable or initial Z coordinate too low. Go to MESH_HOME_Z_SEARCH and repeat last step (z-probe) again to distinguish between these two cases.
printf_P(PSTR("Another attempt! Current Z position: %f\n"), current_position[Z_AXIS]);
//printf_P(PSTR("Another attempt! Current Z position: %f\n"), current_position[Z_AXIS]);
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], Z_LIFT_FEEDRATE, active_extruder);
st_synchronize();
if (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f, nProbeRetry)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point
//printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
printf_P("Point too low 2 \n");
printf_P(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
break;
}
if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) {

View file

@ -949,7 +949,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);
//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
@ -965,13 +965,13 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i
update_current_position_z();
if (! endstop_z_hit_on_purpose())
{
printf_P(PSTR("endstop not hit 1, current_pos[Z]: %f \n"), current_position[Z_AXIS]);
//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)
{
printf_P(PSTR("crash detected 1, current_pos[Z]: %f \n"), current_position[Z_AXIS]);
//printf_P(PSTR("crash detected 1, current_pos[Z]: %f \n"), current_position[Z_AXIS]);
goto error; //crash Z detected
}
#endif //TMC2130
@ -983,13 +983,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, i = %d\n"), z_bckp, minimum_z, i);
//printf_P(PSTR("init Z = %f, min_z = %f, i = %d\n"), z_bckp, minimum_z, i);
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;
@ -1002,12 +1002,12 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i
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]);
//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) {
printf_P(PSTR("crash detected 2, current_pos[Z]: %f \n"), current_position[Z_AXIS]);
//printf_P(PSTR("crash detected 2, current_pos[Z]: %f \n"), current_position[Z_AXIS]);
goto error; //crash Z detected
}
#endif //TMC2130
@ -1017,10 +1017,10 @@ 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));
printf_P(PSTR("Z- measurement deviation from avg value %f um\n"), dz);
//printf_P(PSTR("Z- measurement deviation from avg value %f um\n"), dz);
if (dz > 0.05) { //deviation > 50um
if (high_deviation_occured == false) { //first occurence may be caused in some cases by mechanic resonance probably especially if printer is placed on unstable surface
printf_P(PSTR("high dev. first occurence\n"));
//printf_P(PSTR("high dev. first occurence\n"));
delay_keep_alive(500); //damping
//start measurement from the begining, but this time with higher movements in Z axis which should help to reduce mechanical resonance
high_deviation_occured = true;
@ -1031,7 +1031,7 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i
goto error;
}
}
printf_P(PSTR("PINDA triggered at %f\n"), current_position[Z_AXIS]);
//printf_P(PSTR("PINDA triggered at %f\n"), current_position[Z_AXIS]);
}
current_position[Z_AXIS] = z;
if (n_iter > 1)