13 Commits

Author SHA1 Message Date
Knutwurst
b3f22b2b11 Bump builddate. 2023-05-28 17:29:59 +02:00
Knutwurst
bb8d41c0e1 Disable BLTouch Highspeed Mode by default (can be enabled via M401 S1) 2023-05-28 17:28:12 +02:00
Knutwurst
ae82913d1f Fix special menu not shown, when SD card is not inserted (Fix for #463) 2023-05-28 17:13:20 +02:00
Knutwurst
22dedaeb81 Use M600 for FilamentChange instead of regular pause() 2023-05-26 18:39:22 +02:00
Knutwurst
2b57ebccaa Add Heater Error Check. 2023-05-26 10:08:06 +02:00
Knutwurst
4a3071aa56 Some thermalManager substitutions. 2023-05-26 10:03:24 +02:00
Knutwurst
595bdd00cc Use ExtUI injectCommands() instead of queue.inject_P for PSTR. 2023-05-26 09:50:26 +02:00
Knutwurst
d5aa1e1823 Massive code cleanup by using internal ExtUI methods. 2023-05-25 21:06:45 +02:00
Knutwurst
570c419165 Use toolhead/nozzle paring position when aborting the SD print, instead of G28 homing. 2023-05-24 23:06:13 +02:00
Knutwurst
05a706dfb6 Fix print time display. 2023-05-24 22:38:14 +02:00
Knutwurst
7cc485ae3e Fix host action commands conflicting with integrated filament sensor 2023-05-24 19:36:20 +02:00
Knutwurst
5fbd3337b6 Disable Touchscreen debugging messages 2023-05-24 19:27:45 +02:00
Knutwurst
62fcc2ff35 Fix filament sensor, but disable host action commands. 2023-05-24 19:22:58 +02:00
6 changed files with 145 additions and 287 deletions

View File

@@ -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

View File

@@ -989,7 +989,7 @@
*
* Set the default state here, change with 'M401 S' or UI, use M500 to save, M502 to reset.
*/
#define BLTOUCH_HS_MODE true
#define BLTOUCH_HS_MODE false
// Safety: Enable voltage mode settings in the LCD menu.
// #define BLTOUCH_LCD_VOLTAGE_MENU
@@ -1551,7 +1551,7 @@
// #define MEDIA_MENU_AT_TOP // Force the media menu to be listed on the top of the main menu
#define EVENT_GCODE_SD_ABORT "G28XY" // G-code to run on SD Abort Print (e.g., "G28XY" or "G27")
#define EVENT_GCODE_SD_ABORT "G27" // G-code to run on SD Abort Print (e.g., "G28XY" or "G27")
#if ENABLED(PRINTER_EVENT_LEDS)
#define PE_LEDS_COMPLETED_TIME (30 * 60) // (seconds) Time to keep the LED "done" color before restoring normal illumination
@@ -4012,7 +4012,7 @@
#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

View File

@@ -252,12 +252,6 @@
#include "tests/marlin_tests.h"
#endif
// PATCH START: Knutwurst
#if ENABLED(ANYCUBIC_TOUCHSCREEN)
#include "lcd/extui/knutwurst/anycubic_touchscreen.h"
#endif
// PATCH END: Knutwurst
PGMSTR(M112_KILL_STR, "M112 Shutdown");
MarlinState marlin_state = MF_INITIALIZING;
@@ -396,88 +390,6 @@ void startOrResumeJob() {
#endif // SDSUPPORT
// PATCH START: Knutwurst
#ifdef ENDSTOP_BEEP
void EndstopBeep() {
static char last_status = ((READ(X_MIN_PIN) << 2) | (READ(Y_MIN_PIN) << 1) | READ(X_MAX_PIN));
static unsigned char now_status;
now_status = ((READ(X_MIN_PIN) << 2) | (READ(Y_MIN_PIN) << 1) | READ(X_MAX_PIN)) & 0xff;
if (now_status<last_status) {
static millis_t endstop_ms = millis() + 300UL;
if (ELAPSED(millis(), endstop_ms)) {
buzzer.tone(60, 2000);
}
last_status = now_status;
} else if (now_status != last_status) {
last_status=now_status;
}
}
#endif
#if HAS_FILAMENT_SENSOR
void event_filament_runout() {
#if ENABLED(ADVANCED_PAUSE_FEATURE)
if (did_pause_print) return; // Action already in progress. Purge triggered repeated runout.
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onFilamentRunout(ExtUI::getActiveTool());
#endif
#if EITHER(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS)
const char tool = '0'
#if NUM_RUNOUT_SENSORS > 1
+ active_extruder
#endif
;
#endif
//action:out_of_filament
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_reason = PROMPT_FILAMENT_RUNOUT;
host_action_prompt_end();
host_action_prompt_begin(PSTR("FilamentRunout T"), false);
SERIAL_CHAR(tool);
SERIAL_EOL();
host_action_prompt_show();
#endif
const bool run_runout_script = !runout.host_handling;
#if ENABLED(HOST_ACTION_COMMANDS)
if (run_runout_script
&& ( strstr(FILAMENT_RUNOUT_SCRIPT, "M600")
|| strstr(FILAMENT_RUNOUT_SCRIPT, "M125")
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|| strstr(FILAMENT_RUNOUT_SCRIPT, "M25")
#endif
)
) {
host_action_paused(false);
} else {
// Legacy Repetier command for use until newer version supports standard dialog
// To be removed later when pause command also triggers dialog
#ifdef ACTION_ON_FILAMENT_RUNOUT
host_action(PSTR(ACTION_ON_FILAMENT_RUNOUT " T"), false);
SERIAL_CHAR(tool);
SERIAL_EOL();
#endif
host_action_pause(false);
}
SERIAL_ECHOPGM(" " ACTION_REASON_ON_FILAMENT_RUNOUT " ");
SERIAL_CHAR(tool);
SERIAL_EOL();
#endif // HOST_ACTION_COMMANDS
if (run_runout_script) {
queue.inject_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
}
}
#endif // HAS_FILAMENT_SENSOR
// PATCH END: Knutwurst
/**
* Minimal management of Marlin's core activities:
@@ -493,12 +405,6 @@ void EndstopBeep() {
* - Pulse FET_SAFETY_PIN if it exists
*/
inline void manage_inactivity(const bool no_stepper_sleep=false) {
// PATCH START: Knutwurst
#if ENABLED(ANYCUBIC_TOUCHSCREEN) && ENABLED(ANYCUBIC_FILAMENT_RUNOUT_SENSOR)
AnycubicTouchscreen.FilamentRunout();
#endif
// PATCH END: Knutwurst
queue.get_available_commands();
const millis_t ms = millis();
@@ -889,12 +795,6 @@ void idle(bool no_stepper_sleep/*=false*/) {
// Max7219 heartbeat, animation, etc
TERN_(MAX7219_DEBUG, max7219.idle_tasks());
// PATCH START: Knutwurst
#ifdef ENDSTOP_BEEP
EndstopBeep();
#endif
// PATCH END: Knutwurst
// Return if setup() isn't completed
if (marlin_state == MF_INITIALIZING) goto IDLE_DONE;

View File

@@ -41,10 +41,10 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
#define CUSTOM_BUILD_VERSION "1.5.0-b4"
#define CUSTOM_BUILD_VERSION "1.5.0-b5"
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2023-05-24"
#define STRING_DISTRIBUTION_DATE "2023-05-28"
#endif
/**

View File

@@ -34,7 +34,7 @@
#include "../../../module/settings.h"
#include "../../../module/stepper.h"
#define ANYCUBIC_TFT_DEBUG
//#define ANYCUBIC_TFT_DEBUG
#ifdef ANYCUBIC_TOUCHSCREEN
#include "./anycubic_touchscreen.h"
@@ -166,42 +166,6 @@
#endif
}
char *itostr2(const uint8_t &x) {
int xx = x;
_conv[0] = (xx / 10) % 10 + '0';
_conv[1] = (xx) % 10 + '0';
_conv[2] = 0;
return _conv;
}
#ifndef ULTRA_LCD
#define DIGIT(n) ('0' + (n))
#define DIGIMOD(n, f) DIGIT((n) / (f) % 10)
#define RJDIGIT(n, f) ((n) >= (f) ? DIGIMOD(n, f) : ' ')
#define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-'))
char *itostr3(const int x) {
int xx = x;
_conv[4] = MINUSOR(xx, RJDIGIT(xx, 100));
_conv[5] = RJDIGIT(xx, 10);
_conv[6] = DIGIMOD(xx, 1);
return &_conv[4];
}
// Convert signed float to fixed-length string with 023.45 / -23.45 format
char *ftostr32(const float &x) {
long xx = x * 100;
_conv[1] = MINUSOR(xx, DIGIMOD(xx, 10000));
_conv[2] = DIGIMOD(xx, 1000);
_conv[3] = DIGIMOD(xx, 100);
_conv[4] = '.';
_conv[5] = DIGIMOD(xx, 10);
_conv[6] = DIGIMOD(xx, 1);
return &_conv[1];
}
#endif
using namespace ExtUI;
AnycubicTouchscreenClass::AnycubicTouchscreenClass() {
@@ -214,16 +178,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 +200,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 +213,12 @@
setup_OutageTestPin();
setup_PowerOffPin();
SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Ready... J12");
CheckHeaterError();
DoFilamentRunoutCheck();
#ifdef STARTUP_CHIME
BUZZ(100, 554);
BUZZ(100, 740);
@@ -345,7 +313,7 @@
#if ENABLED(SDSUPPORT)
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
if (READ(FIL_RUNOUT_PIN)) {
#if ENABLED(ANYCUBIC_LCD_DEBUG)
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: Resume Print with filament sensor still tripped... ");
#endif
@@ -392,7 +360,7 @@
void AnycubicTouchscreenClass::HandleSpecialMenu() {
#if ENABLED(KNUTWURST_SPECIAL_MENU)
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("DEBUG: Special Menu Selection: ", currentTouchscreenSelection);
SERIAL_ECHOPGM("TFT Serial Debug: Special Menu Selection: ", currentTouchscreenSelection);
SERIAL_EOL();
#endif
if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_SPECIAL_MENU_L)) != NULL)
@@ -406,19 +374,19 @@
SERIAL_ECHOLNPGM("Special Menu: PID Tune Hotend");
#if ANY(KNUTWURST_MEGA, KNUTWURST_MEGA_S, KNUTWURST_MEGA_P)
queue.inject_P(PSTR("G28\nG90\nG1 Z20\nG1 X110 Y110 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
injectCommands(F("G28\nG90\nG1 Z20\nG1 X110 Y110 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
#endif
#if ENABLED(KNUTWURST_MEGA_X)
queue.inject_P(PSTR("G28\nG90\nG1 Z20\nG1 X155 Y155 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
injectCommands(F("G28\nG90\nG1 Z20\nG1 X155 Y155 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
#endif
#if ENABLED(KNUTWURST_CHIRON)
queue.inject_P(PSTR("G28\nG90\nG1 Z20\nG1 X205 Y205 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
injectCommands(F("G28\nG90\nG1 Z20\nG1 X205 Y205 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
#endif
#if ENABLED(KNUTWURST_4MAXP2)
queue.inject_P(PSTR("G28\nG90\nG1 Z20\nG1 X105 Y135 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
injectCommands(F("G28\nG90\nG1 Z20\nG1 X105 Y135 F4000\nG1 Z5\nM106 S172\nG4 P500\nM303 E0 S215 C15 U1\nG4 P500\nM107\nG28\nG1 Z10\nM84\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
#endif
BUZZ(200, 1108);
@@ -430,7 +398,11 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_PID_BED_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: PID Tune Ultrabase");
queue.inject_P(PSTR("M303 E-1 S60 C6 U1\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
BUZZ(200, 1108);
BUZZ(200, 1661);
BUZZ(200, 1108);
BUZZ(600, 1661);
injectCommands(F("M303 E-1 S60 C6 U1\nM500\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300"));
BUZZ(200, 1108);
BUZZ(200, 1661);
BUZZ(200, 1108);
@@ -459,7 +431,7 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_PREHEAT_BED_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Preheat Ultrabase");
queue.inject_P(PSTR("M140 S60"));
injectCommands(F("M140 S60"));
}
#if NONE(KNUTWURST_BLTOUCH, KNUTWURST_TFT_LEVELING)
@@ -472,49 +444,49 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_MESH_START_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Start Mesh Leveling");
queue.inject_P(PSTR("G28\nG29 S1"));
injectCommands(F("G28\nG29 S1"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_MESH_NEXT_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_MESH_NEXT_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Next Mesh Point");
queue.inject_P(PSTR("G29 S2"));
injectCommands(F("G29 S2"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_UP_01_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_UP_01_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.1");
queue.inject_P(PSTR("G91\nG1 Z+0.1\nG90"));
injectCommands(F("G91\nG1 Z+0.1\nG90"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_DN_01_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_DN_01_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.1");
queue.inject_P(PSTR("G91\nG1 Z-0.1\nG90"));
injectCommands(F("G91\nG1 Z-0.1\nG90"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_UP_002_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_UP_002_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.02");
queue.inject_P(PSTR("G91\nG1 Z+0.02\nG90"));
injectCommands(F("G91\nG1 Z+0.02\nG90"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_DN_002_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_DN_002_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.02");
queue.inject_P(PSTR("G91\nG1 Z-0.02\nG90"));
injectCommands(F("G91\nG1 Z-0.02\nG90"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_UP_001_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_UP_001_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.01");
queue.inject_P(PSTR("G91\nG1 Z+0.03\nG4 P250\nG1 Z-0.02\nG90"));
injectCommands(F("G91\nG1 Z+0.03\nG4 P250\nG1 Z-0.02\nG90"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_DN_001_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_Z_DN_001_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.01");
queue.inject_P(PSTR("G91\nG1 Z+0.02\nG4 P250\nG1 Z-0.03\nG90"));
injectCommands(F("G91\nG1 Z+0.02\nG4 P250\nG1 Z-0.03\nG90"));
}
#endif // if NONE(KNUTWURST_BLTOUCH, KNUTWURST_TFT_LEVELING)
@@ -523,7 +495,7 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_BLTOUCH_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: BLTouch Leveling");
queue.inject_P(PSTR("G28\nG29\nM500\nG90\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300\nG1 Z30 F4000\nG1 X0 F4000\nG91\nM84\nM420 S1"));
injectCommands(F("G28\nG29\nM500\nG90\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300\nG1 Z30 F4000\nG1 X0 F4000\nG91\nM84\nM420 S1"));
BUZZ(105, 1108);
BUZZ(210, 1661);
}
@@ -545,7 +517,7 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_PAUSE_L)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Fil. Change Pause");
ResumePrint();
injectCommands(F("M600"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_RESUME_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_RESUME_S)) != NULL)
@@ -557,7 +529,7 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIS_FILSENS_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Disable Filament Sensor");
injectCommands(F("M412 H0 S0\nM500"));
BUZZ(105, 1108);
BUZZ(105, 1108);
BUZZ(105, 1108);
@@ -566,7 +538,7 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_EN_FILSENS_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Enable Filament Sensor");
injectCommands(F("M412 H0 S1\nM500"));
BUZZ(105, 1108);
BUZZ(105, 1108);
}
@@ -654,32 +626,32 @@
) {
SERIAL_ECHOLNPGM("Special Menu: Enter Easy Level Menu");
LevelMenu = true;
queue.inject_P(PSTR("G28\nM420 S0\nG90\nG1 Z5\nG1 X15 Y15 F4000\nG1 Z0"));
injectCommands(F("G28\nM420 S0\nG90\nG1 Z5\nG1 X15 Y15 F4000\nG1 Z0"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_P1_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_P1_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Easy Level POINT 1");
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X15 Y15 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X15 Y15 F4000\nG1 Z0"));
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_P2_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_P2_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: Easy Level POINT 2");
#if ANY(KNUTWURST_MEGA, KNUTWURST_MEGA_S, KNUTWURST_MEGA_P)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X205 Y15 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X205 Y15 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_MEGA_X)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X295 Y15 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X295 Y15 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_CHIRON)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X385 Y15 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X385 Y15 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_4MAXP2)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X255 Y15 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X255 Y15 F4000\nG1 Z0"));
#endif
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_P3_L)) != NULL)
@@ -687,19 +659,19 @@
) {
SERIAL_ECHOLNPGM("Special Menu: Easy Level POINT 3");
#if ANY(KNUTWURST_MEGA, KNUTWURST_MEGA_S, KNUTWURST_MEGA_P)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X205 Y200 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X205 Y200 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_MEGA_X)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X295 Y295 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X295 Y295 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_CHIRON)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X395 Y395 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X395 Y395 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_4MAXP2)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X255 Y195 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X255 Y195 F4000\nG1 Z0"));
#endif
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_P4_L)) != NULL)
@@ -707,19 +679,19 @@
) {
SERIAL_ECHOLNPGM("Special Menu: Easy Level POINT 4");
#if ANY(KNUTWURST_MEGA, KNUTWURST_MEGA_S, KNUTWURST_MEGA_P)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X15 Y200 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X15 Y200 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_MEGA_X)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X15 Y295 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X15 Y295 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_CHIRON)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X15 Y395 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X15 Y395 F4000\nG1 Z0"));
#endif
#if ENABLED(KNUTWURST_4MAXP2)
queue.inject_P(PSTR("G90\nG1 Z5\nG1 X15 Y195 F4000\nG1 Z0"));
injectCommands(F("G90\nG1 Z5\nG1 X15 Y195 F4000\nG1 Z0"));
#endif
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_EXIT_L)) != NULL)
@@ -727,7 +699,7 @@
) {
SERIAL_ECHOLNPGM("Special Menu: Exit Easy Level Menu");
LevelMenu = false;
queue.inject_P(PSTR("G90\nG1 Z10\nG1 X15 Y15 F4000\nM420 S1"));
injectCommands(F("G90\nG1 Z10\nG1 X15 Y15 F4000\nM420 S1"));
}
#endif // if ENABLED(KNUTWURST_SPECIAL_MENU)
}
@@ -794,7 +766,7 @@
zOffsetBuffer = SM_BLTZ_DISP_L;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("DEBUG: Current probe.offset.z: ", float(probe.offset.z));
SERIAL_ECHOPGM("TFT Serial Debug: Current probe.offset.z: ", float(probe.offset.z));
SERIAL_EOL();
#endif
@@ -1078,7 +1050,8 @@
}
void AnycubicTouchscreenClass::CheckHeaterError() {
if ((thermalManager.degHotend(0) < 5) || (thermalManager.degHotend(0) > 300)) {
if ( (getTargetTemp_celsius((extruder_t)E0) < 5)
|| (getTargetTemp_celsius((extruder_t)E0) > 300)) {
if (HeaterCheckCount > 600000) {
HeaterCheckCount = 0;
SENDLINE_DBG_PGM("J10", "TFT Serial Debug: Hotend temperature abnormal... J10");
@@ -1120,7 +1093,7 @@
}
void AnycubicTouchscreenClass::UserConfirmRequired(const char * const msg) {
#if ENABLED(ANYCUBIC_LCD_DEBUG)
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: OnUserConfirmRequired triggered... ", msg);
#endif
@@ -1151,10 +1124,6 @@
else if (strcmp_P(msg, PSTR("Filament Purging...")) == 0) {
mediaPrintingState = AMPRINTSTATE_PAUSED;
mediaPauseState = AMPAUSESTATE_FILAMENT_PURGING;
// 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
// SENDLINE_DBG_PGM("J05", "TFT Serial Debug: UserConfirm SD Filament Purging... J05"); // J05 printing pause
// enable continue button
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm Filament is purging... J18");
@@ -1233,30 +1202,23 @@
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindw], 'A');
switch ((int)((strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], NULL)))) {
case 0: // A0 GET HOTEND TEMP
SEND_PGM_VAL("A0V ", int(thermalManager.degHotend(0) + 0.5));
SEND_PGM_VAL("A0V ", int(getActualTemp_celsius(E0) + 0.5));
break;
case 1: // A1 GET HOTEND TARGET TEMP
SEND_PGM_VAL("A1V ", int(thermalManager.degTargetHotend(0) + 0.5));
SEND_PGM_VAL("A1V ", int(getTargetTemp_celsius(E0) + 0.5));
break;
case 2: // A2 GET HOTBED TEMP
SEND_PGM_VAL("A2V ", int(thermalManager.degBed() + 0.5));
SEND_PGM_VAL("A2V ", int(getActualTemp_celsius(BED) + 0.5));
break;
case 3: // A3 GET HOTBED TARGET TEMP
SEND_PGM_VAL("A3V ", int(thermalManager.degTargetBed() + 0.5));
SEND_PGM_VAL("A3V ", int(getTargetTemp_celsius(BED) + 0.5));
break;
case 4: // A4 GET FAN SPEED
{
unsigned int temp;
temp = ((thermalManager.fan_speed[0] * 100) / 255);
temp = constrain(temp, 0, 100);
SEND_PGM_VAL("A4V ", temp);
}
SEND_PGM_VAL("A4V ", int(getActualFan_percent(FAN0)));
break;
case 5: // A5 GET CURRENT COORDINATE
SEND_PGM("A5V X: "); LCD_SERIAL.print(current_position[X_AXIS]);
@@ -1267,27 +1229,28 @@
case 6: // A6 GET SD CARD PRINTING STATUS
#ifdef SDSUPPORT
if (card.isPrinting()) {
if (isPrintingFromMedia())
{
SEND_PGM("A6V ");
if (card.isMounted())
SENDLINE(itostr3(card.percentDone()));
if (isMediaInserted())
SENDLINE(ui8tostr3rj(getProgress_percent()));
else
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: SD Card initialized... J02");
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to return printing status... J02");
}
else {
else
SENDLINE_PGM("A6V ---");
}
#endif
break;
case 7: // A7 GET PRINTING TIME
{
const uint32_t elapsedSeconds = getProgress_seconds_elapsed();
SEND_PGM("A7V ");
if (starttime != 0) { // print time
uint16_t time = millis() / 60000 - starttime / 60000;
SEND(itostr2(time / 60));
if (elapsedSeconds != 0) { // print time
const uint32_t elapsedMinutes = elapsedSeconds / 60;
SEND(ui8tostr2(elapsedMinutes / 60));
SEND_PGM(" H ");
SEND(itostr2(time % 60));
SEND_PGM(" M");
SEND(ui8tostr2(elapsedMinutes % 60));
SENDLINE_PGM(" M");
}
else
SENDLINE_PGM(" 999:999");
@@ -1338,27 +1301,29 @@
case 13: // A13 SELECTION FILE
#if ENABLED(SDSUPPORT)
if (isMediaInserted()) {
{
starpos = (strchr(TFTstrchr_pointer + 4, '*'));
if (TFTstrchr_pointer[4] == '/') {
strcpy(currentTouchscreenSelection, TFTstrchr_pointer + 5);
currentFileOrDirectory[0] = 0;
SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected
SENDLINE_PGM("");
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("TFT Serial Debug: currentTouchscreenSelection: ", currentTouchscreenSelection);
SERIAL_EOL();
#endif
}
else if (TFTstrchr_pointer[4] == '<') {
strcpy(currentTouchscreenSelection, TFTstrchr_pointer + 4);
SpecialMenu = true;
currentFileOrDirectory[0] = 0;
SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected
SENDLINE_PGM("");
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("J21", "TFT Serial Debug: Clear file selection... J21 ");
SERIAL_EOL();
#endif
}
else {
currentTouchscreenSelection[0] = 0;
if (SpecialMenu == false)
currentTouchscreenSelection[0] = 0;
if (starpos) *(starpos - 1) = '\0';
strcpy(currentFileOrDirectory, TFTstrchr_pointer + 4);
if (starpos != NULL) *(starpos - 1) = '\0';
strcpy(currentFileOrDirectory, TFTstrchr_pointer + 4);
SENDLINE_DBG_PGM_VAL("J20", "TFT Serial Debug: File Selected... J20 ", currentFileOrDirectory); // J20 File Selected
}
}
@@ -1389,14 +1354,14 @@
unsigned int tempvalue;
if (CodeSeen('S')) {
tempvalue = constrain(CodeValue(), 0, 260);
if (thermalManager.degTargetHotend(0) <= 260)
thermalManager.setTargetHotend(tempvalue, 0); // do not set Temp from TFT if it is set via gcode
if (getTargetTemp_celsius((extruder_t)E0) <= 260)
setTargetTemp_celsius(tempvalue, (extruder_t)E0);; // do not set Temp from TFT if it is set via gcode
}
else if ((CodeSeen('C')) && (!planner.movesplanned())) {
if ((current_position[Z_AXIS] < 10))
queue.inject_P(PSTR("G1 Z10")); // RASE Z AXIS
else if ((CodeSeen('C')) && (!isPrinting())) {
if ((getAxisPosition_mm(Z) < 10))
injectCommands(F("G1 Z10")); // RASE Z AXIS
tempvalue = constrain(CodeValue(), 0, 260);
thermalManager.setTargetHotend(tempvalue, 0);
setTargetTemp_celsius(tempvalue, (extruder_t)E0);
}
}
break;
@@ -1405,36 +1370,33 @@
{
unsigned int tempbed;
if (CodeSeen('S')) {
tempbed = constrain(CodeValue(), 0, 115);
thermalManager.setTargetBed(tempbed);
if (thermalManager.degTargetBed() <= 100)
thermalManager.setTargetBed(tempbed); // do not set Temp from TFT if it is set via gcode
tempbed = constrain(CodeValue(), 0, 120);
if (getTargetTemp_celsius((heater_t)BED) <= 100)
setTargetTemp_celsius(tempbed, (heater_t)BED); // do not set Temp from TFT if it is set via gcode
}
}
break;
case 18: // A18 set fan speed
unsigned int temp;
float fanPercent;
if (CodeSeen('S')) {
temp = (CodeValue() * 255 / 100);
temp = constrain(temp, 0, 255);
thermalManager.set_fan_speed(0, temp);
fanPercent = CodeValue();
fanPercent = constrain(fanPercent, 0, 100);
setTargetFan_percent(fanPercent, FAN0);
}
else {
thermalManager.set_fan_speed(0, 255);
fanPercent = 100;
setTargetFan_percent(fanPercent, FAN0);
}
SENDLINE_PGM("");
break;
case 19: // A19 stop stepper drivers
if ((!planner.movesplanned())
#ifdef SDSUPPORT
&& (!card.isPrinting())
#endif
) {
if (!isPrinting()) {
quickstop_stepper();
stepper.disable_all_steppers();
}
SENDLINE_PGM("");
break;
@@ -1550,55 +1512,51 @@
break;
case 26: // A26 refresh SD
{
#ifdef SDSUPPORT
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM(" TFT Serial Debug: currentTouchscreenSelection: ", currentTouchscreenSelection);
SERIAL_ECHOPGM("TFT Serial Debug: currentTouchscreenSelection: ", currentTouchscreenSelection);
SERIAL_EOL();
#endif
if (isMediaInserted()) {
if (strlen(currentTouchscreenSelection) > 0) {
FileList currentFileList;
if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIR_UP_S)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIR_UP_L)) != NULL)
) {
if (strlen(currentTouchscreenSelection) > 0) {
FileList currentFileList;
if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIR_UP_S)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIR_UP_L)) != NULL)
) {
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Directory UP (cd ..)");
#endif
currentFileList.upDir();
}
else {
if (currentTouchscreenSelection[0] == '<') {
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Directory UP (cd ..)");
SERIAL_ECHOLNPGM("TFT Serial Debug: Enter Special Menu");
#endif
currentFileList.upDir();
HandleSpecialMenu();
}
else {
if (currentTouchscreenSelection[0] == '<') {
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Enter Special Menu");
#endif
HandleSpecialMenu();
}
else {
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Not a menu. Must be a directory!");
#endif
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Not a menu. Must be a directory!");
#endif
#if ENABLED(KNUTWURST_DGUS2_TFT)
strcpy(currentFileOrDirectory, currentTouchscreenSelection);
int currentFileLen = strlen(currentFileOrDirectory);
currentFileOrDirectory[currentFileLen - 4] = '\0';
card.cd(currentFileOrDirectory);
#else
currentFileList.changeDir(currentTouchscreenSelection);
#endif
}
#if ENABLED(KNUTWURST_DGUS2_TFT)
strcpy(currentFileOrDirectory, currentTouchscreenSelection);
int currentFileLen = strlen(currentFileOrDirectory);
currentFileOrDirectory[currentFileLen - 4] = '\0';
card.cd(currentFileOrDirectory);
#else
currentFileList.changeDir(currentTouchscreenSelection);
#endif
}
}
}
if (SpecialMenu == false)
currentTouchscreenSelection[0] = 0;
}
#endif // ifdef SDSUPPORT
break;
#ifdef SERVO_ENDSTOPS
case 27: // A27 servos angles adjust
break;
#endif
case 28: // A28 filament test
{
@@ -1630,7 +1588,7 @@
if (!isPrinting()) {
if (!all_axes_trusted()) {
queue.inject_P(PSTR("G28\n"));
injectCommands(F("G28\n"));
/*
set_axis_is_at_home(X_AXIS);
sync_plan_position();
@@ -1774,12 +1732,12 @@
case 42:
if (CaseLight == true) {
SERIAL_ECHOLNPGM("Case Light OFF");
queue.inject_P(PSTR("M355 S1 P0"));
injectCommands(F("M355 S1 P0"));
CaseLight = false;
}
else {
SERIAL_ECHOLNPGM("Case Light ON");
queue.inject_P(PSTR("M355 S1 P255"));
injectCommands(F("M355 S1 P255"));
CaseLight = true;
}
// break; <-- TODO: do we need it?
@@ -1990,7 +1948,7 @@
if (ELAPSED(ms, nextStopCheck)) {
nextStopCheck = ms + 1000UL;
if (mediaPrintingState == AMPRINTSTATE_STOP_REQUESTED) {
#if ENABLED(ANYCUBIC_LCD_DEBUG)
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: Finished stopping print, releasing motors ...");
#endif
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;

View File

@@ -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