Reorg/cleanup

Removed unused progress variable
reorganized flow to avoid early returns (ensures forced high power mode is disabled regardless of outcome)
This commit is contained in:
vintagepc 2020-02-08 12:33:23 -05:00 committed by GitHub
parent 1384e783bf
commit 721b27fcb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7453,7 +7453,6 @@ void lcd_belttest_print(const char* msg, uint16_t X, uint16_t Y)
}
void lcd_belttest()
{
int _progress = 0;
bool _result = true;
#ifdef TMC2130 // Belttest requires high power mode. Enable it.
@ -7466,26 +7465,20 @@ void lcd_belttest()
_delay(2000);
KEEPALIVE_STATE(IN_HANDLER);
_result = lcd_selfcheck_axis_sg(X_AXIS);
X = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X));
if (!_result){
lcd_belttest_print(_i("Error"), X, Y);
return;
if (_result){
lcd_belttest_print(_i("Checking Y..."), X, Y);
_result = lcd_selfcheck_axis_sg(Y_AXIS);
Y = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y));
}
lcd_belttest_print(_i("Checking Y..."), X, Y);
_result = lcd_selfcheck_axis_sg(Y_AXIS);
Y = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y));
if (!_result){
if (!_result) {
lcd_belttest_print(_i("Error"), X, Y);
lcd_clear();
return;
}
lcd_belttest_print(_i("Done"), X, Y);
} else {
lcd_belttest_print(_i("Done"), X, Y);
}
#ifdef TMC2130
FORCE_HIGH_POWER_END;