From 186f8816000f0c8632fe3c8cfe0aac8c0b13d4b1 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sun, 29 Dec 2019 22:08:44 +0100 Subject: [PATCH] Avoid calling fsensor_update() one level earlier Move the common checks between filament sensors out of fsensor_update(). Disable the runout check if a saved state is already present (this check was missing in the PAT9125 variant) as this is currently not supported. Note that the CHECK_FSENSOR looks completely redundant besides e_active(). --- Firmware/Marlin_main.cpp | 3 ++- Firmware/fsensor.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 4970091e..fc395900 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8606,7 +8606,8 @@ if(0) #ifdef PAT9125 fsensor_autoload_check_stop(); #endif //PAT9125 - fsensor_update(); + if (fsensor_enabled && !saved_printing) + fsensor_update(); } } } diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index 0113317e..a7dbce97 100755 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -576,7 +576,7 @@ void fsensor_enque_M600(){ void fsensor_update(void) { #ifdef PAT9125 - if (fsensor_enabled && fsensor_watch_runout && (fsensor_err_cnt > FSENSOR_ERR_MAX)) + if (fsensor_watch_runout && (fsensor_err_cnt > FSENSOR_ERR_MAX)) { fsensor_stop_and_save_print(); KEEPALIVE_STATE(IN_HANDLER); @@ -621,7 +621,7 @@ void fsensor_update(void) fsensor_enque_M600(); } #else //PAT9125 - if (CHECK_FSENSOR && fsensor_enabled && ir_sensor_detected) + if (CHECK_FSENSOR && ir_sensor_detected) { if(digitalRead(IR_SENSOR_PIN)) { // IR_SENSOR_PIN ~ H