From 62fcc2ff35c8cc17649e079fb2a2c70d77ae2b80 Mon Sep 17 00:00:00 2001 From: Knutwurst <36196269+knutwurst@users.noreply.github.com> Date: Wed, 24 May 2023 19:22:58 +0200 Subject: [PATCH] Fix filament sensor, but disable host action commands. --- Marlin/Configuration.h | 10 +++++----- Marlin/Configuration_adv.h | 4 ++-- .../extui/knutwurst/anycubic_touchscreen.cpp | 18 ++++++++++-------- Marlin/src/pins/ramps/pins_RAMPS.h | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 1929421d..2d469dd7 100755 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2377,15 +2377,15 @@ * RAMPS-based boards use SERVO3_PIN for the first runout sensor. * For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc. */ -// #define FILAMENT_RUNOUT_SENSOR +#define FILAMENT_RUNOUT_SENSOR #if ENABLED(FILAMENT_RUNOUT_SENSOR) #define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500. #define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each. - #define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present. - #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. - // #define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. - // #define WATCH_ALL_RUNOUT_SENSORS // Execute runout script on any triggering sensor, not only for the active extruder. + #define FIL_RUNOUT_STATE HIGH // Pin state indicating that filament is NOT present. + // #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. + // #define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. + // #define WATCH_ALL_RUNOUT_SENSORS // Execute runout script on any triggering sensor, not only for the active extruder. // This is automatically enabled for MIXING_EXTRUDERs. // Override individually if the runout sensors vary diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 2e131097..fc1d4f2c 100755 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -4007,12 +4007,12 @@ * Host Prompt Support enables Marlin to use the host for user prompts so * filament runout and other processes can be managed from the host side. */ -#define HOST_ACTION_COMMANDS +//#define HOST_ACTION_COMMANDS #if ENABLED(HOST_ACTION_COMMANDS) #define HOST_PAUSE_M76 // Tell the host to pause in response to M76 #define HOST_PROMPT_SUPPORT // Initiate host prompts to get user feedback #if ENABLED(HOST_PROMPT_SUPPORT) - // #define HOST_STATUS_NOTIFICATIONS // Send some status messages to the host as notifications + #define HOST_STATUS_NOTIFICATIONS // Send some status messages to the host as notifications #endif // #define HOST_START_MENU_ITEM // Add a menu item that tells the host to start // #define HOST_SHUTDOWN_MENU_ITEM // Add a menu item that tells the host to shut down diff --git a/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp b/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp index 45c557a0..be49e312 100755 --- a/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp +++ b/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp @@ -214,16 +214,13 @@ LCD_SERIAL.begin(LCD_BAUDRATE); #if DISABLED(KNUTWURST_4MAXP2) - SENDLINE_PGM(""); - SENDLINE_PGM("J17"); // J17 Main board reset - delay(10); + SENDLINE_DBG_PGM("J17", "TFT Serial Debug: Main board reset... J17"); // J17 Main board reset + delay_ms(10); #endif mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; mediaPauseState = AMPAUSESTATE_NOT_PAUSED; - SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Ready... J12"); // J12 Ready - currentTouchscreenSelection[0] = 0; currentFileOrDirectory[0] = '\0'; SpecialMenu = false; @@ -239,6 +236,7 @@ #if BOTH(SDSUPPORT, HAS_SD_DETECT) SET_INPUT_PULLUP(SD_DETECT_PIN); #endif + #if ENABLED(FILAMENT_RUNOUT_SENSOR) SET_INPUT_PULLUP(FIL_RUNOUT1_PIN); #endif @@ -251,6 +249,10 @@ setup_OutageTestPin(); setup_PowerOffPin(); + SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Ready... J12"); // J12 Ready + + DoFilamentRunoutCheck(); + #ifdef STARTUP_CHIME BUZZ(100, 554); BUZZ(100, 740); @@ -545,7 +547,7 @@ || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_PAUSE_L)) != NULL) ) { SERIAL_ECHOLNPGM("Special Menu: Fil. Change Pause"); - ResumePrint(); + PausePrint(); } else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_RESUME_L)) != NULL) || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_RESUME_S)) != NULL) @@ -557,7 +559,7 @@ || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIS_FILSENS_S)) != NULL) ) { SERIAL_ECHOLNPGM("Special Menu: Disable Filament Sensor"); - + queue.inject_P(PSTR("M412 H0 S0\nM500")); BUZZ(105, 1108); BUZZ(105, 1108); BUZZ(105, 1108); @@ -566,7 +568,7 @@ || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_EN_FILSENS_S)) != NULL) ) { SERIAL_ECHOLNPGM("Special Menu: Enable Filament Sensor"); - + queue.inject_P(PSTR("M412 H0 S1\nM500")); BUZZ(105, 1108); BUZZ(105, 1108); } diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index 23565b4d..f7eade27 100755 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -288,7 +288,7 @@ // RAMPS 1.4 DIO 4 on the servos connector #ifndef FIL_RUNOUT_PIN - #define FIL_RUNOUT_PIN 4 + #define FIL_RUNOUT_PIN 19 #endif #ifndef PS_ON_PIN