fix selftest Z crash. Use stallGuard when testing Z
This commit is contained in:
parent
3aa380e348
commit
350e27810a
@ -309,9 +309,9 @@ extern int fanSpeed;
|
||||
extern int8_t lcd_change_fil_state;
|
||||
|
||||
#ifdef TMC2130
|
||||
void homeaxis(int axis, uint8_t cnt = 1, uint8_t* pstep = 0);
|
||||
bool homeaxis(int axis, bool doError = 1, uint8_t cnt = 1, uint8_t* pstep = 0);
|
||||
#else
|
||||
void homeaxis(int axis, uint8_t cnt = 1);
|
||||
bool homeaxis(int axis, bool doError = 1, uint8_t cnt = 1);
|
||||
#endif //TMC2130
|
||||
|
||||
|
||||
|
@ -1898,10 +1898,6 @@ static void axis_is_at_home(int axis) {
|
||||
max_pos[axis] = base_max_pos(axis) + cs.add_homing[axis];
|
||||
}
|
||||
|
||||
|
||||
inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
|
||||
inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
|
||||
|
||||
//! @return original feedmultiply
|
||||
static int setup_for_endstop_move(bool enable_endstops_now = true) {
|
||||
saved_feedrate = feedrate;
|
||||
@ -2144,9 +2140,9 @@ bool calibrate_z_auto()
|
||||
#endif //TMC2130
|
||||
|
||||
#ifdef TMC2130
|
||||
void homeaxis(int axis, uint8_t cnt, uint8_t* pstep)
|
||||
bool homeaxis(int axis, bool doError, uint8_t cnt, uint8_t* pstep)
|
||||
#else
|
||||
void homeaxis(int axis, uint8_t cnt)
|
||||
bool homeaxis(int axis, bool doError, uint8_t cnt)
|
||||
#endif //TMC2130
|
||||
{
|
||||
bool endstops_enabled = enable_endstops(true); //RP: endstops should be allways enabled durring homing
|
||||
@ -2261,8 +2257,8 @@ void homeaxis(int axis, uint8_t cnt)
|
||||
#ifdef TMC2130
|
||||
if (READ(Z_TMC2130_DIAG) != 0) { //Z crash
|
||||
FORCE_HIGH_POWER_END;
|
||||
kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
|
||||
return;
|
||||
if (doError) kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
|
||||
return 0;
|
||||
}
|
||||
#endif //TMC2130
|
||||
current_position[axis] = 0;
|
||||
@ -2277,8 +2273,8 @@ void homeaxis(int axis, uint8_t cnt)
|
||||
#ifdef TMC2130
|
||||
if (READ(Z_TMC2130_DIAG) != 0) { //Z crash
|
||||
FORCE_HIGH_POWER_END;
|
||||
kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
|
||||
return;
|
||||
if (doError) kill(_T(MSG_BED_LEVELING_FAILED_POINT_LOW));
|
||||
return 0;
|
||||
}
|
||||
#endif //TMC2130
|
||||
axis_is_at_home(axis);
|
||||
@ -2291,6 +2287,7 @@ void homeaxis(int axis, uint8_t cnt)
|
||||
#endif
|
||||
}
|
||||
enable_endstops(endstops_enabled);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**/
|
||||
|
@ -161,6 +161,9 @@ void plan_set_position(float x, float y, float z, const float &e);
|
||||
void plan_set_z_position(const float &z);
|
||||
void plan_set_e_position(const float &e);
|
||||
|
||||
inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
|
||||
inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
|
||||
|
||||
extern bool e_active();
|
||||
|
||||
void check_axes_activity();
|
||||
|
@ -994,7 +994,7 @@ bool tmc2130_home_calibrate(uint8_t axis)
|
||||
uint8_t step[16];
|
||||
uint8_t cnt[16];
|
||||
uint8_t val[16];
|
||||
homeaxis(axis, 16, step);
|
||||
homeaxis(axis, 1, 16, step);
|
||||
bubblesort_uint8(step, 16, 0);
|
||||
printf_P(PSTR("sorted samples:\n"));
|
||||
for (uint8_t i = 0; i < 16; i++)
|
||||
|
@ -7468,21 +7468,27 @@ bool lcd_selftest()
|
||||
#ifdef TMC2130
|
||||
tmc2130_home_exit();
|
||||
enable_endstops(false);
|
||||
current_position[X_AXIS] = current_position[X_AXIS] + 14;
|
||||
current_position[Y_AXIS] = current_position[Y_AXIS] + 12;
|
||||
#endif
|
||||
|
||||
//homeaxis(X_AXIS);
|
||||
//homeaxis(Y_AXIS);
|
||||
current_position[X_AXIS] += pgm_read_float(bed_ref_points_4);
|
||||
current_position[Y_AXIS] += pgm_read_float(bed_ref_points_4+1);
|
||||
#ifdef TMC2130
|
||||
//current_position[X_AXIS] += 0;
|
||||
current_position[Y_AXIS] += 4;
|
||||
#endif //TMC2130
|
||||
current_position[Z_AXIS] = current_position[Z_AXIS] + 10;
|
||||
plan_buffer_line_curposXYZE(manual_feedrate[0] / 60, active_extruder);
|
||||
st_synchronize();
|
||||
set_destination_to_current();
|
||||
_progress = lcd_selftest_screen(TestScreen::AxisZ, _progress, 3, true, 1500);
|
||||
_result = lcd_selfcheck_axis(2, Z_MAX_POS);
|
||||
if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) != 1) {
|
||||
enquecommand_P(PSTR("G28 W"));
|
||||
enquecommand_P(PSTR("G1 Z15 F1000"));
|
||||
}
|
||||
_result = homeaxis(Z_AXIS, 0);
|
||||
|
||||
//raise Z to not damage the bed during and hotend testing
|
||||
current_position[Z_AXIS] += 20;
|
||||
plan_buffer_line_curposXYZE(manual_feedrate[0] / 60, active_extruder);
|
||||
st_synchronize();
|
||||
}
|
||||
|
||||
#ifdef TMC2130
|
||||
@ -7794,6 +7800,8 @@ static bool lcd_selfcheck_axis(int _axis, int _travel)
|
||||
lcd_selftest_error(TestError::Motor, _error_1, _error_2);
|
||||
}
|
||||
}
|
||||
current_position[_axis] = 0; //simulate axis home to avoid negative numbers for axis position, especially Z.
|
||||
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||
|
||||
return _stepresult;
|
||||
}
|
||||
@ -7843,9 +7851,6 @@ static bool lcd_selfcheck_pulleys(int axis)
|
||||
((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1)) {
|
||||
endstop_triggered = true;
|
||||
if (current_position_init - 1 <= current_position[axis] && current_position_init + 1 >= current_position[axis]) {
|
||||
current_position[axis] += (axis == X_AXIS) ? 13 : 9;
|
||||
plan_buffer_line_curposXYZE(manual_feedrate[0] / 60, active_extruder);
|
||||
st_synchronize();
|
||||
return(true);
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user