52 Commits

Author SHA1 Message Date
Knutwurst
c77aacbbd9 Set build version for next release 2023-06-07 21:59:21 +02:00
Knutwurst
4206e3c4e8 Invert setSoftEndstopState logic on print stop 2023-06-07 21:39:14 +02:00
Knutwurst
dfc9cbe8b1 Change Chiron and 4MAX filament load length. 2023-06-07 18:55:48 +02:00
Knutwurst
9c7e330363 Fix AutoPowerOff menu selection. 2023-06-07 18:02:01 +02:00
Knutwurst
580d56bd37 Fix PowerOffFlag handling. 2023-06-07 16:16:06 +02:00
Knutwurst
588f703684 Add Special Menu BLTouch HighSpeed Mode selection 2023-06-07 12:39:56 +02:00
Knutwurst
c48395f801 Fix 4MAX build 2023-06-07 09:09:14 +02:00
Knutwurst
f7060d5524 Add more TFT debugging messages. 2023-06-07 09:03:20 +02:00
Knutwurst
acee1592c9 Add setSoftEndstopState to TFT print and stop functions. 2023-06-07 08:49:56 +02:00
Knutwurst
442f66c145 Disable soft endstops while printing, so that mesh points below 0 can be reached. 2023-06-07 08:48:05 +02:00
Knutwurst
b5b3da41f5 Disable software endstops when manual or auto leveling is activated, so the nozzle can be set to a lower point than the endstop. 2023-06-07 08:35:43 +02:00
Knutwurst
38edd9375b Revert "Disable automatic mesh adjustment when Z offset is altered."
This reverts commit fb7a29ce8e.
2023-06-07 08:14:28 +02:00
Knutwurst
fb7a29ce8e Disable automatic mesh adjustment when Z offset is altered. 2023-06-06 21:44:08 +02:00
Knutwurst
056dd71494 Substitute LCD_SERIAL.println() with LCD_SERIAL.print(,2) to ensure display compatibility. 2023-06-06 19:06:50 +02:00
Knutwurst
09b448773f Revert define, because it breaks the build. 2023-06-06 17:01:43 +02:00
Knutwurst
223df2956a Fix display of single mesh points 2023-06-06 17:01:06 +02:00
Knutwurst
9376b95148 Fix live Z offset. 2023-06-06 16:46:09 +02:00
Knutwurst
fbd1b7b9bf Fix PowerOff. 2023-06-03 21:15:52 +02:00
Knutwurst
61fba37678 Reenable auto power off on 4MAX Pro 2.0 2023-06-03 19:45:48 +02:00
Knutwurst
7b0aa6ec6a Code cleanup. 2023-06-03 19:45:21 +02:00
Knutwurst
70ccd6a957 Refactor Chiron A31 Adjust all Probe Points routine 2023-06-03 19:29:59 +02:00
Knutwurst
6bc410a0e3 Unify special menu defines for both display types. Also fix NoSD message and error, when no SD card is present. 2023-06-03 18:51:02 +02:00
Knutwurst
011752e02a Improve file list rendering speed. 2023-06-03 09:20:54 +02:00
Knutwurst
471d7f47a0 Remove unnecessary code from get-sd-list routine. 2023-06-03 00:20:25 +02:00
Knutwurst
0670fb9253 Revert from const char* to char* because it breaks Anycubic 1.0 without SD card. 2023-06-02 22:57:16 +02:00
Knutwurst
501ebfd159 Fix load fw defaults gcode in special menu. 2023-06-02 22:23:53 +02:00
Knutwurst
dedc00fb0d Reenable automatic filament feed on M600, because a little purge is needed to enable the continue button. 2023-06-02 19:42:13 +02:00
Knutwurst
acc3c74905 New load/unload values for chiron. 2023-06-02 19:02:36 +02:00
Knutwurst
d1f269d654 Fix build 2023-06-02 18:59:12 +02:00
Knutwurst
d4fe673b96 Add M600 config for CHIRON. 2023-06-02 18:54:52 +02:00
Knutwurst
862ac308c7 Clean dead code and disable debugging messages. 2023-06-02 18:18:49 +02:00
Knutwurst
75c541cafb Change preheat temperatures. 2023-06-02 18:02:17 +02:00
Knutwurst
bb4ee37676 Set release version and clean up some code snippets. 2023-06-02 17:42:29 +02:00
Knutwurst
bf80c9b8dd Suppress AUTO_ASSIGN_WARNING on Chiron and 4MAX builds. 2023-06-02 17:01:25 +02:00
Knutwurst
79eaf1a8b5 Allow manual probing on Chiron. 2023-06-02 16:57:27 +02:00
Knutwurst
ff5b808dea Add new mediaPrintingState for probing, which is needed by the chiron routine. 2023-06-02 16:48:10 +02:00
Knutwurst
37ef0ca742 Add more debug output. 2023-06-02 13:14:48 +02:00
Knutwurst
fd84ec3523 Add TODO in case A31 - Adjust all Probe Points 2023-06-02 11:16:11 +02:00
Knutwurst
afa411f065 Substitute settings() with command injection. 2023-06-02 08:52:05 +02:00
Knutwurst
d93ff45af6 Set build version and date. Also enable TFT debugging. 2023-06-02 08:48:41 +02:00
Knutwurst
8fb71f482e Fix build 2023-06-02 08:47:06 +02:00
Knutwurst
325bcb7e01 Rebuild Chiron leveling feature. 2023-06-02 08:38:28 +02:00
Knutwurst
0af71b9817 Rename CodeSeen to FindToken. 2023-06-01 22:13:43 +02:00
Knutwurst
8e828a48b9 Revert duplicate Z2 pin definitions on 4MAX and Chiron. 2023-06-01 22:01:17 +02:00
Knutwurst
a356788dc7 Add fix for .GCO files on DGUS2 Clone Display 2023-06-01 19:27:01 +02:00
Knutwurst
6499c6b7c3 Simplify non-printable char filter loop. 2023-06-01 18:42:30 +02:00
Knutwurst
fda51c1c46 Remove unneccessary code in the filename check. 2023-06-01 17:13:17 +02:00
Knutwurst
0c25c876d3 Some refactoring and cleanup. No breaking changes. 2023-06-01 09:14:14 +02:00
Knutwurst
067fe2f074 Bump version and date for next major release. 2023-05-31 21:21:39 +02:00
Knutwurst
e8d38ba955 Enable alphabetical SD card file sorting. 2023-05-31 21:19:37 +02:00
Knutwurst
6d257896c0 Beautify DGUS2 Clone file display. Might need some refactoring. 2023-05-31 16:57:20 +02:00
Knutwurst
2af4a2d4e6 Fix sanitization of directory names on Anycubic 1.0 Display. 2023-05-31 15:19:18 +02:00
8 changed files with 388 additions and 453 deletions

View File

@@ -59,6 +59,7 @@
*/ */
#if ENABLED(KNUTWURST_CHIRON) #if ENABLED(KNUTWURST_CHIRON)
#define TRIGORILLA_MAPPING_CHIRON #define TRIGORILLA_MAPPING_CHIRON
#define NO_AUTO_ASSIGN_WARNING
#else #else
#define TRIGORILLA_MAPPING_I3MEGA #define TRIGORILLA_MAPPING_I3MEGA
#define SWAP_Z_MOTORS #define SWAP_Z_MOTORS
@@ -94,6 +95,7 @@
*/ */
#if ENABLED(KNUTWURST_4MAXP2) #if ENABLED(KNUTWURST_4MAXP2)
#define ANYCUBIC_4_MAX_PRO_ENDSTOPS #define ANYCUBIC_4_MAX_PRO_ENDSTOPS
#define NO_AUTO_ASSIGN_WARNING
#endif #endif
@@ -2851,14 +2853,14 @@
// Preheat Constants - Up to 10 are supported without changes // Preheat Constants - Up to 10 are supported without changes
// //
#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_LABEL "PLA"
#define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_HOTEND 200
#define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_TEMP_BED 60
// #define PREHEAT_1_TEMP_CHAMBER 35 // #define PREHEAT_1_TEMP_CHAMBER 35
#define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255
#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_LABEL "ABS"
#define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_HOTEND 240
#define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_TEMP_BED 90
// #define PREHEAT_2_TEMP_CHAMBER 35 // #define PREHEAT_2_TEMP_CHAMBER 35
#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255

View File

@@ -1611,7 +1611,7 @@
* - SDSORT_CACHE_NAMES will retain the sorted file listing in RAM. (Expensive!) * - SDSORT_CACHE_NAMES will retain the sorted file listing in RAM. (Expensive!)
* - SDSORT_DYNAMIC_RAM only uses RAM when the SD menu is visible. (Use with caution!) * - SDSORT_DYNAMIC_RAM only uses RAM when the SD menu is visible. (Use with caution!)
*/ */
// #define SDCARD_SORT_ALPHA #define SDCARD_SORT_ALPHA
// SD Card Sorting options // SD Card Sorting options
#if ENABLED(SDCARD_SORT_ALPHA) #if ENABLED(SDCARD_SORT_ALPHA)
@@ -2658,7 +2658,47 @@
*/ */
#define ADVANCED_PAUSE_FEATURE #define ADVANCED_PAUSE_FEATURE
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
#if DISABLED(KNUTWURST_4MAXP2) #if ENABLED(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 5 // (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 10 // (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
#if ENABLED(KNUTWURST_CHIRON)
#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 5 // (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 550 // (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
#if NONE(KNUTWURST_CHIRON, KNUTWURST_4MAXP2)
#define PAUSE_PARK_RETRACT_FEEDRATE 40 // (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.
@@ -2676,24 +2716,6 @@
#define FILAMENT_CHANGE_FAST_LOAD_LENGTH 538 // (mm) Load length of filament, from extruder gear to nozzle. #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 Bowden, the full length of the tube and nozzle.
// For direct drive, the full length of the 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 #endif
#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. #define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted.

