|
@@ -598,23 +598,18 @@ void crashdet_detected(uint8_t mask)
|
|
|
{
|
|
|
st_synchronize();
|
|
|
static uint8_t crashDet_counter = 0;
|
|
|
+ static uint8_t crashDet_axes = 0;
|
|
|
bool automatic_recovery_after_crash = true;
|
|
|
+ char msg[LCD_WIDTH+1] = "";
|
|
|
|
|
|
- if (crashDet_counter++ == 0) {
|
|
|
- crashDetTimer.start();
|
|
|
- }
|
|
|
- else if (crashDetTimer.expired(CRASHDET_TIMER * 1000ul)){
|
|
|
- crashDetTimer.stop();
|
|
|
- crashDet_counter = 0;
|
|
|
- }
|
|
|
- else if(crashDet_counter == CRASHDET_COUNTER_MAX){
|
|
|
- automatic_recovery_after_crash = false;
|
|
|
- crashDetTimer.stop();
|
|
|
- crashDet_counter = 0;
|
|
|
- }
|
|
|
- else {
|
|
|
- crashDetTimer.start();
|
|
|
- }
|
|
|
+ if (crashDetTimer.expired(CRASHDET_TIMER * 1000ul)) {
|
|
|
+ crashDet_counter = 0;
|
|
|
+ }
|
|
|
+ if(++crashDet_counter >= CRASHDET_COUNTER_MAX) {
|
|
|
+ automatic_recovery_after_crash = false;
|
|
|
+ }
|
|
|
+ crashDetTimer.start();
|
|
|
+ crashDet_axes |= mask;
|
|
|
|
|
|
lcd_update_enable(true);
|
|
|
lcd_clear();
|
|
@@ -624,18 +619,23 @@ void crashdet_detected(uint8_t mask)
|
|
|
{
|
|
|
eeprom_update_byte((uint8_t*)EEPROM_CRASH_COUNT_X, eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_X) + 1);
|
|
|
eeprom_update_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT, eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT) + 1);
|
|
|
+ strcat(msg, "X");
|
|
|
}
|
|
|
if (mask & Y_AXIS_MASK)
|
|
|
{
|
|
|
eeprom_update_byte((uint8_t*)EEPROM_CRASH_COUNT_Y, eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_Y) + 1);
|
|
|
eeprom_update_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT, eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT) + 1);
|
|
|
+ strcat(msg, "Y");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
|
|
|
lcd_update_enable(true);
|
|
|
lcd_update(2);
|
|
|
- lcd_setstatuspgm(_T(MSG_CRASH_DETECTED));
|
|
|
+
|
|
|
+ // prepare the status message with the _current_ axes stauts
|
|
|
+ strcat(msg, " ");
|
|
|
+ strcat_P(msg, _T(MSG_CRASH_DETECTED));
|
|
|
+ lcd_setstatus(msg);
|
|
|
+
|
|
|
gcode_G28(true, true, false); //home X and Y
|
|
|
st_synchronize();
|
|
|
|
|
@@ -643,7 +643,21 @@ void crashdet_detected(uint8_t mask)
|
|
|
enquecommand_P(PSTR("CRASH_RECOVER"));
|
|
|
}else{
|
|
|
setTargetHotend(0, active_extruder);
|
|
|
- bool yesno = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Crash detected. Resume print?"), false);////MSG_CRASH_RESUME c=20 r=3
|
|
|
+
|
|
|
+ // notify the user of *all* the axes previously affected, not just the last one
|
|
|
+ lcd_update_enable(false);
|
|
|
+ lcd_clear();
|
|
|
+ if (crashDet_axes & X_AXIS_MASK) lcd_putc('X');
|
|
|
+ if (crashDet_axes & Y_AXIS_MASK) lcd_putc('Y');
|
|
|
+ crashDet_axes = 0;
|
|
|
+ lcd_putc(' ');
|
|
|
+ lcd_puts_P(_T(MSG_CRASH_DETECTED));
|
|
|
+
|
|
|
+ // ask whether to resume printing
|
|
|
+ lcd_set_cursor(0, 1);
|
|
|
+ lcd_puts_P(MSG_RESUME_PRINT);
|
|
|
+ lcd_putc('?');
|
|
|
+ bool yesno = lcd_show_yes_no_and_wait(false);
|
|
|
lcd_update_enable(true);
|
|
|
if (yesno)
|
|
|
{
|