From 580d56bd371f25fb3648fc732abda111fba07cb1 Mon Sep 17 00:00:00 2001 From: Knutwurst <36196269+knutwurst@users.noreply.github.com> Date: Wed, 7 Jun 2023 16:16:06 +0200 Subject: [PATCH] Fix PowerOffFlag handling. --- Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp b/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp index 7b589525..751f439f 100755 --- a/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp +++ b/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp @@ -1970,7 +1970,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) { } #if ENABLED(KNUTWURST_4MAXP2) - if (PrintdoneAndPowerOFF && powerOFFflag && ((int(getActualTemp_celsius(E0)) + 0.5) < 50 )) { + if (PrintdoneAndPowerOFF && powerOFFflag && (thermalManager.degHotend(0) < 50 )) { powerOFFflag = 0; PowerDown(); } @@ -1991,6 +1991,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) { SENDLINE_DBG_PGM("J04", "TFT Serial Debug: Starting SD Print... soft endstops disabled J04"); // J04 Starting Print setSoftEndstopState(false); live_Zoffset = 0.0; + powerOFFflag = 0; } #endif } @@ -2010,6 +2011,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) { mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; mediaPauseState = AMPAUSESTATE_NOT_PAUSED; setSoftEndstopState(true); + powerOFFflag = 1; SENDLINE_DBG_PGM("J14", "TFT Serial Debug: SD Print Completed... soft endstops enabled J14"); } // otherwise it was stopped by the printer so don't send print completed signal to TFT