First attempt for Z probe checking during selftest on the MK3/S

This commit is contained in:
Alex Voinea 2020-04-01 12:28:39 +03:00
parent e481013126
commit b8896ad9c0
No known key found for this signature in database
GPG Key ID: F5034E7CFCF2F973
1 changed files with 16 additions and 10 deletions

View File

@ -168,10 +168,10 @@ static void reset_crash_det(unsigned char axis);
static bool lcd_selfcheck_axis_sg(unsigned char axis); static bool lcd_selfcheck_axis_sg(unsigned char axis);
static bool lcd_selfcheck_axis(int _axis, int _travel); static bool lcd_selfcheck_axis(int _axis, int _travel);
#else #else
static bool lcd_selfcheck_endstops();
static bool lcd_selfcheck_axis(int _axis, int _travel); static bool lcd_selfcheck_axis(int _axis, int _travel);
static bool lcd_selfcheck_pulleys(int axis); static bool lcd_selfcheck_pulleys(int axis);
#endif //TMC2130 #endif //TMC2130
static bool lcd_selfcheck_endstops();
static bool lcd_selfcheck_check_heater(bool _isbed); static bool lcd_selfcheck_check_heater(bool _isbed);
enum class TestScreen : uint_least8_t enum class TestScreen : uint_least8_t
@ -7667,11 +7667,7 @@ bool lcd_selftest()
if (_result) if (_result)
{ {
_progress = lcd_selftest_screen(TestScreen::FansOk, _progress, 3, true, 2000); _progress = lcd_selftest_screen(TestScreen::FansOk, _progress, 3, true, 2000);
#ifndef TMC2130 _result = lcd_selfcheck_endstops(); //With TMC2130, only the Z probe is tested.
_result = lcd_selfcheck_endstops();
#else
_result = true;
#endif
} }
if (_result) if (_result)
@ -8137,31 +8133,42 @@ static bool lcd_selfcheck_pulleys(int axis)
} }
return(true); return(true);
} }
#endif //not defined TMC2130
static bool lcd_selfcheck_endstops() static bool lcd_selfcheck_endstops()
{ {
bool _result = true; bool _result = true;
if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || if (
#ifndef TMC2130
((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ||
((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) || ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) ||
#endif //!TMC2130
((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1)) ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1))
{ {
#ifndef TMC2130
if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) current_position[0] += 10; if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) current_position[0] += 10;
if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) current_position[1] += 10; if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) current_position[1] += 10;
#endif //!TMC2130
if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) current_position[2] += 10; if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) current_position[2] += 10;
} }
plan_buffer_line_curposXYZE(manual_feedrate[0] / 60, active_extruder); plan_buffer_line_curposXYZE(manual_feedrate[0] / 60, active_extruder);
_delay(500); st_synchronize();
if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || if (
#ifndef TMC2130
((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ||
((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) || ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) ||
#endif //!TMC2130
((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1)) ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1))
{ {
_result = false; _result = false;
char _error[4] = ""; char _error[4] = "";
#ifndef TMC2130
if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "X"); if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "X");
if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Y"); if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Y");
#endif //!TMC2130
if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Z"); if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Z");
lcd_selftest_error(TestError::Endstops, _error, ""); lcd_selftest_error(TestError::Endstops, _error, "");
} }
@ -8169,7 +8176,6 @@ static bool lcd_selfcheck_endstops()
manage_inactivity(true); manage_inactivity(true);
return _result; return _result;
} }
#endif //not defined TMC2130
static bool lcd_selfcheck_check_heater(bool _isbed) static bool lcd_selfcheck_check_heater(bool _isbed)
{ {