From b447245ddd1eb53eb381cb47d5bc3edbbd77b9b3 Mon Sep 17 00:00:00 2001 From: David Ramiro Date: Mon, 18 Feb 2019 19:34:59 +0100 Subject: [PATCH] Add screen state to gcode_M600() - Allowing resume after M600 via on screen button: - Adding check for TFT state status - Setting flag when print was started via TFT --- Marlin/AnycubicTFT.h | 6 +++--- Marlin/Marlin_main.cpp | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Marlin/AnycubicTFT.h b/Marlin/AnycubicTFT.h index ccc465b..227be08 100644 --- a/Marlin/AnycubicTFT.h +++ b/Marlin/AnycubicTFT.h @@ -55,6 +55,9 @@ public: void HeatingStart(); void FilamentRunout(); void KillTFT(); + char TFTstate=ANYCUBIC_TFT_STATE_IDLE; + bool PausedByRunout=false; + bool PausedByFilamentChange=false; private: char TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE]; @@ -64,7 +67,6 @@ private: char serial3_char; int serial3_count = 0; char *TFTstrchr_pointer; - char TFTstate=ANYCUBIC_TFT_STATE_IDLE; char FlagResumFromOutage=0; uint16_t filenumber=0; unsigned long starttime=0; @@ -72,8 +74,6 @@ private: uint8_t tmp_extruder=0; char LastSDstatus=0; uint16_t HeaterCheckCount=0; - bool PausedByRunout=false; - bool PausedByFilamentChange=false; struct OutageDataStruct { char OutageDataVersion; diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index e3e1dd7..3db125f 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -10992,6 +10992,12 @@ inline void gcode_M502() { * Default values are used for omitted arguments. */ inline void gcode_M600() { + #ifdef SDSUPPORT + if ((AnycubicTFT.TFTstate==ANYCUBIC_TFT_STATE_SDPRINT)){ + AnycubicTFT.TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; + AnycubicTFT.PausedByFilamentChange=true; + } + #endif point_t park_point = NOZZLE_PARK_POINT; if (get_target_extruder_from_command(600)) return;