force high power mode during xyz cal. and selftest

This commit is contained in:
PavelSindler 2017-12-12 20:21:09 +01:00
parent 997c8de161
commit 82dffb688a
3 changed files with 39 additions and 2 deletions

View file

@ -420,6 +420,15 @@ extern int busy_state;
#endif //HOST_KEEPALIVE_FEATURE
#ifdef TMC2130
#define FORCE_HIGH_POWER_START force_high_power_mode(true)
#define FORCE_HIGH_POWER_END force_high_power_mode(false)
void force_high_power_mode(bool start_high_power_section);
#endif //TMC2130
// G-codes
bool gcode_M45(bool onlyZ);
void gcode_M701();

View file

@ -1916,11 +1916,30 @@ void ramming() {
}
*/
#ifdef TMC2130
void force_high_power_mode(bool start_high_power_section) {
uint8_t silent;
silent = eeprom_read_byte((uint8_t*)EEPROM_SILENT);
if (silent == 1) {
//we are in silent mode, set to normal mode to enable crash detection
st_synchronize();
cli();
tmc2130_mode = (start_high_power_section == true) ? TMC2130_MODE_NORMAL : TMC2130_MODE_SILENT;
tmc2130_init();
sei();
digipot_init();
}
}
#endif //TMC2130
bool gcode_M45(bool onlyZ) {
bool final_result = false;
#ifdef TMC2130
FORCE_HIGH_POWER_START;
#endif // TMC2130
// Only Z calibration?
if (!onlyZ) {
setTargetBed(0);
setTargetHotend(0, 0);
@ -2048,6 +2067,9 @@ bool gcode_M45(bool onlyZ) {
// Timeouted.
}
lcd_update_enable(true);
#ifdef TMC2130
FORCE_HIGH_POWER_END;
#endif // TMC2130
return final_result;
}

View file

@ -5433,6 +5433,9 @@ static bool lcd_selftest()
lcd_implementation_clear();
lcd.setCursor(0, 0); lcd_printPGM(MSG_SELFTEST_START);
#ifdef TMC2130
FORCE_HIGH_POWER_START;
#endif // TMC2130
delay(2000);
_progress = lcd_selftest_screen(-1, _progress, 3, true, 2000);
@ -5545,6 +5548,9 @@ static bool lcd_selftest()
{
LCD_ALERTMESSAGERPGM(MSG_SELFTEST_FAILED);
}
#ifdef TMC2130
FORCE_HIGH_POWER_END;
#endif // TMC2130
return(_result);
}