selftest: Handle thermal errors in lcd_selfcheck_check_heater

- Simplify lcd_selfcheck_check_heater loop
- Check for/abort on Stopped (indicating a thermal failure).
This commit is contained in:
Yuri D'Elia 2022-12-12 16:14:39 +01:00 committed by 3d-gussner
parent d2019b70f2
commit 6d83a494d6

View File

@ -6996,11 +6996,7 @@ static bool lcd_selfcheck_endstops()
static bool lcd_selfcheck_check_heater(bool _isbed)
{
uint8_t _counter = 0;
uint8_t _progress = 0;
bool _stepresult = false;
bool _docycle = true;
int _checked_snapshot = (_isbed) ? degBed() : degHotend(0);
int _opposite_snapshot = (_isbed) ? degHotend(0) : degBed();
uint8_t _cycles = (_isbed) ? 180 : 60; //~ 90s / 30s
@ -7010,13 +7006,13 @@ static bool lcd_selfcheck_check_heater(bool _isbed)
manage_heater();
manage_inactivity(true);
do {
_counter++;
_docycle = (_counter < _cycles) ? true : false;
for(uint8_t _counter = 0; _counter < _cycles && !Stopped; ++_counter)
{
manage_heater();
manage_inactivity(true);
_progress = (_isbed) ? lcd_selftest_screen(TestScreen::Bed, _progress, 2, false, 400) : lcd_selftest_screen(TestScreen::Hotend, _progress, 2, false, 400);
_progress = (_isbed?
lcd_selftest_screen(TestScreen::Bed, _progress, 2, false, 400) :
lcd_selftest_screen(TestScreen::Hotend, _progress, 2, false, 400));
/*if (_isbed) {
MYSERIAL.print("Bed temp:");
MYSERIAL.println(degBed());
@ -7026,8 +7022,7 @@ static bool lcd_selfcheck_check_heater(bool _isbed)
MYSERIAL.println(degHotend(0));
}*/
if(_counter%5 == 0) serialecho_temperatures(); //show temperatures once in two seconds
} while (_docycle);
}
target_temperature[0] = 0;
target_temperature_bed = 0;
@ -7043,21 +7038,26 @@ static bool lcd_selfcheck_check_heater(bool _isbed)
MYSERIAL.println(_opposite_result);
*/
if (_opposite_result < ((_isbed) ? 30 : 9))
bool _stepresult = false;
if (Stopped)
{
if (_checked_result >= ((_isbed) ? 9 : 30))
{
_stepresult = true;
// thermal error occurred while heating the nozzle
lcd_selftest_error(TestError::Heater, "", "");
}
else
{
if (_opposite_result < ((_isbed) ? 30 : 9))
{
if (_checked_result >= ((_isbed) ? 9 : 30))
_stepresult = true;
else
lcd_selftest_error(TestError::Heater, "", "");
}
}
else
{
lcd_selftest_error(TestError::Bed, "", "");
}
}
manage_heater();
manage_inactivity(true);