View File

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

View File

@@ -26,15 +26,15 @@
#include "../ui_api.h" #include "../ui_api.h"
#include "../../../gcode/queue.h" #include "../../../gcode/queue.h"
#include "../../../feature/bedlevel/bedlevel.h"
#include "../../../libs/buzzer.h" #include "../../../libs/buzzer.h"
#include "../../../libs/numtostr.h" #include "../../../libs/numtostr.h"
#include "../../../module/temperature.h" #include "../../../module/temperature.h"
#include "../../../module/motion.h" #include "../../../module/motion.h"
#include "../../../module/settings.h"
#include "../../../module/stepper.h" #include "../../../module/stepper.h"
//#define ANYCUBIC_TFT_DEBUG //#define ANYCUBIC_TFT_DEBUG
//#define KNUTWURST_DGUS2_TFT
//#define KNUTWURST_TFT_LEVELING
#ifdef ANYCUBIC_TOUCHSCREEN #ifdef ANYCUBIC_TOUCHSCREEN
#include "./anycubic_touchscreen.h" #include "./anycubic_touchscreen.h"
@@ -68,82 +68,6 @@
AnycubicMediaPrintState AnycubicTouchscreenClass::mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; AnycubicMediaPrintState AnycubicTouchscreenClass::mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
AnycubicMediaPauseState AnycubicTouchscreenClass::mediaPauseState = AMPAUSESTATE_NOT_PAUSED; AnycubicMediaPauseState AnycubicTouchscreenClass::mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
#if ENABLED(KNUTWURST_TFT_LEVELING)
int z_values_index;
int z_values_size;
float SAVE_zprobe_zoffset;
uint8_t x;
uint8_t y;
void restore_z_values() {
uint16_t size = z_values_size;
int pos = z_values_index;
uint8_t* value = (uint8_t*)&bedlevel.z_values;
do {
uint8_t c = eeprom_read_byte((unsigned char*)pos);
*value = c;
pos++;
value++;
if(pos > 32766)
break;
} while (--size);
}
void setupMyZoffset() {
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
SERIAL_ECHOPGM("MEANL_L:", 0x55);
SAVE_zprobe_zoffset = probe.offset.z;
#else
SERIAL_ECHOPGM("MEANL_L:", 0xaa);
constexpr float dpo[] = NOZZLE_TO_PROBE_OFFSET;
probe.offset.z = dpo[Z_AXIS];
#endif
}
void initializeGrid() {
#if ENABLED(PROBE_MANUALLY)
#define ABL_VAR static
#else
#define ABL_VAR
#endif
ABL_VAR xy_pos_t probe_position_lf, probe_position_rb;
// ABL_VAR xy_float_t gridSpacing = { 0, 0 };
const float x_min = probe.min_x(), x_max = probe.max_x(),
y_min = probe.min_y(), y_max = probe.max_y();
constexpr xy_uint8_t abl_grid_points = { GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y };
GCodeParser parser;
// Reset grid to 0.0 or "not probed". (Also disables ABL)
reset_bed_level();
// Initialize a grid with the given dimensions
probe_position_lf.set(
parser.seenval('L') ? RAW_X_POSITION(parser.value_linear_units()) : x_min,
parser.seenval('F') ? RAW_Y_POSITION(parser.value_linear_units()) : y_min
);
probe_position_rb.set(
parser.seenval('R') ? RAW_X_POSITION(parser.value_linear_units()) : x_max,
parser.seenval('B') ? RAW_Y_POSITION(parser.value_linear_units()) : y_max
);
LevelingBilinear::grid_spacing.set((probe_position_rb.x - probe_position_lf.x) / (abl_grid_points.x - 1),
(probe_position_rb.y - probe_position_lf.y) / (abl_grid_points.y - 1));
LevelingBilinear::grid_start = probe_position_lf;
// Can't re-enable (on error) until the new grid is written
set_bed_leveling_enabled(false);
constexpr float dpo[] = NOZZLE_TO_PROBE_OFFSET;
probe.offset.z = dpo[Z_AXIS];
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) bedlevel.z_values[x][y] = float(-1.0);
bedlevel.refresh_bed_level();
set_bed_leveling_enabled(true);
}
#endif // if ENABLED(KNUTWURST_TFT_LEVELING)
#if ENABLED(POWER_OUTAGE_TEST) #if ENABLED(POWER_OUTAGE_TEST)
int PowerInt = 6; int PowerInt = 6;
@@ -197,6 +121,7 @@
CaseLight = false; CaseLight = false;
currentFlowRate = 100; currentFlowRate = 100;
flowRateBuffer = SM_FLOW_DISP_L; flowRateBuffer = SM_FLOW_DISP_L;
live_Zoffset = 0.0;
#if BOTH(SDSUPPORT, HAS_SD_DETECT) #if BOTH(SDSUPPORT, HAS_SD_DETECT)
SET_INPUT_PULLUP(SD_DETECT_PIN); SET_INPUT_PULLUP(SD_DETECT_PIN);
@@ -206,11 +131,6 @@
SET_INPUT_PULLUP(FIL_RUNOUT1_PIN); SET_INPUT_PULLUP(FIL_RUNOUT1_PIN);
#endif #endif
#if ENABLED(KNUTWURST_TFT_LEVELING)
setupMyZoffset();
delay(10);
#endif
setup_OutageTestPin(); setup_OutageTestPin();
setup_PowerOffPin(); setup_PowerOffPin();
@@ -219,7 +139,6 @@
CheckHeaterError(); CheckHeaterError();
DoFilamentRunoutCheck(); DoFilamentRunoutCheck();
#ifdef STARTUP_CHIME #ifdef STARTUP_CHIME
BUZZ(100, 554); BUZZ(100, 554);
BUZZ(100, 740); BUZZ(100, 740);
@@ -278,6 +197,7 @@
SERIAL_ECHOPGM(" "); SERIAL_ECHOPGM(" ");
SERIAL_ECHOLN(currentFileOrDirectory); SERIAL_ECHOLN(currentFileOrDirectory);
#endif #endif
setSoftEndstopState(false);
mediaPrintingState = AMPRINTSTATE_PRINTING; mediaPrintingState = AMPRINTSTATE_PRINTING;
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
printFile(currentFileOrDirectory); printFile(currentFileOrDirectory);
@@ -300,6 +220,7 @@
inline void AnycubicTouchscreenClass::StopPrint() { inline void AnycubicTouchscreenClass::StopPrint() {
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
setSoftEndstopState(true);
mediaPrintingState = AMPRINTSTATE_STOP_REQUESTED; mediaPrintingState = AMPRINTSTATE_STOP_REQUESTED;
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
SENDLINE_DBG_PGM("J16", "TFT Serial Debug: SD print stop called... J16"); SENDLINE_DBG_PGM("J16", "TFT Serial Debug: SD print stop called... J16");
@@ -413,7 +334,7 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_SAVE_EEPROM_S)) != NULL) || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_SAVE_EEPROM_S)) != NULL)
) { ) {
SERIAL_ECHOLNPGM("Special Menu: Save EEPROM"); SERIAL_ECHOLNPGM("Special Menu: Save EEPROM");
settings.save(); // M500 injectCommands(F("M500"));
BUZZ(105, 1108); BUZZ(105, 1108);
BUZZ(210, 1661); BUZZ(210, 1661);
} }
@@ -421,10 +342,7 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_LOAD_DEFAULTS_S)) != NULL) || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_LOAD_DEFAULTS_S)) != NULL)
) { ) {
SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults"); SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults");
settings.reset(); // M502 injectCommands(F("M502"));
#if ENABLED(KNUTWURST_TFT_LEVELING)
initializeGrid();
#endif
BUZZ(105, 1661); BUZZ(105, 1661);
BUZZ(210, 1108); BUZZ(210, 1108);
} }
@@ -440,6 +358,8 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_MESH_MENU_S)) != NULL) || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_MESH_MENU_S)) != NULL)
) { ) {
MMLMenu = true; MMLMenu = true;
SERIAL_ECHOLNPGM("Special Menu: Manual Med Leveling + disable soft endstops");
setSoftEndstopState(false);
} }
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_MESH_START_L)) != NULL) else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_MESH_START_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_MESH_START_S)) != NULL) || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_MESH_START_S)) != NULL)
@@ -507,8 +427,7 @@
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_RESETLV_S)) != NULL) || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_RESETLV_S)) != NULL)
) { ) {
SERIAL_ECHOLNPGM("Special Menu: initializeGrid()"); SERIAL_ECHOLNPGM("Special Menu: initializeGrid()");
initializeGrid(); injectCommands(F("M501\nM420 S1"));
settings.save();
BUZZ(105, 1108); BUZZ(105, 1108);
BUZZ(210, 1661); BUZZ(210, 1661);
} }
@@ -531,8 +450,7 @@
) { ) {
SERIAL_ECHOLNPGM("Special Menu: Disable Filament Sensor"); SERIAL_ECHOLNPGM("Special Menu: Disable Filament Sensor");
injectCommands(F("M412 H0 S0\nM500")); injectCommands(F("M412 H0 S0\nM500"));
BUZZ(105, 1108); BUZZ(210, 1661);
BUZZ(105, 1108);
BUZZ(105, 1108); BUZZ(105, 1108);
} }
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EN_FILSENS_L)) != NULL) else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EN_FILSENS_L)) != NULL)
@@ -541,7 +459,7 @@
SERIAL_ECHOLNPGM("Special Menu: Enable Filament Sensor"); SERIAL_ECHOLNPGM("Special Menu: Enable Filament Sensor");
injectCommands(F("M412 H0 S1\nM500")); injectCommands(F("M412 H0 S1\nM500"));
BUZZ(105, 1108); BUZZ(105, 1108);
BUZZ(105, 1108); BUZZ(210, 1661);
} }
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EXIT_L)) != NULL) else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EXIT_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_EXIT_S)) != NULL) || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_EXIT_S)) != NULL)
@@ -551,6 +469,8 @@
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_BACK_L)) != NULL) else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_BACK_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_BACK_S)) != NULL) || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_BACK_S)) != NULL)
) { ) {
SERIAL_ECHOLNPGM("Special Menu: Exit Manual Med Leveling + enable soft endstops");
setSoftEndstopState(true);
MMLMenu = false; MMLMenu = false;
} }
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_FLOWMENU_L)) != NULL) else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_FLOWMENU_L)) != NULL)
@@ -599,6 +519,7 @@
) { ) {
SERIAL_ECHOLNPGM("Special Menu: Enter BLTouch Menu"); SERIAL_ECHOLNPGM("Special Menu: Enter BLTouch Menu");
BLTouchMenu = true; BLTouchMenu = true;
setSoftEndstopState(false);
} }
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_BLTZ_UP_L)) != NULL) else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_BLTZ_UP_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_BLTZ_UP_S)) != NULL) || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_BLTZ_UP_S)) != NULL)
@@ -612,15 +533,34 @@
SERIAL_ECHOLNPGM("Special Menu: Offset Down"); SERIAL_ECHOLNPGM("Special Menu: Offset Down");
probe.offset.z -= 0.01F; probe.offset.z -= 0.01F;
} }
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_HS_ENABLE_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_HS_ENABLE_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: HighSpeed Mode ENABLED");
injectCommands(F("M401 S1\nM500"));
BUZZ(105, 1108);
BUZZ(210, 1661);
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_HS_DISABLE_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_HS_DISABLE_S)) != NULL)
) {
SERIAL_ECHOLNPGM("Special Menu: HighSpeed Mode DISABLED!");
injectCommands(F("M401 S0\nM500"));
BUZZ(210, 1661);
BUZZ(105, 1108);
}
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_BLTZ_EXIT_L)) != NULL) else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_BLTZ_EXIT_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_BLTZ_EXIT_S)) != NULL) || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_BLTZ_EXIT_S)) != NULL)
) { ) {
SERIAL_ECHOLNPGM("Special Menu: Exit BLTouch Menu & Save EEPROM"); SERIAL_ECHOLNPGM("Special Menu: Exit BLTouch Menu & Save EEPROM");
settings.save(); // M500 setSoftEndstopState(true);
injectCommands(F("M500"));
BUZZ(105, 1108); BUZZ(105, 1108);
BUZZ(210, 1661); BUZZ(210, 1661);
BLTouchMenu = false; BLTouchMenu = false;
} }
#endif #endif
else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_MENU_L)) != NULL) else if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_MENU_L)) != NULL)
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_MENU_S)) != NULL) || (strcasestr_P(currentTouchscreenSelection, PSTR(SM_EZLVL_MENU_S)) != NULL)
@@ -707,24 +647,21 @@
void AnycubicTouchscreenClass::RenderCurrentFileList() { void AnycubicTouchscreenClass::RenderCurrentFileList() {
uint16_t selectedNumber = 0;
FileList currentFileList;
currentFileOrDirectory[0] = 0; currentFileOrDirectory[0] = 0;
if (SpecialMenu == false) { if (SpecialMenu == false) {
currentTouchscreenSelection[0] = 0; currentTouchscreenSelection[0] = 0;
} }
SENDLINE_PGM("FN "); // Filelist start SENDLINE_PGM("FN "); // Filelist start
if (!isMediaInserted() && !SpecialMenu) { 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_S);
SENDLINE_PGM(SM_SPECIAL_MENU_L); SENDLINE_PGM(SM_SPECIAL_MENU_L);
} } else {
else { uint16_t selectedNumber = 0;
FileList currentFileList;
if (CodeSeen('S')) { if (CodeSeen('S')) {
selectedNumber = CodeValue(); selectedNumber = CodeValue();
} }
@@ -818,6 +755,10 @@ void AnycubicTouchscreenClass::RenderSpecialMenu(uint16_t selectedNumber) {
break; break;
case 4: // Page 2 case 4: // Page 2
SENDLINE_PGM(SM_HS_ENABLE_S);
SENDLINE_PGM(SM_HS_ENABLE_L);
SENDLINE_PGM(SM_HS_DISABLE_S);
SENDLINE_PGM(SM_HS_DISABLE_L);
SENDLINE_PGM(SM_BLTZ_EXIT_S); SENDLINE_PGM(SM_BLTZ_EXIT_S);
SENDLINE_PGM(SM_BLTZ_EXIT_L); SENDLINE_PGM(SM_BLTZ_EXIT_L);
break; break;
@@ -970,59 +911,68 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
SERIAL_ECHOLN(currentFileList.filename()); SERIAL_ECHOLN(currentFileList.filename());
#endif #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. // The longname may not be filed, so we use the built-in fallback here.
const char* fileName = currentFileList.filename(); char* fileName = strdup(currentFileList.filename());
int fileNameLen = strlen(fileName); int fileNameLen = strlen(fileName);
bool fileNameWasCut = false;
// Cut off too long filenames. // Cut off too long filenames.
// They don't fit on the screen anyway. // They don't fit on the screen anyway.
#if ENABLED(KNUTWURST_DGUS2_TFT) #if ENABLED(KNUTWURST_DGUS2_TFT)
bool fileNameWasCut = false;
if (fileNameLen >= MAX_PRINTABLE_FILENAME_LEN) { if (fileNameLen >= MAX_PRINTABLE_FILENAME_LEN) {
fileNameWasCut = true; fileNameWasCut = true;
fileNameLen = MAX_PRINTABLE_FILENAME_LEN; fileNameLen = MAX_PRINTABLE_FILENAME_LEN;
} }
char outputString[MAX_PRINTABLE_FILENAME_LEN];
#else
char outputString[fileNameLen];
#endif #endif
char outputString[fileNameLen];
// Bugfix for non-printable special characters // Bugfix for non-printable special characters
// which are now replaced by underscores. // which are now replaced by underscores.
for (unsigned char i = 0; i <= fileNameLen; i++) { for (unsigned char i = 0; i <= fileNameLen; i++) {
if (i >= fileNameLen) { if (isPrintable(fileName[i])) {
outputString[i] = ' ';
}
else {
outputString[i] = fileName[i]; outputString[i] = fileName[i];
if (!isPrintable(outputString[i])) } else {
outputString[i] = '_'; outputString[i] = '_';
} }
} }
// I know, it's ugly, but it's faster than a string lib // I know, it's ugly, but it's faster than a string lib
if (fileNameWasCut) { #if ENABLED(KNUTWURST_DGUS2_TFT)
outputString[fileNameLen - 7] = '~'; if (fileNameWasCut) {
outputString[fileNameLen - 6] = '.'; outputString[MAX_PRINTABLE_FILENAME_LEN - 7] = '~';
outputString[fileNameLen - 5] = 'g'; outputString[MAX_PRINTABLE_FILENAME_LEN - 6] = '.';
outputString[fileNameLen - 4] = 'c'; outputString[MAX_PRINTABLE_FILENAME_LEN - 5] = 'g';
outputString[fileNameLen - 3] = 'o'; outputString[MAX_PRINTABLE_FILENAME_LEN - 4] = 'c';
outputString[fileNameLen - 2] = 'd'; outputString[MAX_PRINTABLE_FILENAME_LEN - 3] = 'o';
outputString[fileNameLen - 1] = 'e'; outputString[MAX_PRINTABLE_FILENAME_LEN - 2] = 'd';
} outputString[MAX_PRINTABLE_FILENAME_LEN - 1] = 'e';
outputString[MAX_PRINTABLE_FILENAME_LEN] = '\0';
outputString[fileNameLen] = '\0'; } else if (currentFileList.isDir()) {
for (unsigned char i = fileNameLen; i < MAX_PRINTABLE_FILENAME_LEN - 7; i++) {
outputString[i] = ' ';
}
outputString[MAX_PRINTABLE_FILENAME_LEN - 7] = '\0';
} else {
for (unsigned char i = fileNameLen; i < MAX_PRINTABLE_FILENAME_LEN; i++) {
outputString[i] = ' ';
}
// fix for .GCO files, which are not displayed correctly.
if (outputString[fileNameLen - 4] == '.') {
outputString[fileNameLen - 4] = '.';
outputString[fileNameLen - 3] = 'g';
outputString[fileNameLen - 2] = 'c';
outputString[fileNameLen - 1] = 'o';
outputString[fileNameLen ] = 'd';
outputString[fileNameLen + 1] = 'e';
}
outputString[MAX_PRINTABLE_FILENAME_LEN] = '\0';
}
#else
outputString[fileNameLen] = '\0';
#endif
if (currentFileList.isDir()) { if (currentFileList.isDir()) {
#if ENABLED(KNUTWURST_DGUS2_TFT) #if ENABLED(KNUTWURST_DGUS2_TFT)
@@ -1036,7 +986,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
SEND_PGM("/"); SEND_PGM("/");
SENDLINE(currentFileList.shortFilename()); SENDLINE(currentFileList.shortFilename());
SEND_PGM("/"); SEND_PGM("/");
SENDLINE(currentFileList.filename()); SENDLINE(outputString);
#endif #endif
SERIAL_ECHO(count); SERIAL_ECHO(count);
SERIAL_ECHOPGM(": /"); SERIAL_ECHOPGM(": /");
@@ -1186,46 +1136,6 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
TFTcmdbuffer[TFTbufindw][serial3_count] = 0; // terminate string TFTcmdbuffer[TFTbufindw][serial3_count] = 0; // terminate string
if (!TFTcomment_mode) { if (!TFTcomment_mode) {
/*
// -------- START ERROR CORRECTION ----------
TFTcomment_mode = false; //for new command
if (strchr(TFTcmdbuffer[TFTbufindw], 'N') != NULL)
{
if (strchr(TFTcmdbuffer[TFTbufindw], '*') != NULL)
{
byte checksum = 0;
byte count = 0;
while(TFTcmdbuffer[TFTbufindw][count] != '*') checksum = checksum^TFTcmdbuffer[TFTbufindw][count++];
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindw], '*');
if ( (int)(strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], NULL)) != checksum)
{
SEND_PGM("ERR ");
LCD_SERIAL.flush();
SEND_PGM("ERR ");
LCD_SERIAL.flush();
serial3_count = 0;
return;
}
//if no errors, continue parsing
} else {
SEND_PGM("ERR ");
LCD_SERIAL.flush();
serial3_count = 0;
return;
}
//if no errors, continue parsing
} else { // if we don't receive 'N' but still see '*'
if ((strchr(TFTcmdbuffer[TFTbufindw], '*') != NULL))
{
SEND_PGM("ERR ");
serial3_count = 0;
return;
}
}
// -------- FINISH ERROR CORRECTION ----------
*/
if ((strchr(TFTcmdbuffer[TFTbufindw], 'A') != NULL)) { if ((strchr(TFTcmdbuffer[TFTbufindw], 'A') != NULL)) {
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindw], 'A'); TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindw], 'A');
switch ((int)((strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], NULL)))) { switch ((int)((strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], NULL)))) {
@@ -1287,20 +1197,8 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
case 8: // A8 GET SD LIST case 8: // A8 GET SD LIST
#ifdef SDSUPPORT #ifdef SDSUPPORT
if (SpecialMenu == false) if (SpecialMenu == false) currentTouchscreenSelection[0] = 0;
currentTouchscreenSelection[0] = 0;
#if DISABLED(KNUTWURST_SPECIAL_MENU_WO_SD)
if (!IS_SD_INSERTED()) {
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to render Current File List... J02");
}
else
#endif
{
if (CodeSeen('S')) filenumber = CodeValue();
//PrintList();
RenderCurrentFileList(); RenderCurrentFileList();
}
#endif #endif
break; break;
@@ -1363,12 +1261,11 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
case 15: // A15 RESUMING FROM OUTAGE case 15: // A15 RESUMING FROM OUTAGE
#if defined(POWER_OUTAGE_TEST) #if defined(POWER_OUTAGE_TEST)
if ((!planner.movesplanned()) && (TFTstate != ANYCUBIC_TFT_STATE_SDPAUSE)) { if (!isPrinting()) {
if (card.isFileOpen()) FlagResumFromOutage = true; if (card.isFileOpen()) FlagResumFromOutage = true;
ResumingFlag = 1; ResumingFlag = 1;
card.startOrResumeFilePrinting(); resumePrint();
starttime = millis();
SENDLINE_PGM("OK"); SENDLINE_PGM("OK");
} }
#endif #endif
@@ -1605,85 +1502,146 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
#if ENABLED(KNUTWURST_TFT_LEVELING) #if ENABLED(KNUTWURST_TFT_LEVELING)
case 29: // A29 bed grid read case 29: // A29 bed grid read
{ {
int mx, my; xy_uint8_t pos;
float pos_z;
if (CodeSeen('X')) mx = CodeValueInt(); if (CodeSeen('X')) pos.x = CodeValueInt();
if (CodeSeen('Y')) my = CodeValueInt(); if (CodeSeen('Y')) pos.y = CodeValueInt();
float Zvalue = bedlevel.z_values[mx][my]; pos_z = getMeshPoint(pos);
Zvalue = Zvalue * 100;
SEND_PGM("A29V ");
LCD_SERIAL.print(pos_z * 100, 2);
SENDLINE_PGM("");
if (!isPrinting()) { if (!isPrinting()) {
if (!all_axes_trusted()) { setSoftEndstopState(true);
injectCommands(F("G28\n")); if ((selectedmeshpoint.x == pos.x) && (selectedmeshpoint.y == pos.y)) {
/* if (!isPositionKnown())
set_axis_is_at_home(X_AXIS); injectCommands_P(G28_STR);
sync_plan_position();
set_axis_is_at_home(Y_AXIS);
sync_plan_position();
set_axis_is_at_home(Z_AXIS);
sync_plan_position();
report_current_position();
*/
}
else {
// Go up before moving
// SERIAL_ECHOLNPGM("Z Up");
setAxisPosition_mm(5.0, Z);
// report_current_position();
setAxisPosition_mm(LevelingBilinear::get_mesh_x(mx), X);
// report_current_position();
setAxisPosition_mm(LevelingBilinear::get_mesh_y(my), Y);
// report_current_position();
setAxisPosition_mm(EXT_LEVEL_HIGH, Z);
report_current_position(); if (isPositionKnown()) {
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("Moving to mesh point at x: ", pos.x, " y: ", pos.y, " z: ", pos_z);
#endif
setAxisPosition_mm(5.0,Z);
setAxisPosition_mm(17 + (93 * pos.x), X);
setAxisPosition_mm(20 + (93 * pos.y), Y);
setAxisPosition_mm(0.0, Z);
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("Current Z: ", getAxisPosition_mm(Z));
#endif
}
} }
selectedmeshpoint.x = pos.x;
selectedmeshpoint.y = pos.y;
} }
SEND_PGM("A29V ");
LCD_SERIAL.print(Zvalue, 2);
SENDLINE_PGM("");
} }
break; break;
case 30: // A30 auto leveling (Old Anycubic TFT) case 30: // A30 auto leveling (Old Anycubic TFT)
if (isPrinting()) if (CodeSeen('S')) {
SENDLINE_DBG_PGM("J24", "TFT Serial Debug: Forbid auto leveling... J24"); if (isPrinting()) {
else SENDLINE_DBG_PGM("J24", "TFT Serial Debug: Forbid auto leveling... J24");
SENDLINE_DBG_PGM("J26", "TFT Serial Debug: Start auto leveling... J26"); } else {
if (CodeSeen('S')) SENDLINE_DBG_PGM("J26", "TFT Serial Debug: Start auto leveling... J26");
queue.enqueue_now_P(PSTR("G28\nG29\nM500\nG90\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300\nG1 Z30 F4000\nG1 X0 F4000\nG91\nM84")); //injectCommands(F("G28\nG29"));
injectCommands(F("G28\nG29\nG90\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300\nG1 Z30 F4000\nG1 X5 F4000\nG91\nM84\nM420 S1"));
mediaPrintingState = AMPRINTSTATE_PROBING;
}
} else {
SENDLINE_DBG_PGM("J26", "TFT Serial Debug: Enable level menu... J26");
}
break; break;
case 31: // A31 z-offset case 31: // A31 z-offset
if (CodeSeen('S')) { // set if (CodeSeen('C')) { // Restore and apply original offsets
// soft_endstops_enabled = false; // disable endstops if (!isPrinting()) {
float value = constrain(CodeValue(), -1.0, 1.0); injectCommands(F("M501\nM420 S1"));
probe.offset.z += value; selectedmeshpoint.x = selectedmeshpoint.y = 99;
for (x = 0; x < GRID_MAX_POINTS_X; x++) SERIAL_ECHOLNF(F("Mesh changes abandoned, previous mesh restored."));
for (y = 0; y < GRID_MAX_POINTS_Y; y++) bedlevel.z_values[x][y] += value; }
set_bed_leveling_enabled(true);
bedlevel.refresh_bed_level();
SEND_PGM("A31V ");
LCD_SERIAL.print(float(probe.offset.z), 2);
SENDLINE_PGM("");
} }
if (CodeSeen('G')) { // get else if (CodeSeen('D')) { // Save Z Offset tables and restore leveling state
SAVE_zprobe_zoffset = probe.offset.z; if (!isPrinting()) {
SEND_PGM("A31V "); setAxisPosition_mm(5.0,Z); // Lift nozzle before any further movements are made
LCD_SERIAL.print(float(SAVE_zprobe_zoffset), 2); injectCommands(F("M500"));
SENDLINE_PGM(""); #if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNF(F("Mesh changes saved."));
#endif
selectedmeshpoint.x = selectedmeshpoint.y = 99;
}
} }
if (CodeSeen('D')) { // save else if (CodeSeen('G')) { // Get current offset
SAVE_zprobe_zoffset = probe.offset.z; if (isPrinting()) {
settings.save(); SEND_PGM("A31V ");
set_bed_leveling_enabled(true); LCD_SERIAL.print(live_Zoffset, 2);
bedlevel.refresh_bed_level(); SENDLINE_PGM("");
} else {
SEND_PGM("A31V ");
LCD_SERIAL.print(getZOffset_mm(), 2);
SENDLINE_PGM("");
selectedmeshpoint.x = selectedmeshpoint.y = 99;
}
}
else {
if (CodeSeen('S')) { // Set offset (adjusts all points by value)
float Zshift = CodeValue();
setSoftEndstopState(false);
if (isPrinting()) {
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("Change Zoffset from:", live_Zoffset, " to ", live_Zoffset + Zshift);
#endif
if (isAxisPositionKnown(Z)) {
#if ENABLED(ANYCUBIC_TFT_DEBUG)
const float currZpos = getAxisPosition_mm(Z);
SERIAL_ECHOLNPGM("Nudge Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
#endif
int16_t steps = mmToWholeSteps(constrain(Zshift,-0.05,0.05), Z);
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("Steps to move Z: ", steps);
#endif
babystepAxis_steps(steps, Z);
live_Zoffset += Zshift;
}
SEND_PGM("A31V ");
LCD_SERIAL.print(live_Zoffset, 2);
SENDLINE_PGM("");
}
else {
GRID_LOOP(x, y) {
const xy_uint8_t pos { x, y };
const float currval = getMeshPoint(pos);
setMeshPoint(pos, constrain(currval + Zshift, -10, 2));
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("Change mesh point X", x," Y",y ," from ", currval, " to ", getMeshPoint(pos) );
#endif
}
const float currZOffset = getZOffset_mm();
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("Change probe offset from ", currZOffset, " to ", currZOffset + Zshift);
#endif
setZOffset_mm(currZOffset + Zshift);
SEND_PGM("A31V ");
LCD_SERIAL.print(getZOffset_mm(), 2);
SENDLINE_PGM("");
if (isAxisPositionKnown(Z)) {
const float currZpos = getAxisPosition_mm(Z);
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(Zshift, -0.05, 0.05));
#endif
setAxisPosition_mm(currZpos+constrain(Zshift,-0.05,0.05),Z);
}
}
}
} }
SENDLINE_PGM("");
break; break;
case 32: // a32 clean leveling beep flag case 32: // a32 clean leveling beep flag
@@ -1697,25 +1655,36 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
case 34: // a34 bed grid write case 34: // a34 bed grid write
{ {
if (CodeSeen('X')) x = constrain(CodeValueInt(), 0, GRID_MAX_POINTS_X); xy_uint8_t pos;
if (CodeSeen('Y')) y = constrain(CodeValueInt(), 0, GRID_MAX_POINTS_Y); if (CodeSeen('X')) pos.x = constrain(CodeValueInt(), 0, GRID_MAX_POINTS_X);
if (CodeSeen('Y')) pos.y = constrain(CodeValueInt(), 0, GRID_MAX_POINTS_Y);
float currmesh = getMeshPoint(pos);
if (CodeSeen('V')) { if (CodeSeen('V')) {
float new_z_value = float(constrain(CodeValue() / 100, -10, 10)); float newval = float(constrain(CodeValue() / 100, -10, 10));
bedlevel.z_values[x][y] = new_z_value; #if ENABLED(ANYCUBIC_TFT_DEBUG)
set_bed_leveling_enabled(true); SERIAL_ECHOLNPGM("Change mesh point x:", pos.x, " y:", pos.y);
bedlevel.refresh_bed_level(); SERIAL_ECHOLNPGM("from ", currmesh, " to ", newval);
#endif
setMeshPoint(pos,newval);
if (mediaPrintingState == AMPRINTSTATE_NOT_PRINTING || mediaPrintingState == AMPRINTSTATE_PROBING) {
if (selectedmeshpoint.x == pos.x && selectedmeshpoint.y == pos.y) {
setSoftEndstopState(false);
float currZpos = getAxisPosition_mm(Z);
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("Move Z pos from ", currZpos, " to ", currZpos + constrain(newval - currmesh, -0.05, 0.05));
#endif
setAxisPosition_mm(currZpos + constrain(newval - currmesh, -0.05, 0.05), Z);
}
}
} }
if (CodeSeen('S')) { if (CodeSeen('S')) {
bedlevel.refresh_bed_level(); injectCommands(F("M500"));
set_bed_leveling_enabled(true);
settings.save();
} }
if (CodeSeen('C')) { if (CodeSeen('C')) {
restore_z_values(); injectCommands(F("M501\nM420 S1"));
probe.offset.z = SAVE_zprobe_zoffset; selectedmeshpoint.x = selectedmeshpoint.y = 99;
set_bed_leveling_enabled(true);
bedlevel.refresh_bed_level();
} }
} }
break; break;
@@ -1725,13 +1694,8 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
break; break;
case 36: // A36 auto leveling (New Anycubic TFT) case 36: // A36 auto leveling (New Anycubic TFT)
if (isPrinting()) SENDLINE_DBG_PGM("J26", "TFT Serial Debug: Start auto leveling... J26");
SENDLINE_DBG_PGM("J24", "TFT Serial Debug: Forbid auto leveling... J24"); break;
else
SENDLINE_DBG_PGM("J26", "TFT Serial Debug: Start auto leveling... J26");
if (CodeSeen('S'))
queue.enqueue_now_P(PSTR("G28\nG29\nM500\nG90\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300\nG1 Z30 F4000\nG1 X0 F4000\nG91\nM84"));
#endif // if ENABLED(KNUTWURST_TFT_LEVELING) #endif // if ENABLED(KNUTWURST_TFT_LEVELING)
#if ENABLED(KNUTWURST_4MAXP2) #if ENABLED(KNUTWURST_4MAXP2)
@@ -1743,19 +1707,35 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
case 41: case 41:
if (CodeSeen('O')) { if (CodeSeen('O')) {
PrintdoneAndPowerOFF = true; PrintdoneAndPowerOFF = true;
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: PrintdoneAndPowerOFF is set!");
#endif
break; break;
} }
else if (CodeSeen('C')) { else if (CodeSeen('C')) {
PrintdoneAndPowerOFF = false; PrintdoneAndPowerOFF = false;
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: PrintdoneAndPowerOFF is disabled!");
#endif
break; break;
} }
if (CodeSeen('S')) { if (CodeSeen('S')) {
if (PrintdoneAndPowerOFF) if (PrintdoneAndPowerOFF) {
SENDLINE_PGM("J35 "); #if ENABLED(ANYCUBIC_TFT_DEBUG)
else SERIAL_ECHOLNPGM("TFT Serial Debug: Sending J35 because PrintdoneAndPowerOFF = true");
SENDLINE_PGM("J34 "); #endif
SEND_PGM("J35 ");
SENDLINE_PGM("");
} else {
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: Sending J34 because PrintdoneAndPowerOFF = false");
#endif
SEND_PGM("J34 ");
SENDLINE_PGM("");
}
} }
// break; <-- TODO: do we need it? break;
case 42: case 42:
if (CaseLight == true) { if (CaseLight == true) {
SERIAL_ECHOLNPGM("Case Light OFF"); SERIAL_ECHOLNPGM("Case Light OFF");
@@ -1767,7 +1747,8 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
injectCommands(F("M355 S1 P255")); injectCommands(F("M355 S1 P255"));
CaseLight = true; CaseLight = true;
} }
// break; <-- TODO: do we need it? break;
#endif #endif
#if ENABLED(KNUTWURST_DGUS2_TFT) #if ENABLED(KNUTWURST_DGUS2_TFT)
case 50: case 50:
@@ -1959,6 +1940,9 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
#if ENABLED(KNUTWURST_4MAXP2) #if ENABLED(KNUTWURST_4MAXP2)
void PowerDown() { void PowerDown() {
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNPGM("TFT Serial Debug: PowerDown is called!");
#endif
for (unsigned char i = 0; i < 3; i++) { for (unsigned char i = 0; i < 3; i++) {
WRITE(POWER_OFF_PIN, LOW); WRITE(POWER_OFF_PIN, LOW);
delay(10); delay(10);
@@ -1987,6 +1971,13 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
} }
} }
#if ENABLED(KNUTWURST_4MAXP2)
if (PrintdoneAndPowerOFF && powerOFFflag && (thermalManager.degHotend(0) < 50 )) {
powerOFFflag = 0;
PowerDown();
}
#endif
if (TFTbuflen < (TFTBUFSIZE - 1)) if (TFTbuflen < (TFTBUFSIZE - 1))
GetCommandFromTFT(); GetCommandFromTFT();
@@ -1998,9 +1989,12 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
void AnycubicTouchscreenClass::OnPrintTimerStarted() { void AnycubicTouchscreenClass::OnPrintTimerStarted() {
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
if (mediaPrintingState == AMPRINTSTATE_PRINTING) if (mediaPrintingState == AMPRINTSTATE_PRINTING) {
SENDLINE_DBG_PGM("J04", "TFT Serial Debug: Starting SD Print... J04"); // J04 Starting Print SENDLINE_DBG_PGM("J04", "TFT Serial Debug: Starting SD Print... soft endstops disabled J04"); // J04 Starting Print
setSoftEndstopState(false);
live_Zoffset = 0.0;
powerOFFflag = 0;
}
#endif #endif
} }
@@ -2018,7 +2012,9 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
if (mediaPrintingState == AMPRINTSTATE_PRINTING) { if (mediaPrintingState == AMPRINTSTATE_PRINTING) {
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
SENDLINE_DBG_PGM("J14", "TFT Serial Debug: SD Print Completed... J14"); setSoftEndstopState(true);
powerOFFflag = 1;
SENDLINE_DBG_PGM("J14", "TFT Serial Debug: SD Print Completed... soft endstops enabled J14");
} }
// otherwise it was stopped by the printer so don't send print completed signal to TFT // otherwise it was stopped by the printer so don't send print completed signal to TFT
#endif #endif

