Code cleanup.

This commit is contained in:
Knutwurst
2023-05-23 22:18:21 +02:00
parent a2137565e5
commit a019c471d1
3 changed files with 58 additions and 59 deletions

View File

@@ -2658,7 +2658,7 @@
*/ */
#define ADVANCED_PAUSE_FEATURE #define ADVANCED_PAUSE_FEATURE
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
#define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate. #define PAUSE_PARK_RETRACT_FEEDRATE 40 // (mm/s) Initial retract feedrate.
#define PAUSE_PARK_RETRACT_LENGTH 4 // (mm) Initial retract. #define PAUSE_PARK_RETRACT_LENGTH 4 // (mm) Initial retract.
// This short retract is done immediately, before parking the nozzle. // This short retract is done immediately, before parking the nozzle.
#define FILAMENT_CHANGE_UNLOAD_FEEDRATE 30 // (mm/s) Unload filament feedrate. This can be pretty fast. #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 30 // (mm/s) Unload filament feedrate. This can be pretty fast.

View File

@@ -25,22 +25,14 @@
#include <string.h> #include <string.h>
#include "../ui_api.h" #include "../ui_api.h"
#include "../../../inc/MarlinConfigPre.h"
#include "../../../gcode/queue.h" #include "../../../gcode/queue.h"
#include "../../../gcode/parser.h"
#include "../../../feature/e_parser.h"
#include "../../../feature/pause.h"
#include "../../../feature/bedlevel/bedlevel.h" #include "../../../feature/bedlevel/bedlevel.h"
#include "../../../libs/buzzer.h" #include "../../../libs/buzzer.h"
#include "../../../libs/numtostr.h" #include "../../../libs/numtostr.h"
#include "../../../module/planner.h"
#include "../../../module/printcounter.h"
#include "../../../module/temperature.h" #include "../../../module/temperature.h"
#include "../../../module/motion.h" #include "../../../module/motion.h"
#include "../../../module/probe.h"
#include "../../../module/settings.h" #include "../../../module/settings.h"
#include "../../../module/stepper.h" #include "../../../module/stepper.h"
//#include "../../../sd/cardreader.h"
#define ANYCUBIC_TFT_DEBUG #define ANYCUBIC_TFT_DEBUG
@@ -376,7 +368,7 @@
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
SENDLINE_DBG_PGM("J04", "TFT Serial Debug: SD print resumed... J04"); // J04 printing form sd card now SENDLINE_DBG_PGM("J04", "TFT Serial Debug: SD print resumed... J04"); // J04 printing form sd card now
setUserConfirmed(); setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT);
resumePrint(); resumePrint();
} }
#endif #endif
@@ -1127,56 +1119,62 @@
void AnycubicTouchscreenClass::UserConfirmRequired(const char * const msg) { void AnycubicTouchscreenClass::UserConfirmRequired(const char * const msg) {
#if ENABLED(ANYCUBIC_LCD_DEBUG) #if ENABLED(ANYCUBIC_LCD_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: OnUserConfirmRequired triggered... ", msg); SERIAL_ECHOLNPGM("TFT Serial Debug: OnUserConfirmRequired triggered... ", msg);
#endif #endif
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
/** /**
* Need to handle the process of following states * Need to handle the process of following states
* "Nozzle Parked" * "Nozzle Parked"
* "Load Filament" * "Load Filament"
* "Filament Purging..." * "Filament Purging..."
* "HeaterTimeout" * "HeaterTimeout"
* "Reheat finished." * "Reheat finished."
* *
* NOTE: The only way to handle these states is strcmp_P with the msg unfortunately (very expensive) * NOTE: The only way to handle these states is strcmp_P with the msg unfortunately (very expensive)
*/ */
if (strcmp_P(msg, PSTR("Nozzle Parked")) == 0) { if (strcmp_P(msg, PSTR("Nozzle Parked")) == 0) {
mediaPrintingState = AMPRINTSTATE_PAUSED; mediaPrintingState = AMPRINTSTATE_PAUSED;
mediaPauseState = AMPAUSESTATE_PARKED; mediaPauseState = AMPAUSESTATE_PARKED;
// enable continue button // enable continue button
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm SD print paused done... J18"); SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm SD print paused done... J18");
} }
else if (strcmp_P(msg, PSTR("Load Filament")) == 0) { else if (strcmp_P(msg, PSTR("Load Filament")) == 0) {
mediaPrintingState = AMPRINTSTATE_PAUSED; mediaPrintingState = AMPRINTSTATE_PAUSED;
mediaPauseState = AMPAUSESTATE_FILAMENT_OUT; mediaPauseState = AMPAUSESTATE_FILAMENT_OUT;
// enable continue button // enable continue button
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm Filament is out... J18"); SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm Filament is out... J18");
SENDLINE_DBG_PGM("J23", "TFT Serial Debug: UserConfirm Blocking filament prompt... J23"); SENDLINE_DBG_PGM("J23", "TFT Serial Debug: UserConfirm Blocking filament prompt... J23");
} }
else if (strcmp_P(msg, PSTR("Filament Purging...")) == 0) { else if (strcmp_P(msg, PSTR("Filament Purging...")) == 0) {
mediaPrintingState = AMPRINTSTATE_PAUSED; mediaPrintingState = AMPRINTSTATE_PAUSED;
mediaPauseState = AMPAUSESTATE_PARKING; mediaPauseState = AMPAUSESTATE_PARKING;
// TODO: JBA I don't think J05 just disables the continue button, i think it injects a rogue M25. So taking this out // TODO: JBA I don't think J05 just disables the continue button, i think it injects a rogue M25. So taking this out
// disable continue button // disable continue button
// SENDLINE_DBG_PGM("J05", "TFT Serial Debug: UserConfirm SD Filament Purging... J05"); // J05 printing pause // SENDLINE_DBG_PGM("J05", "TFT Serial Debug: UserConfirm SD Filament Purging... J05"); // J05 printing pause
// enable continue button // enable continue button
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm Filament is purging... J18"); SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm Filament is purging... J18");
} }
else if (strcmp_P(msg, PSTR("HeaterTimeout")) == 0) { else if (strcmp_P(msg, PSTR("HeaterTimeout")) == 0) {
mediaPrintingState = AMPRINTSTATE_PAUSED; mediaPrintingState = AMPRINTSTATE_PAUSED;
mediaPauseState = AMPAUSESTATE_HEATER_TIMEOUT; mediaPauseState = AMPAUSESTATE_HEATER_TIMEOUT;
// enable continue button // enable continue button
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm SD Heater timeout... J18"); SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm SD Heater timeout... J18");
} }
else if (strcmp_P(msg, PSTR("Reheat finished.")) == 0) { else if (strcmp_P(msg, PSTR("Reheat finished.")) == 0) {
mediaPrintingState = AMPRINTSTATE_PAUSED; mediaPrintingState = AMPRINTSTATE_PAUSED;
mediaPauseState = AMPAUSESTATE_REHEAT_FINISHED; mediaPauseState = AMPAUSESTATE_REHEAT_FINISHED;
// enable continue button // enable continue button
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm SD Reheat done... J18"); SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm SD Reheat done... J18");
} }
#endif else if (strcmp_P(msg, PSTR("Paused")) == 0) {
mediaPrintingState = AMPRINTSTATE_PAUSED;
mediaPauseState = AMPAUSESTATE_PAUSED;
// enable continue button
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm SD Reheat done... J18");
}
#endif
} }
static boolean TFTcomment_mode = false; static boolean TFTcomment_mode = false;

View File

@@ -72,7 +72,8 @@ enum AnycubicMediaPauseState {
AMPAUSESTATE_FILAMENT_PURGING, AMPAUSESTATE_FILAMENT_PURGING,
AMPAUSESTATE_HEATER_TIMEOUT, AMPAUSESTATE_HEATER_TIMEOUT,
AMPAUSESTATE_REHEATING, AMPAUSESTATE_REHEATING,
AMPAUSESTATE_REHEAT_FINISHED AMPAUSESTATE_REHEAT_FINISHED,
AMPAUSESTATE_PAUSED
}; };
#if DISABLED(KNUTWURST_DGUS2_TFT) #if DISABLED(KNUTWURST_DGUS2_TFT)