From 2f5bb80e98658b35953b97b315ddf183cd43569a Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 11 Jun 2018 15:34:16 +0200 Subject: [PATCH] crash detection: turn off nozzle when waiting for user --- .gitignore | 1 + Firmware/Marlin_main.cpp | 30 ++++++++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 98f5b0b1..53ad84b5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ Firmware/Doc /Firmware/Firmware.sln /Firmware/Firmware.vcxproj /Firmware/Firmware.vcxproj.filters +/Firmware/Firmware - Shortcut.lnk diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index a769536f..cb8d87b7 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -686,7 +686,6 @@ void crashdet_detected(uint8_t mask) st_synchronize(); static uint8_t crashDet_counter = 0; bool automatic_recovery_after_crash = true; - bool yesno; if (crashDet_counter++ == 0) { crashDetTimer.start(); @@ -727,18 +726,25 @@ void crashdet_detected(uint8_t mask) 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) - { + if (automatic_recovery_after_crash) { enquecommand_P(PSTR("CRASH_RECOVER")); - } - else - { - enquecommand_P(PSTR("CRASH_CANCEL")); + }else{ + HotendTempBckp = degTargetHotend(active_extruder); + setTargetHotend(0, active_extruder); + bool yesno = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Crash detected. Resume print?"), false); + lcd_update_enable(true); + if (yesno) + { + char cmd1[10]; + strcpy(cmd1, "M109 S"); + strcat(cmd1, ftostr3(HotendTempBckp)); + enquecommand(cmd1); + enquecommand_P(PSTR("CRASH_RECOVER")); + } + else + { + enquecommand_P(PSTR("CRASH_CANCEL")); + } } }