diff --git a/.gitignore b/.gitignore index 8bb12431..05b59952 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,8 @@ Debug Firmware/Configuration_prusa.h Firmware/Doc +/Firmware/__vm +/Firmware/Firmware.sln +/Firmware/Firmware.vcxproj +/Firmware/Firmware.vcxproj.filters +/Firmware/.vs/Firmware/v14 diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index b3c0a71f..857ddd64 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -322,6 +322,7 @@ unsigned long pause_time = 0; unsigned long start_pause_print = millis(); unsigned long t_fan_rising_edge = millis(); static LongTimer safetyTimer; +static LongTimer crashDetTimer; //unsigned long load_filament_time; @@ -678,6 +679,25 @@ void crashdet_detected(uint8_t mask) cmdqueue_pop_front(); }*/ st_synchronize(); + static uint8_t crashDet_counter = 0; + bool automatic_recovery_after_crash = true; + bool yesno; + + 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(); + } lcd_update_enable(true); lcd_implementation_clear(); @@ -694,17 +714,21 @@ void crashdet_detected(uint8_t mask) eeprom_update_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT, eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT) + 1); } -#ifdef AUTOMATIC_RECOVERY_AFTER_CRASH - bool yesno = true; -#else - bool yesno = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_CRASH_DETECTED), false); -#endif + + lcd_update_enable(true); lcd_update(2); lcd_setstatuspgm(_T(MSG_CRASH_DETECTED)); + gcode_G28(true, true, false, false); //home X and Y + st_synchronize(); + + if(automatic_recovery_after_crash) + yesno = true; + else + yesno = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Crash detected. Resume print?"), false); + lcd_update_enable(true); if (yesno) { - enquecommand_P(PSTR("G28 X Y")); enquecommand_P(PSTR("CRASH_RECOVER")); } else @@ -721,10 +745,15 @@ void crashdet_recover() void crashdet_cancel() { - card.sdprinting = false; - card.closefile(); tmc2130_sg_stop_on_crash = true; + if (saved_printing_type == PRINTING_TYPE_SD) { + lcd_print_stop(); + }else if(saved_printing_type == PRINTING_TYPE_USB){ + SERIAL_ECHOLNPGM("// action:cancel"); //for Octoprint: works the same as clicking "Abort" button in Octoprint GUI + SERIAL_PROTOCOLLNRPGM(_T(MSG_OK)); + } } + #endif //TMC2130 void failstats_reset_print() diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index aa1ee44f..f20290da 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -141,6 +141,7 @@ //#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line //#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message. //#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display. +//#define CMD_DIAGNOSTICS //Show cmd queue length on printer display #endif /* DEBUG_BUILD */ diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index fac638ba..7891b7a0 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -141,6 +141,7 @@ //#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line //#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message. //#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display. +//#define CMD_DIAGNOSTICS //Show cmd queue length on printer display #endif /* DEBUG_BUILD */ diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index cbf34cfa..38518935 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -112,8 +112,9 @@ #define Z_AXIS_ALWAYS_ON 1 -// Automatic recovery after crash is detected -#define AUTOMATIC_RECOVERY_AFTER_CRASH +//Crash detection +#define CRASHDET_TIMER 45 //seconds +#define CRASHDET_COUNTER_MAX 3 // New XYZ calibration #define NEW_XYZCAL @@ -177,6 +178,7 @@ #define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line #define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message. #define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display. +#define CMD_DIAGNOSTICS //Show cmd queue length on printer display #endif /* DEBUG_BUILD */ //#define EXPERIMENTAL_FEATURES