From e20ee149b0505835ba3acb57a704ccceff505901 Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Wed, 31 Jan 2018 21:10:41 +0100 Subject: [PATCH] filament sensor additional check after runout (3mm back, 3mm forward @200mm/min) --- Firmware/fsensor.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index c69e5d16..ce5b4ad7 100644 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -4,8 +4,10 @@ #include "fsensor.h" #include "pat9125.h" +#include "stepper.h" #include "planner.h" #include "fastio.h" +#include "cmdqueue.h" //#include "LiquidCrystal.h" //extern LiquidCrystal lcd; @@ -257,15 +259,26 @@ void fsensor_update() if (!fsensor_enabled) return; if (fsensor_err_cnt > FSENSOR_ERR_MAX) { -// MYSERIAL.println("fsensor_update (fsensor_err_cnt > FSENSOR_ERR_MAX)"); -/* if (fsensor_ignore_error) + fsensor_stop_and_save_print(); + + fsensor_err_cnt = 0; + + enquecommand_front_P((PSTR("G1 E-3 F200"))); + process_commands(); + cmdqueue_pop_front(); + st_synchronize(); + + enquecommand_front_P((PSTR("G1 E3 F200"))); + process_commands(); + cmdqueue_pop_front(); + st_synchronize(); + + if (fsensor_err_cnt == 0) { - MYSERIAL.println("fsensor_update - error ignored)"); - fsensor_ignore_error = false; + fsensor_restore_print_and_continue(); } - else*/ + else { - fsensor_stop_and_save_print(); eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1); eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1); enquecommand_front_P((PSTR("M600")));