View File

@@ -21,15 +21,9 @@
#ifndef anycubic_touchscreen_h #ifndef anycubic_touchscreen_h
#define anycubic_touchscreen_h #define anycubic_touchscreen_h
// #include <stdio.h>
// #include "../inc/MarlinConfig.h"
// #include "../module/configuration_store.h"
#include "../../../inc/MarlinConfigPre.h" #include "../../../inc/MarlinConfigPre.h"
#include "../../../module/probe.h" #include "../../../module/probe.h"
void initializeGrid();
char *itostr2(const uint8_t &x); char *itostr2(const uint8_t &x);
#ifndef ULTRA_LCD #ifndef ULTRA_LCD
@@ -47,7 +41,8 @@ enum AnycubicMediaPrintState {
AMPRINTSTATE_PRINTING, AMPRINTSTATE_PRINTING,
AMPRINTSTATE_PAUSE_REQUESTED, AMPRINTSTATE_PAUSE_REQUESTED,
AMPRINTSTATE_PAUSED, AMPRINTSTATE_PAUSED,
AMPRINTSTATE_STOP_REQUESTED AMPRINTSTATE_STOP_REQUESTED,
AMPRINTSTATE_PROBING
}; };
enum AnycubicMediaPauseState { enum AnycubicMediaPauseState {
@@ -62,188 +57,141 @@ enum AnycubicMediaPauseState {
AMPAUSESTATE_PAUSED AMPAUSESTATE_PAUSED
}; };
#define SM_DIR_UP_S "DIR_UP~1.GCO"
#define SM_SPECIAL_MENU_S "<SPECI~1.GCO"
#define SM_PID_HOTEND_S "<PIDTU~1.GCO"
#define SM_PID_BED_S "<PIDTU~2.GCO"
#define SM_SAVE_EEPROM_S "<SAVEE~1.GCO"
#define SM_LOAD_DEFAULTS_S "<LOADF~1.GCO"
#define SM_PREHEAT_BED_S "<PREHE~1.GCO"
#define SM_MESH_MENU_S "<MESHL~1.GCO"
#define SM_MESH_START_S "<START~1.GCO"
#define SM_MESH_NEXT_S "<NEXTM~1.GCO"
#define SM_Z_UP_01_S "<ZUP01~1.GCO"
#define SM_Z_DN_01_S "<ZDOWN~1.GCO"
#define SM_Z_UP_002_S "<ZUP00~1.GCO"
#define SM_Z_DN_002_S "<ZDOWN~2.GCO"
#define SM_Z_UP_001_S "<ZUP00~2.GCO"
#define SM_Z_DN_001_S "<ZDOWN~3.GCO"
#define SM_BLTOUCH_S "<BLTOU~1.GCO"
#define SM_RESETLV_S "<RSTLV~1.GCO"
#define SM_PAUSE_S "<FILCH~2.GCO"
#define SM_RESUME_S "<FILCH~1.GCO"
#define SM_DIS_FILSENS_S "<DISAB~1.GCO"
#define SM_EN_FILSENS_S "<ENABL~1.GCO"
#define SM_EXIT_S "<EXIT_~1.GCO"
#define SM_BACK_S "<BACK_~1.GCO"
#define SM_FLOWMENU_S "<SETFLO1.GCO"
#define SM_FLOW_DISP_S "<FLDISPL.GCO"
#define SM_FLOW_UP_S "<UPFLOW1.GCO"
#define SM_FLOW_DN_S "<DWNFLOW.GCO"
#define SM_FLOW_EXIT_S "<EXTFLW1.GCO"
#define SM_EZLVL_MENU_S "<EZLVLM1.GCO"
#define SM_EZLVL_P1_S "<EZLPA01.GCO"
#define SM_EZLVL_P2_S "<EZLPB01.GCO"
#define SM_EZLVL_P3_S "<EZLPC01.GCO"
#define SM_EZLVL_P4_S "<EZLPD01.GCO"
#define SM_EZLVL_EXIT_S "<EZLEXT1.GCO"
#define SM_BLTZMENU_S "<SETOFZ0.GCO"
#define SM_BLTZ_DISP_S "<OFZDSP0.GCO"
#define SM_BLTZ_UP_S "<UPOFFZ0.GCO"
#define SM_BLTZ_DN_S "<DOWNOFZ.GCO"
#define SM_BLTZ_EXIT_S "<EXTABLM.GCO"
#define SM_HS_DISABLE_S "<HSDISAB.GCO"
#define SM_HS_ENABLE_S "<HSENABL.GCO"
#if DISABLED(KNUTWURST_DGUS2_TFT) #if DISABLED(KNUTWURST_DGUS2_TFT)
#define SM_DIR_UP_L "/.." #define SM_DIR_UP_L "/.."
#define SM_DIR_UP_S ".."
#define SM_SPECIAL_MENU_L "<Special Menu>" #define SM_SPECIAL_MENU_L "<Special Menu>"
#define SM_SPECIAL_MENU_S "<SPECM>"
#define SM_PID_HOTEND_L "<PID Tune Hotend>" #define SM_PID_HOTEND_L "<PID Tune Hotend>"
#define SM_PID_HOTEND_S "<PIDHE>"
#define SM_PID_BED_L "<PID Tune Ultrabase>" #define SM_PID_BED_L "<PID Tune Ultrabase>"
#define SM_PID_BED_S "<PIDUB>"
#define SM_SAVE_EEPROM_L "<Save EEPROM>" #define SM_SAVE_EEPROM_L "<Save EEPROM>"
#define SM_SAVE_EEPROM_S "<SAVEE>"
#define SM_LOAD_DEFAULTS_L "<Load FW Defaults>" #define SM_LOAD_DEFAULTS_L "<Load FW Defaults>"
#define SM_LOAD_DEFAULTS_S "<LDDEF>"
#define SM_PREHEAT_BED_L "<Preheat Ultrabase>" #define SM_PREHEAT_BED_L "<Preheat Ultrabase>"
#define SM_PREHEAT_BED_S "<PREHE>"
#define SM_MESH_MENU_L "<Mesh Leveling>" #define SM_MESH_MENU_L "<Mesh Leveling>"
#define SM_MESH_MENU_S "<MESHL>"
#define SM_MESH_START_L "<Start Mesh Leveling>" #define SM_MESH_START_L "<Start Mesh Leveling>"
#define SM_MESH_START_S "<SMESH>"
#define SM_MESH_NEXT_L "<Next Mesh Point>" #define SM_MESH_NEXT_L "<Next Mesh Point>"
#define SM_MESH_NEXT_S "<NEXTM>"
#define SM_Z_UP_01_L "<Z Up 0.1>" #define SM_Z_UP_01_L "<Z Up 0.1>"
#define SM_Z_UP_01_S "<ZUP01>"
#define SM_Z_DN_01_L "<Z Down 0.1>" #define SM_Z_DN_01_L "<Z Down 0.1>"
#define SM_Z_DN_01_S "<ZDN01>"
#define SM_Z_UP_002_L "<Z Up 0.02>" #define SM_Z_UP_002_L "<Z Up 0.02>"
#define SM_Z_UP_002_S "<ZUP002>"
#define SM_Z_DN_002_L "<Z Down 0.02>" #define SM_Z_DN_002_L "<Z Down 0.02>"
#define SM_Z_DN_002_S "<ZDN002>"
#define SM_Z_UP_001_L "<Z Up 0.01>" #define SM_Z_UP_001_L "<Z Up 0.01>"
#define SM_Z_UP_001_S "<ZUP001>"
#define SM_Z_DN_001_L "<Z Down 0.01>" #define SM_Z_DN_001_L "<Z Down 0.01>"
#define SM_Z_DN_001_S "<ZDN001>"
#define SM_BLTOUCH_L "<Start Auto Leveling>" #define SM_BLTOUCH_L "<Start Auto Leveling>"
#define SM_BLTOUCH_S "<BLTCH>"
#define SM_RESETLV_L "<Reset Level Grid>" #define SM_RESETLV_L "<Reset Level Grid>"
#define SM_RESETLV_S "<RSTLV>"
#define SM_PAUSE_L "<Fil. Change Pause>" #define SM_PAUSE_L "<Fil. Change Pause>"
#define SM_PAUSE_S "<PAUSE>"
#define SM_RESUME_L "<Fil. Change Resume>" #define SM_RESUME_L "<Fil. Change Resume>"
#define SM_RESUME_S "<RESUM>"
#define SM_DIS_FILSENS_L "<Disable Fil. Sensor>" #define SM_DIS_FILSENS_L "<Disable Fil. Sensor>"
#define SM_DIS_FILSENS_S "<DISSEN>"
#define SM_EN_FILSENS_L "<Enable Fil. Sensor>" #define SM_EN_FILSENS_L "<Enable Fil. Sensor>"
#define SM_EN_FILSENS_S "<ENSEN>"
#define SM_EXIT_L "<Exit>" #define SM_EXIT_L "<Exit>"
#define SM_EXIT_S "<SMEXIT>"
#define SM_BACK_L "<End Mesh Leveling>" #define SM_BACK_L "<End Mesh Leveling>"
#define SM_BACK_S "<BACK>"
#define SM_FLOWMENU_L "<Set Flowrate>" #define SM_FLOWMENU_L "<Set Flowrate>"
#define SM_FLOWMENU_S "<SETFLO>"
#define SM_FLOW_DISP_L "<Flow is XXX>" #define SM_FLOW_DISP_L "<Flow is XXX>"
#define SM_FLOW_DISP_S "<FLDISP>"
#define SM_FLOW_UP_L "<Up>" #define SM_FLOW_UP_L "<Up>"
#define SM_FLOW_UP_S "<FLUP>"
#define SM_FLOW_DN_L "<Down>" #define SM_FLOW_DN_L "<Down>"
#define SM_FLOW_DN_S "<FLDN>"
#define SM_FLOW_EXIT_L "<Exit Flow Settings>" #define SM_FLOW_EXIT_L "<Exit Flow Settings>"
#define SM_FLOW_EXIT_S "<EXTFLW>"
#define SM_EZLVL_MENU_L "<Easy 4 Point Level>" #define SM_EZLVL_MENU_L "<Easy 4 Point Level>"
#define SM_EZLVL_MENU_S "<EZLVLM>"
#define SM_EZLVL_P1_L "<Point A>" #define SM_EZLVL_P1_L "<Point A>"
#define SM_EZLVL_P1_S "<EZLPA>"
#define SM_EZLVL_P2_L "<Point B>" #define SM_EZLVL_P2_L "<Point B>"
#define SM_EZLVL_P2_S "<EZLPB>"
#define SM_EZLVL_P3_L "<Point C>" #define SM_EZLVL_P3_L "<Point C>"
#define SM_EZLVL_P3_S "<EZLPC>"
#define SM_EZLVL_P4_L "<Point D>" #define SM_EZLVL_P4_L "<Point D>"
#define SM_EZLVL_P4_S "<EZLPD>"
#define SM_EZLVL_EXIT_L "<Exit Easy Level>" #define SM_EZLVL_EXIT_L "<Exit Easy Level>"
#define SM_EZLVL_EXIT_S "<EZLEXT>"
#define SM_BLTZMENU_L "<Auto Leveling>" #define SM_BLTZMENU_L "<Auto Leveling>"
#define SM_BLTZMENU_S "<SETOFZ>"
#define SM_BLTZ_DISP_L "<Z Offset: XXXXX>" #define SM_BLTZ_DISP_L "<Z Offset: XXXXX>"
#define SM_BLTZ_DISP_S "<OFZDSP>"
#define SM_BLTZ_UP_L "<Up>" #define SM_BLTZ_UP_L "<Up>"
#define SM_BLTZ_UP_S "<UPOFFZ0>"
#define SM_BLTZ_DN_L "<Down>" #define SM_BLTZ_DN_L "<Down>"
#define SM_BLTZ_DN_S "<DNOFFZ0>"
#define SM_BLTZ_EXIT_L "<SAVE and EXIT>" #define SM_BLTZ_EXIT_L "<SAVE and EXIT>"
#define SM_BLTZ_EXIT_S "<EXTABLM>" #define SM_HS_DISABLE_L "<Disable HiSpeed Mode>"
#define SM_HS_ENABLE_L "<Enable HiSpeed Mode>"
#endif // !KNUTWURST_DGUS2_TFT #endif // !KNUTWURST_DGUS2_TFT
#if ENABLED(KNUTWURST_DGUS2_TFT) #if ENABLED(KNUTWURST_DGUS2_TFT)
#define SM_DIR_UP_L "<<< BACK <<< .gcode" #define SM_DIR_UP_L "/.. .gcode"
#define SM_DIR_UP_S "DIR_UP~1.GCO"
#define SM_SPECIAL_MENU_L "<Special Menu> .gcode" #define SM_SPECIAL_MENU_L "<Special Menu> .gcode"
#define SM_SPECIAL_MENU_S "<SPECI~1.GCO"
#define SM_PID_HOTEND_L "<PID Tune Hotend> .gcode" #define SM_PID_HOTEND_L "<PID Tune Hotend> .gcode"
#define SM_PID_HOTEND_S "<PIDTU~1.GCO"
#define SM_PID_BED_L "<PID Tune Ultrabase>.gcode" #define SM_PID_BED_L "<PID Tune Ultrabase>.gcode"
#define SM_PID_BED_S "<PIDTU~2.GCO"
#define SM_SAVE_EEPROM_L "<Save EEPROM> .gcode" #define SM_SAVE_EEPROM_L "<Save EEPROM> .gcode"
#define SM_SAVE_EEPROM_S "<SAVEE~1.GCO"
#define SM_LOAD_DEFAULTS_L "<Load FW Defaults> .gcode" #define SM_LOAD_DEFAULTS_L "<Load FW Defaults> .gcode"
#define SM_LOAD_DEFAULTS_S "<LOADF~1.GCO"
#define SM_PREHEAT_BED_L "<Preheat Ultrabase> .gcode" #define SM_PREHEAT_BED_L "<Preheat Ultrabase> .gcode"
#define SM_PREHEAT_BED_S "<PREHE~1.GCO"
#define SM_MESH_MENU_L "<Mesh Leveling> .gcode" #define SM_MESH_MENU_L "<Mesh Leveling> .gcode"
#define SM_MESH_MENU_S "<MESHL~1.GCO"
#define SM_MESH_START_L "<Start MeshLeveling>.gcode" #define SM_MESH_START_L "<Start MeshLeveling>.gcode"
#define SM_MESH_START_S "<START~1.GCO"
#define SM_MESH_NEXT_L "<Next Mesh Point> .gcode" #define SM_MESH_NEXT_L "<Next Mesh Point> .gcode"
#define SM_MESH_NEXT_S "<NEXTM~1.GCO"
#define SM_Z_UP_01_L "<Z Up 0.1> .gcode" #define SM_Z_UP_01_L "<Z Up 0.1> .gcode"
#define SM_Z_UP_01_S "<ZUP01~1.GCO"
#define SM_Z_DN_01_L "<Z Down 0.1> .gcode" #define SM_Z_DN_01_L "<Z Down 0.1> .gcode"
#define SM_Z_DN_01_S "<ZDOWN~1.GCO"
#define SM_Z_UP_002_L "<Z Up 0.02> .gcode" #define SM_Z_UP_002_L "<Z Up 0.02> .gcode"
#define SM_Z_UP_002_S "<ZUP00~1.GCO"
#define SM_Z_DN_002_L "<Z Down 0.02> .gcode" #define SM_Z_DN_002_L "<Z Down 0.02> .gcode"
#define SM_Z_DN_002_S "<ZDOWN~2.GCO"
#define SM_Z_UP_001_L "<Z Up 0.01> .gcode" #define SM_Z_UP_001_L "<Z Up 0.01> .gcode"
#define SM_Z_UP_001_S "<ZUP00~2.GCO"
#define SM_Z_DN_001_L "<Z Down 0.01> .gcode" #define SM_Z_DN_001_L "<Z Down 0.01> .gcode"
#define SM_Z_DN_001_S "<ZDOWN~3.GCO"
#define SM_BLTOUCH_L "<Start AutoLeveling>.gcode" #define SM_BLTOUCH_L "<Start AutoLeveling>.gcode"
#define SM_BLTOUCH_S "<BLTOU~1.GCO"
#define SM_RESETLV_L "<Reset Level Grid> .gcode" #define SM_RESETLV_L "<Reset Level Grid> .gcode"
#define SM_RESETLV_S "<RSTLV~1.GCO>"
#define SM_PAUSE_L "<Fil. Change Pause> .gcode" #define SM_PAUSE_L "<Fil. Change Pause> .gcode"
#define SM_PAUSE_S "<FILCH~2.GCO"
#define SM_RESUME_L "<Fil. Change Resume>.gcode" #define SM_RESUME_L "<Fil. Change Resume>.gcode"
#define SM_RESUME_S "<FILCH~1.GCO"
#define SM_DIS_FILSENS_L "<Disable Fil.Sensor>.gcode" #define SM_DIS_FILSENS_L "<Disable Fil.Sensor>.gcode"
#define SM_DIS_FILSENS_S "<DISAB~1.GCO"
#define SM_EN_FILSENS_L "<Enable Fil. Sensor>.gcode" #define SM_EN_FILSENS_L "<Enable Fil. Sensor>.gcode"
#define SM_EN_FILSENS_S "<ENABL~1.GCO"
#define SM_EXIT_L "<Exit> .gcode" #define SM_EXIT_L "<Exit> .gcode"
#define SM_EXIT_S "<EXIT_~1.GCO"
#define SM_BACK_L "<End Mesh Leveling> .gcode" #define SM_BACK_L "<End Mesh Leveling> .gcode"
#define SM_BACK_S "<BACK_~1.GCO"
#define SM_FLOWMENU_L "<Set Flowrate> .gcode" #define SM_FLOWMENU_L "<Set Flowrate> .gcode"
#define SM_FLOWMENU_S "<SETFLO1.GCO"
#define SM_FLOW_DISP_L "<Flow is XXX%> .gcode" #define SM_FLOW_DISP_L "<Flow is XXX%> .gcode"
#define SM_FLOW_DISP_S "<FLDISPL.GCO"
#define SM_FLOW_UP_L "<Up> .gcode" #define SM_FLOW_UP_L "<Up> .gcode"
#define SM_FLOW_UP_S "<UPFLOW1.GCO"
#define SM_FLOW_DN_L "<Down> .gcode" #define SM_FLOW_DN_L "<Down> .gcode"
#define SM_FLOW_DN_S "<DWNFLOW.GCO"
#define SM_FLOW_EXIT_L "<Exit Flow Settings>.gcode" #define SM_FLOW_EXIT_L "<Exit Flow Settings>.gcode"
#define SM_FLOW_EXIT_S "<EXTFLW1.GCO"
#define SM_EZLVL_MENU_L "<Easy 4 Point Level>.gcode" #define SM_EZLVL_MENU_L "<Easy 4 Point Level>.gcode"
#define SM_EZLVL_MENU_S "<EZLVLM1.GCO"
#define SM_EZLVL_P1_L "<Point A> .gcode" #define SM_EZLVL_P1_L "<Point A> .gcode"
#define SM_EZLVL_P1_S "<EZLPA01.GCO"
#define SM_EZLVL_P2_L "<Point B> .gcode" #define SM_EZLVL_P2_L "<Point B> .gcode"
#define SM_EZLVL_P2_S "<EZLPB01.GCO"
#define SM_EZLVL_P3_L "<Point C> .gcode" #define SM_EZLVL_P3_L "<Point C> .gcode"
#define SM_EZLVL_P3_S "<EZLPC01.GCO"
#define SM_EZLVL_P4_L "<Point D> .gcode" #define SM_EZLVL_P4_L "<Point D> .gcode"
#define SM_EZLVL_P4_S "<EZLPD01.GCO"
#define SM_EZLVL_EXIT_L "<Exit Easy Leveling>.gcode" #define SM_EZLVL_EXIT_L "<Exit Easy Leveling>.gcode"
#define SM_EZLVL_EXIT_S "<EZLEXT1.GCO"
#define SM_BLTZMENU_L "<Auto Leveling> .gcode" #define SM_BLTZMENU_L "<Auto Leveling> .gcode"
#define SM_BLTZMENU_S "<SETOFZ0.GCO"
#define SM_BLTZ_DISP_L "<Z Offset: XXXXX> .gcode" #define SM_BLTZ_DISP_L "<Z Offset: XXXXX> .gcode"
#define SM_BLTZ_DISP_S "<OFZDSP0.GCO"
#define SM_BLTZ_UP_L "<Up> .gcode" #define SM_BLTZ_UP_L "<Up> .gcode"
#define SM_BLTZ_UP_S "<UPOFFZ0.GCO"
#define SM_BLTZ_DN_L "<Down> .gcode" #define SM_BLTZ_DN_L "<Down> .gcode"
#define SM_BLTZ_DN_S "<DOWNOFZ.GCO"
#define SM_BLTZ_EXIT_L "<SAVE and EXIT> .gcode" #define SM_BLTZ_EXIT_L "<SAVE and EXIT> .gcode"
#define SM_BLTZ_EXIT_S "<EXTABLM.GCO" #define SM_HS_DISABLE_L "<Disable HiSpeed> .gcode"
#define SM_HS_ENABLE_L "<Enable HiSpeed> .gcode"
#endif // KNUTWURST_DGUS2_TFT #endif // KNUTWURST_DGUS2_TFT
#if ENABLED(KNUTWURST_TFT_LEVELING)
// eeprom_index
extern int z_values_index;
extern int z_values_size;
// temp value which needs to be saved
extern float SAVE_zprobe_zoffset;
#endif
class AnycubicTouchscreenClass { class AnycubicTouchscreenClass {
public: public:
@@ -257,9 +205,9 @@ void UserConfirmRequired(const char *);
void SDCardStateChange(bool); void SDCardStateChange(bool);
void SDCardError(); void SDCardError();
void KillTFT(); void KillTFT();
static void OnPrintTimerStarted(); void OnPrintTimerStarted();
static void OnPrintTimerPaused(); void OnPrintTimerPaused();
static void OnPrintTimerStopped(); void OnPrintTimerStopped();
#if BOTH(ANYCUBIC_TFT_DEBUG, KNUTWURST_DGUS2_TFT) #if BOTH(ANYCUBIC_TFT_DEBUG, KNUTWURST_DGUS2_TFT)
void Command(const char * const command); void Command(const char * const command);
@@ -279,15 +227,13 @@ int serial3_count = 0;
char *TFTstrchr_pointer; char *TFTstrchr_pointer;
char FlagResumFromOutage = 0; char FlagResumFromOutage = 0;
int filenumber = 0; int filenumber = 0;
unsigned long starttime = 0;
unsigned long stoptime = 0;
uint8_t tmp_extruder = 0; uint8_t tmp_extruder = 0;
char LastSDstatus = 0;
uint16_t HeaterCheckCount = 0; uint16_t HeaterCheckCount = 0;
bool IsParked = false;
int currentFlowRate = 0; int currentFlowRate = 0;
bool PrintdoneAndPowerOFF = true; bool PrintdoneAndPowerOFF = true;
bool powerOFFflag = 0; bool powerOFFflag = 0;
xy_uint8_t selectedmeshpoint;
float live_Zoffset;
static AnycubicMediaPrintState mediaPrintingState; static AnycubicMediaPrintState mediaPrintingState;
static AnycubicMediaPauseState mediaPauseState; static AnycubicMediaPauseState mediaPauseState;
@@ -309,16 +255,13 @@ float CodeValue();
bool CodeSeen(char); bool CodeSeen(char);
void StartPrint(); void StartPrint();
void PausePrint(); void PausePrint();
void ResumePrint();
void StopPrint(); void StopPrint();
void StateHandler();
void GetCommandFromTFT(); void GetCommandFromTFT();
void CheckSDCardChange(); void CheckSDCardChange();
void CheckHeaterError(); void CheckHeaterError();
void HandleSpecialMenu();
void FilamentChangePause(); void FilamentChangePause();
void ResumePrint(); void HandleSpecialMenu();
void ReheatNozzle();
void ParkAfterStop();
void RenderCurrentFileList(); void RenderCurrentFileList();
void RenderSpecialMenu(uint16_t); void RenderSpecialMenu(uint16_t);
void RenderCurrentFolder(uint16_t); void RenderCurrentFolder(uint16_t);
@@ -327,7 +270,6 @@ char currentTouchscreenSelection[64];
char currentFileOrDirectory[64]; char currentFileOrDirectory[64];
String flowRateBuffer; String flowRateBuffer;
String zOffsetBuffer; String zOffsetBuffer;
uint8_t FilamentSensorEnabled = true;
uint8_t SpecialMenu = false; uint8_t SpecialMenu = false;
uint8_t MMLMenu = false; uint8_t MMLMenu = false;

View File

@@ -289,24 +289,10 @@
#if ANY(KNUTWURST_CHIRON, KNUTWURST_4MAXP2) #if ANY(KNUTWURST_CHIRON, KNUTWURST_4MAXP2)
#define FIL_RUNOUT_PIN 33 #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 #else
#define FIL_RUNOUT_PIN 19 #define FIL_RUNOUT_PIN 19
#endif #endif
#ifndef PS_ON_PIN #ifndef PS_ON_PIN
#define PS_ON_PIN 12 #define PS_ON_PIN 12
#endif #endif

View File

@@ -142,19 +142,6 @@
#define Z_CS_PIN 40 #define Z_CS_PIN 40
#endif #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_STEP_PIN 26
#define E0_DIR_PIN 28 #define E0_DIR_PIN 28
#define E0_ENABLE_PIN 24 #define E0_ENABLE_PIN 24

View File

@@ -103,7 +103,7 @@
#endif #endif
#endif #endif
#if ANY(TRIGORILLA_MAPPING_CHIRON, SWAP_Z_MOTORS, KNUTWURST_CHIRON, KNUTWURST_4MAXP2) // PATCH: knutwurst #if EITHER(TRIGORILLA_MAPPING_CHIRON, SWAP_Z_MOTORS)
// Chiron and some Anycubic i3 MEGAs swap Z steppers // Chiron and some Anycubic i3 MEGAs swap Z steppers
#define Z_STEP_PIN 36 #define Z_STEP_PIN 36
#define Z_DIR_PIN 34 #define Z_DIR_PIN 34