|
@@ -165,7 +165,7 @@ static bool lcd_selfcheck_pulleys(int axis);
|
|
|
#endif //TMC2130
|
|
|
|
|
|
static bool lcd_selfcheck_check_heater(bool _isbed);
|
|
|
-enum class testScreen
|
|
|
+enum class testScreen : uint_least8_t
|
|
|
{
|
|
|
extruderFan,
|
|
|
printFan,
|
|
@@ -184,6 +184,22 @@ enum class testScreen
|
|
|
home,
|
|
|
};
|
|
|
|
|
|
+enum class TestError : uint_least8_t
|
|
|
+{
|
|
|
+ unused,
|
|
|
+ heater,
|
|
|
+ bed,
|
|
|
+ endstops,
|
|
|
+ motor,
|
|
|
+ endstop,
|
|
|
+ printFan,
|
|
|
+ extruderFan,
|
|
|
+ pulley,
|
|
|
+ axis,
|
|
|
+ swappedFan,
|
|
|
+ wiringFsensor,
|
|
|
+};
|
|
|
+
|
|
|
static int lcd_selftest_screen(testScreen screen, int _progress, int _progress_scale, bool _clear, int _delay);
|
|
|
static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator);
|
|
|
static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite);
|
|
@@ -194,7 +210,7 @@ static bool lcd_selftest_fan_dialog(int _fan);
|
|
|
static bool lcd_selftest_fsensor();
|
|
|
#endif //PAT9125
|
|
|
static bool selftest_irsensor();
|
|
|
-static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2);
|
|
|
+static void lcd_selftest_error(TestError error, const char *_error_1, const char *_error_2);
|
|
|
static void lcd_colorprint_change();
|
|
|
#ifdef SNMM
|
|
|
static int get_ext_nr();
|
|
@@ -7184,7 +7200,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) {
|
|
|
if (axis == Y_AXIS) _error_1 = "Y";
|
|
|
if (axis == Z_AXIS) _error_1 = "Z";
|
|
|
|
|
|
- lcd_selftest_error(9, _error_1, NULL);
|
|
|
+ lcd_selftest_error(TestError::axis, _error_1, NULL);
|
|
|
current_position[axis] = 0;
|
|
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
reset_crash_det(axis);
|
|
@@ -7202,7 +7218,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) {
|
|
|
if (axis == Y_AXIS) _error_1 = "Y";
|
|
|
if (axis == Z_AXIS) _error_1 = "Z";
|
|
|
|
|
|
- lcd_selftest_error(8, _error_1, NULL);
|
|
|
+ lcd_selftest_error(TestError::pulley, _error_1, NULL);
|
|
|
current_position[axis] = 0;
|
|
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
reset_crash_det(axis);
|
|
@@ -7309,11 +7325,11 @@ static bool lcd_selfcheck_axis(int _axis, int _travel)
|
|
|
|
|
|
if (_travel_done >= _travel)
|
|
|
{
|
|
|
- lcd_selftest_error(5, _error_1, _error_2);
|
|
|
+ lcd_selftest_error(TestError::endstop, _error_1, _error_2);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- lcd_selftest_error(4, _error_1, _error_2);
|
|
|
+ lcd_selftest_error(TestError::motor, _error_1, _error_2);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -7479,12 +7495,12 @@ static bool lcd_selfcheck_check_heater(bool _isbed)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- lcd_selftest_error(1, "", "");
|
|
|
+ lcd_selftest_error(TestError::heater, "", "");
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- lcd_selftest_error(2, "", "");
|
|
|
+ lcd_selftest_error(TestError::bed, "", "");
|
|
|
}
|
|
|
|
|
|
manage_heater();
|
|
@@ -7493,7 +7509,7 @@ static bool lcd_selfcheck_check_heater(bool _isbed)
|
|
|
return _stepresult;
|
|
|
|
|
|
}
|
|
|
-static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2)
|
|
|
+static void lcd_selftest_error(TestError testError, const char *_error_1, const char *_error_2)
|
|
|
{
|
|
|
lcd_beeper_quick_feedback();
|
|
|
|
|
@@ -7509,21 +7525,21 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char *
|
|
|
lcd_set_cursor(0, 1);
|
|
|
lcd_puts_P(_i("Please check :"));////MSG_SELFTEST_PLEASECHECK c=0 r=0
|
|
|
|
|
|
- switch (_error_no)
|
|
|
+ switch (testError)
|
|
|
{
|
|
|
- case 1:
|
|
|
+ case TestError::heater:
|
|
|
lcd_set_cursor(0, 2);
|
|
|
lcd_puts_P(_i("Heater/Thermistor"));////MSG_SELFTEST_HEATERTHERMISTOR c=0 r=0
|
|
|
lcd_set_cursor(0, 3);
|
|
|
lcd_puts_P(_i("Not connected"));////MSG_SELFTEST_NOTCONNECTED c=0 r=0
|
|
|
break;
|
|
|
- case 2:
|
|
|
+ case TestError::bed:
|
|
|
lcd_set_cursor(0, 2);
|
|
|
lcd_puts_P(_i("Bed / Heater"));////MSG_SELFTEST_BEDHEATER c=0 r=0
|
|
|
lcd_set_cursor(0, 3);
|
|
|
lcd_puts_P(_T(MSG_SELFTEST_WIRINGERROR));
|
|
|
break;
|
|
|
- case 3:
|
|
|
+ case TestError::endstops:
|
|
|
lcd_set_cursor(0, 2);
|
|
|
lcd_puts_P(_i("Endstops"));////MSG_SELFTEST_ENDSTOPS c=0 r=0
|
|
|
lcd_set_cursor(0, 3);
|
|
@@ -7531,7 +7547,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char *
|
|
|
lcd_set_cursor(17, 3);
|
|
|
lcd_print(_error_1);
|
|
|
break;
|
|
|
- case 4:
|
|
|
+ case TestError::motor:
|
|
|
lcd_set_cursor(0, 2);
|
|
|
lcd_puts_P(_T(MSG_SELFTEST_MOTOR));
|
|
|
lcd_set_cursor(18, 2);
|
|
@@ -7541,7 +7557,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char *
|
|
|
lcd_set_cursor(18, 3);
|
|
|
lcd_print(_error_2);
|
|
|
break;
|
|
|
- case 5:
|
|
|
+ case TestError::endstop:
|
|
|
lcd_set_cursor(0, 2);
|
|
|
lcd_puts_P(_i("Endstop not hit"));////MSG_SELFTEST_ENDSTOP_NOTHIT c=20 r=1
|
|
|
lcd_set_cursor(0, 3);
|
|
@@ -7549,7 +7565,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char *
|
|
|
lcd_set_cursor(18, 3);
|
|
|
lcd_print(_error_1);
|
|
|
break;
|
|
|
- case 6:
|
|
|
+ case TestError::printFan:
|
|
|
lcd_set_cursor(0, 2);
|
|
|
lcd_puts_P(_T(MSG_SELFTEST_COOLING_FAN));
|
|
|
lcd_set_cursor(0, 3);
|
|
@@ -7557,7 +7573,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char *
|
|
|
lcd_set_cursor(18, 3);
|
|
|
lcd_print(_error_1);
|
|
|
break;
|
|
|
- case 7:
|
|
|
+ case TestError::extruderFan:
|
|
|
lcd_set_cursor(0, 2);
|
|
|
lcd_puts_P(_T(MSG_SELFTEST_EXTRUDER_FAN));
|
|
|
lcd_set_cursor(0, 3);
|
|
@@ -7565,7 +7581,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char *
|
|
|
lcd_set_cursor(18, 3);
|
|
|
lcd_print(_error_1);
|
|
|
break;
|
|
|
- case 8:
|
|
|
+ case TestError::pulley:
|
|
|
lcd_set_cursor(0, 2);
|
|
|
lcd_puts_P(_i("Loose pulley"));////MSG_LOOSE_PULLEY c=20 r=1
|
|
|
lcd_set_cursor(0, 3);
|
|
@@ -7573,7 +7589,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char *
|
|
|
lcd_set_cursor(18, 3);
|
|
|
lcd_print(_error_1);
|
|
|
break;
|
|
|
- case 9:
|
|
|
+ case TestError::axis:
|
|
|
lcd_set_cursor(0, 2);
|
|
|
lcd_puts_P(_i("Axis length"));////MSG_SELFTEST_AXIS_LENGTH c=0 r=0
|
|
|
lcd_set_cursor(0, 3);
|
|
@@ -7581,7 +7597,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char *
|
|
|
lcd_set_cursor(18, 3);
|
|
|
lcd_print(_error_1);
|
|
|
break;
|
|
|
- case 10:
|
|
|
+ case TestError::swappedFan:
|
|
|
lcd_set_cursor(0, 2);
|
|
|
lcd_puts_P(_i("Front/left fans"));////MSG_SELFTEST_FANS c=0 r=0
|
|
|
lcd_set_cursor(0, 3);
|
|
@@ -7589,7 +7605,7 @@ static void lcd_selftest_error(int _error_no, const char *_error_1, const char *
|
|
|
lcd_set_cursor(18, 3);
|
|
|
lcd_print(_error_1);
|
|
|
break;
|
|
|
- case 11:
|
|
|
+ case TestError::wiringFsensor:
|
|
|
lcd_set_cursor(0, 2);
|
|
|
lcd_puts_P(_i("Filament sensor"));////MSG_FILAMENT_SENSOR c=20 r=0
|
|
|
lcd_set_cursor(0, 3);
|
|
@@ -7796,7 +7812,7 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite)
|
|
|
static bool lcd_selftest_fan_dialog(int _fan)
|
|
|
{
|
|
|
bool _result = true;
|
|
|
- int _errno = 7;
|
|
|
+ TestError testError = TestError::extruderFan;
|
|
|
switch (_fan) {
|
|
|
case 0:
|
|
|
fanSpeed = 0;
|
|
@@ -7851,7 +7867,7 @@ static bool lcd_selftest_fan_dialog(int _fan)
|
|
|
printf_P(PSTR("Print fan speed: %d \n"), fan_speed[1]);
|
|
|
printf_P(PSTR("Extr fan speed: %d \n"), fan_speed[0]);
|
|
|
if (!fan_speed[1]) {
|
|
|
- _result = false; _errno = 6; //print fan not spinning
|
|
|
+ _result = false; testError = TestError::printFan;
|
|
|
}
|
|
|
#ifdef FAN_SOFT_PWM
|
|
|
else {
|
|
@@ -7862,10 +7878,10 @@ static bool lcd_selftest_fan_dialog(int _fan)
|
|
|
_result = lcd_selftest_manual_fan_check(1, true); //turn on print fan and check that left extruder fan is not spinning
|
|
|
if (_result) {
|
|
|
_result = lcd_selftest_manual_fan_check(1, false); //print fan is stil turned on; check that it is spinning
|
|
|
- if (!_result) _errno = 6; //print fan not spinning
|
|
|
+ if (!_result) testError = TestError::printFan;
|
|
|
}
|
|
|
else {
|
|
|
- _errno = 10; //swapped fans
|
|
|
+ testError = TestError::swappedFan;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -7877,7 +7893,7 @@ static bool lcd_selftest_fan_dialog(int _fan)
|
|
|
}
|
|
|
if (!_result)
|
|
|
{
|
|
|
- lcd_selftest_error(_errno, NULL, NULL);
|
|
|
+ lcd_selftest_error(testError, NULL, NULL);
|
|
|
}
|
|
|
return _result;
|
|
|
}
|