Manual fan check menu have default (selected) option

This commit is contained in:
Ondrej Tuma 2019-05-10 08:52:24 +02:00
parent ec1a979656
commit c851e158cc

16
Firmware/ultralcd.cpp Executable file → Normal file
View File

@ -202,7 +202,9 @@ enum class TestError : uint_least8_t
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);
static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite,
bool _default=false);
#ifdef FANCHECK
static bool lcd_selftest_fan_dialog(int _fan);
#endif //FANCHECK
@ -7712,7 +7714,8 @@ static bool selftest_irsensor()
}
#endif //FILAMENT_SENSOR
static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite)
static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite,
bool _default)
{
bool _result = check_opposite;
@ -7750,7 +7753,8 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite)
lcd_set_cursor(0, 3); lcd_print(">");
lcd_set_cursor(1, 3); lcd_puts_P(_T(MSG_SELFTEST_FAN_NO));
int8_t enc_dif = 0;
int8_t enc_dif = int(_default)*3;
KEEPALIVE_STATE(PAUSED_FOR_USER);
lcd_button_pressed = false;
@ -7773,7 +7777,6 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite)
#endif //FAN_SOFT_PWM
break;
}
if (abs((enc_dif - lcd_encoder_diff)) > 2) {
if (enc_dif > lcd_encoder_diff) {
_result = !check_opposite;
@ -7812,7 +7815,6 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite)
manage_heater();
return _result;
}
#ifdef FANCHECK
@ -7834,7 +7836,6 @@ static bool lcd_selftest_fan_dialog(int _fan)
manage_heater(); //count average fan speed from 2s delay and turn off fans
if (!fan_speed[0]) _result = false;
printf_P(PSTR("Test 1:\n"));
printf_P(PSTR("Print fan speed: %d \n"), fan_speed[1]);
printf_P(PSTR("Extr fan speed: %d \n"), fan_speed[0]);
@ -7884,7 +7885,8 @@ static bool lcd_selftest_fan_dialog(int _fan)
//check fans manually
_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
//print fan is stil turned on; check that it is spinning
_result = lcd_selftest_manual_fan_check(1, false, true);
if (!_result) testError = TestError::printFan;
}
else {