32 Commits

Author SHA1 Message Date
Knutwurst
c83dad91f3 Z2 Stepper pin definitions for CHIRON and 4MAX. 2023-05-30 22:10:31 +02:00
Knutwurst
429b8cc1fa Fix warnings in 4MAX Build 2023-05-30 22:00:27 +02:00
Knutwurst
2e030524e2 Disable debug output. 2023-05-30 21:18:41 +02:00
Knutwurst
45cbc380d9 Update build date. 2023-05-30 19:26:27 +02:00
Knutwurst
cf0611a7d9 Use const char* because it's not altered past that point. 2023-05-30 17:33:39 +02:00
Knutwurst
9c4c58235b Fix compiler warnings for Chiron build and Directory selection on Anycubic 1.0 displays. 2023-05-30 16:46:30 +02:00
Knutwurst
75ffa32980 Use SENDLINE instead of SEND to create directory name on anycubic 1.0 display. 2023-05-30 16:07:26 +02:00
Knutwurst
e0d858d812 Fix misuse of const char pointer by creating a new string which represents the filename. 2023-05-30 15:09:46 +02:00
Knutwurst
ad86d96a31 Cleanup 2023-05-30 09:22:25 +02:00
Knutwurst
6c4a0a887a Remove old PrintList() implementation + some cleanup 2023-05-29 20:48:58 +02:00
Knutwurst
e940c218cd Do not remove current selection if Special Menu is enabled, so items can be tapped multiple times. 2023-05-29 20:40:27 +02:00
Knutwurst
1df0ee59d2 Set correct filament sensor pins for chiron in correspondig header and enable new file list implementation. 2023-05-29 20:34:08 +02:00
Knutwurst
9244ea5890 New file list render implementation - WIP! 2023-05-29 20:07:06 +02:00
Knutwurst
8e34d7dc7c Fix 4MAXP2 Build. 2023-05-29 19:27:55 +02:00
Knutwurst
7fbbbba752 Fix Typo 2023-05-29 14:20:28 +02:00
Knutwurst
2b5816037a Add custom M600 configuration for DirectExtruder 4MAX Pro 2.0. 2023-05-29 12:35:07 +02:00
Knutwurst
e008a96269 Fix Chiron and 4MAX Pro 2.0 Filament rundout sensor. 2023-05-29 11:39:00 +02:00
Knutwurst
952e0db31e Fix that you could not get out of a selected directory. Refactor Touchscreen file handling. 2023-05-29 11:20:22 +02:00
Knutwurst
69efa3376a Set lowest point for BLTouch from 2 to 10 mm. 2023-05-28 22:57:50 +02:00
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
10 changed files with 389 additions and 457 deletions

View File

@@ -1939,7 +1939,7 @@
#define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes
// #define Z_AFTER_PROBING 5 // Z position after probing is done
#define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping
#define Z_PROBE_LOW_POINT -10 // Farthest distance below the trigger-point to go before stopping
// For M851 give a range for adjusting the Z probe offset
#define Z_PROBE_OFFSET_RANGE_MIN -50
@@ -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
@@ -2658,29 +2658,51 @@
*/
#define ADVANCED_PAUSE_FEATURE
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#define PAUSE_PARK_RETRACT_FEEDRATE 40 // (mm/s) Initial retract feedrate.
#define PAUSE_PARK_RETRACT_LENGTH 4 // (mm) Initial retract.
// 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_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate.
#define FILAMENT_CHANGE_UNLOAD_LENGTH 555 // (mm) The length of filament for a complete unload.
// For Bowden, the full length of the tube and nozzle.
// For direct drive, the full length of the nozzle.
// Set to 0 for manual unloading.
#define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load.
#define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material.
// 0 to disable start loading and skip to fast load only
#define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 30 // (mm/s) Load filament feedrate. This can be pretty fast.
#define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate.
#define FILAMENT_CHANGE_FAST_LOAD_LENGTH 538 // (mm) Load length of filament, from extruder gear to nozzle.
// For Bowden, the full length of the tube and nozzle.
// For direct drive, the full length of the nozzle.
#if DISABLED(KNUTWURST_4MAXP2)
#define PAUSE_PARK_RETRACT_FEEDRATE 40 // (mm/s) Initial retract feedrate.
#define PAUSE_PARK_RETRACT_LENGTH 4 // (mm) Initial retract.
// 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_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate.
#define FILAMENT_CHANGE_UNLOAD_LENGTH 555 // (mm) The length of filament for a complete unload.
// For Bowden, the full length of the tube and nozzle.
// For direct drive, the full length of the nozzle.
// Set to 0 for manual unloading.
#define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load.
#define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material.
// 0 to disable start loading and skip to fast load only
#define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 30 // (mm/s) Load filament feedrate. This can be pretty fast.
#define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate.
#define FILAMENT_CHANGE_FAST_LOAD_LENGTH 538 // (mm) Load length of filament, from extruder gear to nozzle.
// For Bowden, the full length of the tube and nozzle.
// For direct drive, the full length of the nozzle.
#else
#define PAUSE_PARK_RETRACT_FEEDRATE 40 // (mm/s) Initial retract feedrate.
#define PAUSE_PARK_RETRACT_LENGTH 1 // (mm) Initial retract.
// This short retract is done immediately, before parking the nozzle.
#define FILAMENT_CHANGE_UNLOAD_FEEDRATE 0 // (mm/s) Unload filament feedrate. This can be pretty fast.
#define FILAMENT_CHANGE_UNLOAD_ACCEL 30 // (mm/s^2) Lower acceleration may allow a faster feedrate.
#define FILAMENT_CHANGE_UNLOAD_LENGTH 0 // (mm) The length of filament for a complete unload.
// For Bowden, the full length of the tube and nozzle.
// For direct drive, the full length of the nozzle.
// Set to 0 for manual unloading.
#define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load.
#define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material.
// 0 to disable start loading and skip to fast load only
#define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 30 // (mm/s) Load filament feedrate. This can be pretty fast.
#define FILAMENT_CHANGE_FAST_LOAD_ACCEL 10 // (mm/s^2) Lower acceleration may allow a faster feedrate.
#define FILAMENT_CHANGE_FAST_LOAD_LENGTH 5 // (mm) Load length of filament, from extruder gear to nozzle.
// For Bowden, the full length of the tube and nozzle.
// For direct drive, the full length of the nozzle.
#endif
#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted.
#define ADVANCED_PAUSE_PURGE_FEEDRATE 2 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate.
#define ADVANCED_PAUSE_PURGE_LENGTH 2 // (mm) Length to extrude after loading.
// Set to 0 for manual extrusion.
// Filament can be extruded repeatedly from the Filament Change menu
// until extrusion is consistent, and to purge old filament.
// #define ADVANCED_PAUSE_RESUME_PRIME 0 // (mm) Extra distance to prime nozzle after returning from park.
#define ADVANCED_PAUSE_FANS_PAUSE // Turn off print-cooling fans while the machine is paused.
@@ -4012,7 +4034,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-b6"
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2023-05-24"
#define STRING_DISTRIBUTION_DATE "2023-05-30"
#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"
@@ -84,6 +84,8 @@
*value = c;
pos++;
value++;
if(pos > 32766)
break;
} while (--size);
}
@@ -166,42 +168,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 +180,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;
@@ -232,13 +195,13 @@
BLTouchMenu = false;
LevelMenu = false;
CaseLight = false;
MyFileNrCnt = 0;
currentFlowRate = 100;
flowRateBuffer = SM_FLOW_DISP_L;
#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 +214,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 +314,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 +361,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 +375,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 +399,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 +432,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 +445,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 +496,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 +518,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 +530,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 +539,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 +627,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 +660,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 +680,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,16 +700,48 @@
) {
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)
}
void AnycubicTouchscreenClass::PrintList() {
#if ENABLED(KNUTWURST_SPECIAL_MENU)
void AnycubicTouchscreenClass::RenderCurrentFileList() {
uint16_t selectedNumber = 0;
FileList currentFileList;
currentFileOrDirectory[0] = 0;
if (SpecialMenu == false) {
currentTouchscreenSelection[0] = 0;
}
SENDLINE_PGM("FN "); // Filelist start
if (!isMediaInserted() && !SpecialMenu) {
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to render Current File List... J02");
SENDLINE_PGM(SM_SPECIAL_MENU_S);
SENDLINE_PGM(SM_SPECIAL_MENU_L);
}
else {
if (CodeSeen('S')) {
selectedNumber = CodeValue();
}
if (SpecialMenu) {
RenderSpecialMenu(selectedNumber);
} else if (selectedNumber <= currentFileList.count()) {
RenderCurrentFolder(selectedNumber);
}
}
SENDLINE_PGM("END"); // Filelist stop
}
void AnycubicTouchscreenClass::RenderSpecialMenu(uint16_t selectedNumber) {
#if ENABLED(KNUTWURST_SPECIAL_MENU)
if (MMLMenu) {
switch (filenumber) {
switch (selectedNumber) {
case 0: // Page 1
SENDLINE_PGM(SM_MESH_START_S);
SENDLINE_PGM(SM_MESH_START_L);
@@ -774,7 +779,7 @@
flowRateBuffer = SM_FLOW_DISP_L;
flowRateBuffer.replace("XXX", String(currentFlowRate));
switch (filenumber) {
switch (selectedNumber) {
case 0: // Page 1
SENDLINE_PGM(SM_FLOW_DISP_S);
SENDLINE(flowRateBuffer.c_str());
@@ -794,13 +799,13 @@
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
zOffsetBuffer.replace("XXXXX", String(float(probe.offset.z)));
switch (filenumber) {
switch (selectedNumber) {
case 0: // Page 1
SENDLINE_PGM(SM_BLTZ_DISP_S);
SENDLINE(zOffsetBuffer.c_str());
@@ -822,7 +827,7 @@
}
}
else if (LevelMenu) {
switch (filenumber) {
switch (selectedNumber) {
case 0: // Page 1
SENDLINE_PGM(SM_EZLVL_P1_S);
SENDLINE_PGM(SM_EZLVL_P1_L);
@@ -844,7 +849,7 @@
}
}
else if (SpecialMenu) {
switch (filenumber) {
switch (selectedNumber) {
case 0: // Page 1
SENDLINE_PGM(SM_FLOWMENU_S);
SENDLINE_PGM(SM_FLOWMENU_L);
@@ -916,141 +921,136 @@
}
}
#endif // if ENABLED(KNUTWURST_SPECIAL_MENU)
}
#ifdef SDSUPPORT
#if ENABLED(KNUTWURST_SPECIAL_MENU)
else if (card.isMounted())
#else
if (card.isMounted())
#endif
{
int count = filenumber;
int max_files;
int filesOnSDCard = card.countFilesInWorkDir();
void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
FileList currentFileList;
uint16_t count = selectedNumber;
uint16_t max_files;
uint16_t filesOnSDCard = currentFileList.count();
if ((filesOnSDCard - filenumber) < 4) {
max_files = filesOnSDCard;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLN("max_files = filesOnSDCard;");
#endif
}
else {
max_files = filenumber + 3;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLN("max_files = filenumber + 3;");
#endif
}
if ((filesOnSDCard - selectedNumber) < 4) {
max_files = filesOnSDCard;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLN("max_files = filesOnSDCard;");
#endif
} else {
max_files = selectedNumber + 3;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLN("max_files = filenumber + 3;");
#endif
}
if (filesOnSDCard == 3) filenumber = 0;
if (filesOnSDCard == 3) filenumber = 0;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("filesOnSDCard: ");
SERIAL_ECHOLN(filesOnSDCard);
SERIAL_ECHOPGM("filenumber: ");
SERIAL_ECHOLN(filenumber);
SERIAL_ECHOPGM("max_files: ");
SERIAL_ECHOLN(max_files);
SERIAL_ECHOPGM("count: ");
SERIAL_ECHOLN(count);
#endif
for (count = filenumber; count <= max_files; count++) {
if (count == 0) { // Special Entry
if (strcmp(card.getWorkDirName(), "/") == 0) {
SENDLINE_PGM(SM_SPECIAL_MENU_S);
SENDLINE_PGM(SM_SPECIAL_MENU_L);
SERIAL_ECHO(count);
SERIAL_ECHO(": ");
SERIAL_ECHOLNPGM(SM_SPECIAL_MENU_L);
}
else {
SENDLINE_PGM(SM_DIR_UP_S);
SENDLINE_PGM(SM_DIR_UP_L);
SERIAL_ECHO(count);
SERIAL_ECHO(": ");
SERIAL_ECHOLNPGM(SM_DIR_UP_L);
}
}
else {
card.selectFileByIndex(count - 1);
// The longname may not be filed, so we use the built-in fallback here.
char* fileName = card.longest_filename();
int fileNameLen = strlen(fileName);
bool fileNameWasCut = false;
// Cut off too long filenames.
// They don't fit on the screen anyway.
#if ENABLED(KNUTWURST_DGUS2_TFT)
if (fileNameLen >= MAX_PRINTABLE_FILENAME_LEN) {
fileNameWasCut = true;
fileNameLen = MAX_PRINTABLE_FILENAME_LEN;
}
#endif
char outputString[fileNameLen];
// Bugfix for non-printable special characters
// which are now replaced by underscores.
for (unsigned char i = 0; i <= fileNameLen; i++) {
if (i >= fileNameLen) {
outputString[i] = ' ';
}
else {
outputString[i] = fileName[i];
if (!isPrintable(outputString[i]))
outputString[i] = '_';
}
}
// I know, it's ugly, but it's faster than a string lib
if (fileNameWasCut) {
outputString[fileNameLen - 7] = '~';
outputString[fileNameLen - 6] = '.';
outputString[fileNameLen - 5] = 'g';
outputString[fileNameLen - 4] = 'c';
outputString[fileNameLen - 3] = 'o';
outputString[fileNameLen - 2] = 'd';
outputString[fileNameLen - 1] = 'e';
}
outputString[fileNameLen] = '\0';
if (card.flag.filenameIsDir) {
#if ENABLED(KNUTWURST_DGUS2_TFT)
SEND_PGM("/");
SEND(card.filename);
SENDLINE_PGM(".GCO");
SEND_PGM("/");
SEND(outputString);
SENDLINE_PGM(".gcode");
#else
SEND_PGM("/");
SEND(card.filename);
SEND_PGM("/");
SENDLINE(outputString);
#endif
SERIAL_ECHO(count);
SERIAL_ECHOPGM(": /");
SERIAL_ECHOLN(outputString);
} else {
SENDLINE(card.filename);
SENDLINE(outputString);
SERIAL_ECHO(count);
SERIAL_ECHOPGM(": ");
SERIAL_ECHOLN(outputString);
}
}
}
}
#endif // ifdef SDSUPPORT
else {
#if ENABLED(KNUTWURST_SPECIAL_MENU_WO_SD)
for (count = selectedNumber; count <= max_files; count++) {
if (count == 0) { // Special Entry
if (currentFileList.isAtRootDir()) {
SENDLINE_PGM(SM_SPECIAL_MENU_S);
SENDLINE_PGM(SM_SPECIAL_MENU_L);
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHO(count);
SERIAL_ECHO(": ");
SERIAL_ECHOLNPGM(SM_SPECIAL_MENU_L);
#endif
}
else {
SENDLINE_PGM(SM_DIR_UP_S);
SENDLINE_PGM(SM_DIR_UP_L);
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHO(count);
SERIAL_ECHO(": ");
SERIAL_ECHOLNPGM(SM_DIR_UP_L);
#endif
}
} else {
currentFileList.seek(count - 1, false);
#if ENABLED(ANYCUBIC_LCD_DEBUG)
SERIAL_ECHOLN(currentFileList.filename());
#endif
/*
if (currentFileList.isDir()) {
SEND_PGM("/");
SENDLINE(currentFileList.shortFilename());
SEND_PGM("/");
SENDLINE(currentFileList.filename());
} else {
SENDLINE(currentFileList.shortFilename());
SENDLINE(currentFileList.filename());
}
*/
// The longname may not be filed, so we use the built-in fallback here.
const char* fileName = currentFileList.filename();
int fileNameLen = strlen(fileName);
bool fileNameWasCut = false;
// Cut off too long filenames.
// They don't fit on the screen anyway.
#if ENABLED(KNUTWURST_DGUS2_TFT)
if (fileNameLen >= MAX_PRINTABLE_FILENAME_LEN) {
fileNameWasCut = true;
fileNameLen = MAX_PRINTABLE_FILENAME_LEN;
}
#endif
char outputString[fileNameLen];
// Bugfix for non-printable special characters
// which are now replaced by underscores.
for (unsigned char i = 0; i <= fileNameLen; i++) {
if (i >= fileNameLen) {
outputString[i] = ' ';
}
else {
outputString[i] = fileName[i];
if (!isPrintable(outputString[i]))
outputString[i] = '_';
}
}
// I know, it's ugly, but it's faster than a string lib
if (fileNameWasCut) {
outputString[fileNameLen - 7] = '~';
outputString[fileNameLen - 6] = '.';
outputString[fileNameLen - 5] = 'g';
outputString[fileNameLen - 4] = 'c';
outputString[fileNameLen - 3] = 'o';
outputString[fileNameLen - 2] = 'd';
outputString[fileNameLen - 1] = 'e';
}
outputString[fileNameLen] = '\0';
if (currentFileList.isDir()) {
#if ENABLED(KNUTWURST_DGUS2_TFT)
SEND_PGM("/");
SEND(currentFileList.shortFilename());
SENDLINE_PGM(".GCO");
SEND_PGM("/");
SEND(outputString);
SENDLINE_PGM(".gcode");
#else
SEND_PGM("/");
SENDLINE(currentFileList.shortFilename());
SEND_PGM("/");
SENDLINE(currentFileList.filename());
#endif
SERIAL_ECHO(count);
SERIAL_ECHOPGM(": /");
SERIAL_ECHOLN(outputString);
} else { // The current selection is a file and not a directory
SENDLINE(currentFileList.shortFilename());
SENDLINE(outputString);
SERIAL_ECHO(count);
SERIAL_ECHOPGM(": ");
SERIAL_ECHOLN(outputString);
}
}
}
}
void AnycubicTouchscreenClass::CheckSDCardChange() {
#if BOTH(SDSUPPORT, HAS_SD_DETECT)
@@ -1078,7 +1078,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 +1121,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 +1152,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 +1230,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 +1257,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");
@@ -1307,9 +1298,8 @@
#endif
{
if (CodeSeen('S')) filenumber = CodeValue();
SENDLINE_PGM("FN "); // Filelist start
PrintList();
SENDLINE_PGM("END"); // Filelist stop
//PrintList();
RenderCurrentFileList();
}
#endif
break;
@@ -1338,7 +1328,7 @@
case 13: // A13 SELECTION FILE
#if ENABLED(SDSUPPORT)
if (isMediaInserted()) {
{
starpos = (strchr(TFTstrchr_pointer + 4, '*'));
if (TFTstrchr_pointer[4] == '/') {
strcpy(currentTouchscreenSelection, TFTstrchr_pointer + 5);
@@ -1389,14 +1379,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 +1395,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 +1537,53 @@
break;
case 26: // A26 refresh SD
{
#ifdef SDSUPPORT
#ifdef ANYCUBIC_TFT_DEBUG
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)
) {
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("TFT Serial Debug: RefreshSD(): currentTouchscreenSelection: ", currentTouchscreenSelection);
SERIAL_EOL();
SERIAL_ECHOPGM("TFT Serial Debug: RefreshSD(): currentFileOrDirectory: ", currentFileOrDirectory);
SERIAL_EOL();
#endif
FileList currentFileList;
if ((strcasestr_P(currentFileOrDirectory, PSTR(SM_DIR_UP_S)) != NULL)
|| (strcasestr_P(currentFileOrDirectory, 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';
currentFileList.changeDir(currentFileOrDirectory);
#else
currentFileList.changeDir(currentTouchscreenSelection);
#endif
}
}
}
if (SpecialMenu == false)
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 +1615,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 +1759,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 +1975,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

@@ -42,20 +42,6 @@ char *itostr2(const uint8_t &x);
#define MSG_MY_VERSION CUSTOM_BUILD_VERSION
#define MAX_PRINTABLE_FILENAME_LEN 26
#if ENABLED(KNUTWURST_CHIRON)
#define FIL_RUNOUT_PIN 33
#else
#define FIL_RUNOUT_PIN 19
#endif
#define ANYCUBIC_TFT_STATE_IDLE 0
#define ANYCUBIC_TFT_STATE_SDPRINT 1
#define ANYCUBIC_TFT_STATE_SDPAUSE 2
#define ANYCUBIC_TFT_STATE_SDPAUSE_REQ 3
#define ANYCUBIC_TFT_STATE_SDPAUSE_OOF 4
#define ANYCUBIC_TFT_STATE_SDSTOP_REQ 5
#define ANYCUBIC_TFT_STATE_SDOUTAGE 99
enum AnycubicMediaPrintState {
AMPRINTSTATE_NOT_PRINTING,
AMPRINTSTATE_PRINTING,
@@ -259,6 +245,7 @@ enum AnycubicMediaPauseState {
#endif
class AnycubicTouchscreenClass {
public:
AnycubicTouchscreenClass();
@@ -273,9 +260,11 @@ void KillTFT();
static void OnPrintTimerStarted();
static void OnPrintTimerPaused();
static void OnPrintTimerStopped();
#if BOTH(ANYCUBIC_TFT_DEBUG, KNUTWURST_DGUS2_TFT)
void Command(const char * const command);
#endif
#if ENABLED(KNUTWURST_TFT_LEVELING)
void LevelingDone();
#endif
@@ -318,7 +307,6 @@ static AnycubicMediaPauseState mediaPauseState;
int CodeValueInt();
float CodeValue();
bool CodeSeen(char);
void PrintList();
void StartPrint();
void PausePrint();
void StopPrint();
@@ -331,12 +319,14 @@ void FilamentChangePause();
void ResumePrint();
void ReheatNozzle();
void ParkAfterStop();
void RenderCurrentFileList();
void RenderSpecialMenu(uint16_t);
void RenderCurrentFolder(uint16_t);
char currentTouchscreenSelection[30];
char currentFileOrDirectory[30];
char currentTouchscreenSelection[64];
char currentFileOrDirectory[64];
String flowRateBuffer;
String zOffsetBuffer;
uint16_t MyFileNrCnt = 0;
uint8_t FilamentSensorEnabled = true;
uint8_t SpecialMenu = false;

View File

@@ -286,11 +286,27 @@
#endif
#endif
// RAMPS 1.4 DIO 4 on the servos connector
#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN 4
#if ANY(KNUTWURST_CHIRON, KNUTWURST_4MAXP2)
#define FIL_RUNOUT_PIN 33
#ifndef Z2_STEP_PIN
#define Z2_STEP_PIN 46
#endif
#ifndef Z2_DIR_PIN
#define Z2_DIR_PIN 48
#endif
#ifndef Z2_ENABLE_PIN
#define Z2_ENABLE_PIN 62
#endif
#ifndef Z2_CS_PIN
#define Z2_CS_PIN 40
#endif
#else
#define FIL_RUNOUT_PIN 19
#endif
#ifndef PS_ON_PIN
#define PS_ON_PIN 12
#endif

View File

@@ -142,6 +142,19 @@
#define Z_CS_PIN 40
#endif
#ifndef Z2_STEP_PIN
#define Z2_STEP_PIN 46
#endif
#ifndef Z2_DIR_PIN
#define Z2_DIR_PIN 48
#endif
#ifndef Z2_ENABLE_PIN
#define Z2_ENABLE_PIN 62
#endif
#ifndef Z2_CS_PIN
#define Z2_CS_PIN 40
#endif
#define E0_STEP_PIN 26
#define E0_DIR_PIN 28
#define E0_ENABLE_PIN 24
@@ -253,7 +266,7 @@
// RAMPS 1.4 DIO 4 on the servos connector
#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN 4
#define FIL_RUNOUT_PIN 33
#endif
#ifndef PS_ON_PIN

View File

@@ -86,6 +86,12 @@
#define OUTAGECON_PIN 58
#endif
#if ANY(KNUTWURST_CHIRON, KNUTWURST_4MAXP2)
#define FIL_RUNOUT_PIN 33
#else
#define FIL_RUNOUT_PIN 19
#endif
#if ENABLED(TRIGORILLA_MAPPING_CHIRON)
#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN 33
@@ -97,7 +103,7 @@
#endif
#endif
#if EITHER(TRIGORILLA_MAPPING_CHIRON, SWAP_Z_MOTORS)
#if ANY(TRIGORILLA_MAPPING_CHIRON, SWAP_Z_MOTORS, KNUTWURST_CHIRON, KNUTWURST_4MAXP2) // PATCH: knutwurst
// Chiron and some Anycubic i3 MEGAs swap Z steppers
#define Z_STEP_PIN 36
#define Z_DIR_PIN 34

View File

@@ -64,7 +64,7 @@
#define TG_FAN1_PIN 7 // Anycubic Kossel: Unused
#define TG_FAN2_PIN 44 // Anycubic Kossel: Hotend fan
#define CONTROLLER_FAN_PIN TG_FAN1_PIN
#define FIL_RUNOUT_PIN 19
#define FIL_RUNOUT_PIN 33
#define BEEPER_PIN 31
#define SDSS 53
#define LED_PIN 13