Compare commits
46 Commits
1.5.0-beta
...
1.5.0-RC1
Author | SHA1 | Date | |
---|---|---|---|
|
501ebfd159 | ||
|
dedc00fb0d | ||
|
acc3c74905 | ||
|
d1f269d654 | ||
|
d4fe673b96 | ||
|
862ac308c7 | ||
|
75c541cafb | ||
|
bb4ee37676 | ||
|
bf80c9b8dd | ||
|
79eaf1a8b5 | ||
|
ff5b808dea | ||
|
37ef0ca742 | ||
|
fd84ec3523 | ||
|
afa411f065 | ||
|
d93ff45af6 | ||
|
8fb71f482e | ||
|
325bcb7e01 | ||
|
0af71b9817 | ||
|
8e828a48b9 | ||
|
a356788dc7 | ||
|
6499c6b7c3 | ||
|
fda51c1c46 | ||
|
0c25c876d3 | ||
|
067fe2f074 | ||
|
e8d38ba955 | ||
|
6d257896c0 | ||
|
2af4a2d4e6 | ||
|
c83dad91f3 | ||
|
429b8cc1fa | ||
|
2e030524e2 | ||
|
45cbc380d9 | ||
|
cf0611a7d9 | ||
|
9c4c58235b | ||
|
75ffa32980 | ||
|
e0d858d812 | ||
|
ad86d96a31 | ||
|
6c4a0a887a | ||
|
e940c218cd | ||
|
1df0ee59d2 | ||
|
9244ea5890 | ||
|
8e34d7dc7c | ||
|
7fbbbba752 | ||
|
2b5816037a | ||
|
e008a96269 | ||
|
952e0db31e | ||
|
69efa3376a |
@@ -59,6 +59,7 @@
|
||||
*/
|
||||
#if ENABLED(KNUTWURST_CHIRON)
|
||||
#define TRIGORILLA_MAPPING_CHIRON
|
||||
#define NO_AUTO_ASSIGN_WARNING
|
||||
#else
|
||||
#define TRIGORILLA_MAPPING_I3MEGA
|
||||
#define SWAP_Z_MOTORS
|
||||
@@ -94,6 +95,7 @@
|
||||
*/
|
||||
#if ENABLED(KNUTWURST_4MAXP2)
|
||||
#define ANYCUBIC_4_MAX_PRO_ENDSTOPS
|
||||
#define NO_AUTO_ASSIGN_WARNING
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1939,7 +1941,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
|
||||
@@ -2851,14 +2853,14 @@
|
||||
// Preheat Constants - Up to 10 are supported without changes
|
||||
//
|
||||
#define PREHEAT_1_LABEL "PLA"
|
||||
#define PREHEAT_1_TEMP_HOTEND 180
|
||||
#define PREHEAT_1_TEMP_BED 70
|
||||
#define PREHEAT_1_TEMP_HOTEND 200
|
||||
#define PREHEAT_1_TEMP_BED 60
|
||||
// #define PREHEAT_1_TEMP_CHAMBER 35
|
||||
#define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255
|
||||
|
||||
#define PREHEAT_2_LABEL "ABS"
|
||||
#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_FAN_SPEED 0 // Value from 0 to 255
|
||||
|
||||
|
@@ -1611,7 +1611,7 @@
|
||||
* - 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!)
|
||||
*/
|
||||
// #define SDCARD_SORT_ALPHA
|
||||
#define SDCARD_SORT_ALPHA
|
||||
|
||||
// SD Card Sorting options
|
||||
#if ENABLED(SDCARD_SORT_ALPHA)
|
||||
@@ -2658,29 +2658,73 @@
|
||||
*/
|
||||
#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 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 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
|
||||
|
||||
#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 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
|
||||
|
||||
#if NONE(KNUTWURST_CHIRON, 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.
|
||||
#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.
|
||||
|
||||
|
@@ -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-b5"
|
||||
#define CUSTOM_BUILD_VERSION "1.5.0-RC1"
|
||||
|
||||
#ifndef STRING_DISTRIBUTION_DATE
|
||||
#define STRING_DISTRIBUTION_DATE "2023-05-28"
|
||||
#define STRING_DISTRIBUTION_DATE "2023-06-02"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@@ -26,15 +26,15 @@
|
||||
|
||||
#include "../ui_api.h"
|
||||
#include "../../../gcode/queue.h"
|
||||
#include "../../../feature/bedlevel/bedlevel.h"
|
||||
#include "../../../libs/buzzer.h"
|
||||
#include "../../../libs/numtostr.h"
|
||||
#include "../../../module/temperature.h"
|
||||
#include "../../../module/motion.h"
|
||||
#include "../../../module/settings.h"
|
||||
#include "../../../module/stepper.h"
|
||||
|
||||
//#define ANYCUBIC_TFT_DEBUG
|
||||
//#define KNUTWURST_DGUS2_TFT
|
||||
//#define KNUTWURST_TFT_LEVELING
|
||||
|
||||
#ifdef ANYCUBIC_TOUCHSCREEN
|
||||
#include "./anycubic_touchscreen.h"
|
||||
@@ -68,80 +68,6 @@
|
||||
AnycubicMediaPrintState AnycubicTouchscreenClass::mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
|
||||
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++;
|
||||
} 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)
|
||||
int PowerInt = 6;
|
||||
@@ -193,7 +119,6 @@
|
||||
BLTouchMenu = false;
|
||||
LevelMenu = false;
|
||||
CaseLight = false;
|
||||
MyFileNrCnt = 0;
|
||||
currentFlowRate = 100;
|
||||
flowRateBuffer = SM_FLOW_DISP_L;
|
||||
|
||||
@@ -205,11 +130,6 @@
|
||||
SET_INPUT_PULLUP(FIL_RUNOUT1_PIN);
|
||||
#endif
|
||||
|
||||
#if ENABLED(KNUTWURST_TFT_LEVELING)
|
||||
setupMyZoffset();
|
||||
delay(10);
|
||||
#endif
|
||||
|
||||
setup_OutageTestPin();
|
||||
setup_PowerOffPin();
|
||||
|
||||
@@ -218,7 +138,6 @@
|
||||
CheckHeaterError();
|
||||
DoFilamentRunoutCheck();
|
||||
|
||||
|
||||
#ifdef STARTUP_CHIME
|
||||
BUZZ(100, 554);
|
||||
BUZZ(100, 740);
|
||||
@@ -412,7 +331,7 @@
|
||||
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_SAVE_EEPROM_S)) != NULL)
|
||||
) {
|
||||
SERIAL_ECHOLNPGM("Special Menu: Save EEPROM");
|
||||
settings.save(); // M500
|
||||
injectCommands(F("M500"));
|
||||
BUZZ(105, 1108);
|
||||
BUZZ(210, 1661);
|
||||
}
|
||||
@@ -420,10 +339,7 @@
|
||||
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_LOAD_DEFAULTS_S)) != NULL)
|
||||
) {
|
||||
SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults");
|
||||
settings.reset(); // M502
|
||||
#if ENABLED(KNUTWURST_TFT_LEVELING)
|
||||
initializeGrid();
|
||||
#endif
|
||||
injectCommands(F("M502"));
|
||||
BUZZ(105, 1661);
|
||||
BUZZ(210, 1108);
|
||||
}
|
||||
@@ -506,8 +422,7 @@
|
||||
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_RESETLV_S)) != NULL)
|
||||
) {
|
||||
SERIAL_ECHOLNPGM("Special Menu: initializeGrid()");
|
||||
initializeGrid();
|
||||
settings.save();
|
||||
injectCommands(F("M501\nM420 S1"));
|
||||
BUZZ(105, 1108);
|
||||
BUZZ(210, 1661);
|
||||
}
|
||||
@@ -615,7 +530,7 @@
|
||||
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_BLTZ_EXIT_S)) != NULL)
|
||||
) {
|
||||
SERIAL_ECHOLNPGM("Special Menu: Exit BLTouch Menu & Save EEPROM");
|
||||
settings.save(); // M500
|
||||
injectCommands(F("M500"));
|
||||
BUZZ(105, 1108);
|
||||
BUZZ(210, 1661);
|
||||
BLTouchMenu = false;
|
||||
@@ -705,10 +620,42 @@
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
@@ -746,7 +693,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());
|
||||
@@ -772,7 +719,7 @@
|
||||
|
||||
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());
|
||||
@@ -794,7 +741,7 @@
|
||||
}
|
||||
}
|
||||
else if (LevelMenu) {
|
||||
switch (filenumber) {
|
||||
switch (selectedNumber) {
|
||||
case 0: // Page 1
|
||||
SENDLINE_PGM(SM_EZLVL_P1_S);
|
||||
SENDLINE_PGM(SM_EZLVL_P1_L);
|
||||
@@ -816,7 +763,7 @@
|
||||
}
|
||||
}
|
||||
else if (SpecialMenu) {
|
||||
switch (filenumber) {
|
||||
switch (selectedNumber) {
|
||||
case 0: // Page 1
|
||||
SENDLINE_PGM(SM_FLOWMENU_S);
|
||||
SENDLINE_PGM(SM_FLOWMENU_L);
|
||||
@@ -888,141 +835,145 @@
|
||||
}
|
||||
}
|
||||
#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
|
||||
|
||||
// The longname may not be filed, so we use the built-in fallback here.
|
||||
const char* fileName = currentFileList.filename();
|
||||
int fileNameLen = strlen(fileName);
|
||||
|
||||
// Cut off too long filenames.
|
||||
// They don't fit on the screen anyway.
|
||||
#if ENABLED(KNUTWURST_DGUS2_TFT)
|
||||
bool fileNameWasCut = false;
|
||||
if (fileNameLen >= MAX_PRINTABLE_FILENAME_LEN) {
|
||||
fileNameWasCut = true;
|
||||
fileNameLen = MAX_PRINTABLE_FILENAME_LEN;
|
||||
}
|
||||
char outputString[MAX_PRINTABLE_FILENAME_LEN];
|
||||
#else
|
||||
char outputString[fileNameLen];
|
||||
#endif
|
||||
|
||||
// Bugfix for non-printable special characters
|
||||
// which are now replaced by underscores.
|
||||
for (unsigned char i = 0; i <= fileNameLen; i++) {
|
||||
if (isPrintable(fileName[i])) {
|
||||
outputString[i] = fileName[i];
|
||||
} else {
|
||||
outputString[i] = '_';
|
||||
}
|
||||
}
|
||||
|
||||
// I know, it's ugly, but it's faster than a string lib
|
||||
#if ENABLED(KNUTWURST_DGUS2_TFT)
|
||||
if (fileNameWasCut) {
|
||||
outputString[MAX_PRINTABLE_FILENAME_LEN - 7] = '~';
|
||||
outputString[MAX_PRINTABLE_FILENAME_LEN - 6] = '.';
|
||||
outputString[MAX_PRINTABLE_FILENAME_LEN - 5] = 'g';
|
||||
outputString[MAX_PRINTABLE_FILENAME_LEN - 4] = 'c';
|
||||
outputString[MAX_PRINTABLE_FILENAME_LEN - 3] = 'o';
|
||||
outputString[MAX_PRINTABLE_FILENAME_LEN - 2] = 'd';
|
||||
outputString[MAX_PRINTABLE_FILENAME_LEN - 1] = 'e';
|
||||
outputString[MAX_PRINTABLE_FILENAME_LEN] = '\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 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(outputString);
|
||||
#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)
|
||||
@@ -1158,46 +1109,6 @@
|
||||
TFTcmdbuffer[TFTbufindw][serial3_count] = 0; // terminate string
|
||||
|
||||
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)) {
|
||||
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindw], 'A');
|
||||
switch ((int)((strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], NULL)))) {
|
||||
@@ -1270,9 +1181,7 @@
|
||||
#endif
|
||||
{
|
||||
if (CodeSeen('S')) filenumber = CodeValue();
|
||||
SENDLINE_PGM("FN "); // Filelist start
|
||||
PrintList();
|
||||
SENDLINE_PGM("END"); // Filelist stop
|
||||
RenderCurrentFileList();
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@@ -1305,25 +1214,23 @@
|
||||
starpos = (strchr(TFTstrchr_pointer + 4, '*'));
|
||||
if (TFTstrchr_pointer[4] == '/') {
|
||||
strcpy(currentTouchscreenSelection, TFTstrchr_pointer + 5);
|
||||
#ifdef ANYCUBIC_TFT_DEBUG
|
||||
SERIAL_ECHOPGM("TFT Serial Debug: currentTouchscreenSelection: ", currentTouchscreenSelection);
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
currentFileOrDirectory[0] = 0;
|
||||
SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected
|
||||
SENDLINE_PGM("");
|
||||
}
|
||||
else if (TFTstrchr_pointer[4] == '<') {
|
||||
strcpy(currentTouchscreenSelection, TFTstrchr_pointer + 4);
|
||||
#ifdef ANYCUBIC_TFT_DEBUG
|
||||
SERIAL_ECHOPGM("J21", "TFT Serial Debug: Clear file selection... J21 ");
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
SpecialMenu = true;
|
||||
currentFileOrDirectory[0] = 0;
|
||||
SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected
|
||||
SENDLINE_PGM("");
|
||||
}
|
||||
else {
|
||||
if (SpecialMenu == false)
|
||||
currentTouchscreenSelection[0] = 0;
|
||||
currentTouchscreenSelection[0] = 0;
|
||||
|
||||
if (starpos != NULL) *(starpos - 1) = '\0';
|
||||
strcpy(currentFileOrDirectory, TFTstrchr_pointer + 4);
|
||||
|
||||
if (starpos) *(starpos - 1) = '\0';
|
||||
|
||||
strcpy(currentFileOrDirectory, TFTstrchr_pointer + 4);
|
||||
SENDLINE_DBG_PGM_VAL("J20", "TFT Serial Debug: File Selected... J20 ", currentFileOrDirectory); // J20 File Selected
|
||||
}
|
||||
}
|
||||
@@ -1338,12 +1245,11 @@
|
||||
|
||||
case 15: // A15 RESUMING FROM OUTAGE
|
||||
#if defined(POWER_OUTAGE_TEST)
|
||||
if ((!planner.movesplanned()) && (TFTstate != ANYCUBIC_TFT_STATE_SDPAUSE)) {
|
||||
if (!isPrinting()) {
|
||||
if (card.isFileOpen()) FlagResumFromOutage = true;
|
||||
|
||||
ResumingFlag = 1;
|
||||
card.startOrResumeFilePrinting();
|
||||
starttime = millis();
|
||||
resumePrint();
|
||||
SENDLINE_PGM("OK");
|
||||
}
|
||||
#endif
|
||||
@@ -1514,15 +1420,16 @@
|
||||
case 26: // A26 refresh SD
|
||||
{
|
||||
#ifdef SDSUPPORT
|
||||
#ifdef ANYCUBIC_TFT_DEBUG
|
||||
SERIAL_ECHOPGM("TFT Serial Debug: currentTouchscreenSelection: ", currentTouchscreenSelection);
|
||||
SERIAL_EOL();
|
||||
#endif
|
||||
#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
|
||||
|
||||
if (strlen(currentTouchscreenSelection) > 0) {
|
||||
FileList currentFileList;
|
||||
if ((strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIR_UP_S)) != NULL)
|
||||
|| (strcasestr_P(currentTouchscreenSelection, PSTR(SM_DIR_UP_L)) != NULL)
|
||||
if ((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 ..)");
|
||||
@@ -1545,16 +1452,17 @@
|
||||
strcpy(currentFileOrDirectory, currentTouchscreenSelection);
|
||||
int currentFileLen = strlen(currentFileOrDirectory);
|
||||
currentFileOrDirectory[currentFileLen - 4] = '\0';
|
||||
card.cd(currentFileOrDirectory);
|
||||
currentFileList.changeDir(currentFileOrDirectory);
|
||||
#else
|
||||
currentFileList.changeDir(currentTouchscreenSelection);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SpecialMenu == false)
|
||||
if (SpecialMenu == false) {
|
||||
currentTouchscreenSelection[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ifdef SDSUPPORT
|
||||
break;
|
||||
|
||||
@@ -1578,85 +1486,143 @@
|
||||
#if ENABLED(KNUTWURST_TFT_LEVELING)
|
||||
case 29: // A29 bed grid read
|
||||
{
|
||||
int mx, my;
|
||||
xy_uint8_t pos;
|
||||
float pos_z;
|
||||
|
||||
if (CodeSeen('X')) mx = CodeValueInt();
|
||||
if (CodeSeen('Y')) my = CodeValueInt();
|
||||
if (CodeSeen('X')) pos.x = CodeValueInt();
|
||||
if (CodeSeen('Y')) pos.y = CodeValueInt();
|
||||
|
||||
float Zvalue = bedlevel.z_values[mx][my];
|
||||
Zvalue = Zvalue * 100;
|
||||
pos_z = getMeshPoint(pos);
|
||||
|
||||
SEND_PGM("A29V ");
|
||||
LCD_SERIAL.print(pos_z * 100, 2);
|
||||
SENDLINE_PGM("");
|
||||
|
||||
if (!isPrinting()) {
|
||||
if (!all_axes_trusted()) {
|
||||
injectCommands(F("G28\n"));
|
||||
/*
|
||||
set_axis_is_at_home(X_AXIS);
|
||||
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);
|
||||
setSoftEndstopState(true);
|
||||
if ((selectedmeshpoint.x == pos.x) && (selectedmeshpoint.y == pos.y)) {
|
||||
if (!isPositionKnown())
|
||||
injectCommands_P(G28_STR);
|
||||
|
||||
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(3.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;
|
||||
|
||||
case 30: // A30 auto leveling (Old Anycubic TFT)
|
||||
if (isPrinting())
|
||||
SENDLINE_DBG_PGM("J24", "TFT Serial Debug: Forbid auto leveling... J24");
|
||||
else
|
||||
case 30: // A30 auto leveling (Old Anycubic TFT)
|
||||
if (CodeSeen('S')) {
|
||||
if (isPrinting()) {
|
||||
SENDLINE_DBG_PGM("J24", "TFT Serial Debug: Forbid auto leveling... J24");
|
||||
} else {
|
||||
SENDLINE_DBG_PGM("J26", "TFT Serial Debug: Start auto leveling... J26");
|
||||
injectCommands(F("G28\nG29"));
|
||||
mediaPrintingState = AMPRINTSTATE_PROBING;
|
||||
}
|
||||
} 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"));
|
||||
}
|
||||
break;
|
||||
|
||||
case 31: // A31 z-offset
|
||||
if (CodeSeen('S')) { // set
|
||||
// soft_endstops_enabled = false; // disable endstops
|
||||
float value = constrain(CodeValue(), -1.0, 1.0);
|
||||
probe.offset.z += value;
|
||||
for (x = 0; x < GRID_MAX_POINTS_X; x++)
|
||||
for (y = 0; y < GRID_MAX_POINTS_Y; y++) bedlevel.z_values[x][y] += value;
|
||||
set_bed_leveling_enabled(true);
|
||||
bedlevel.refresh_bed_level();
|
||||
// The tokens can occur in different places on the new panel so we need to find it.
|
||||
|
||||
SEND_PGM("A31V ");
|
||||
LCD_SERIAL.print(float(probe.offset.z), 2);
|
||||
SENDLINE_PGM("");
|
||||
if (CodeSeen('C')) { // Restore and apply original offsets
|
||||
if (!isPrinting()) {
|
||||
injectCommands(F("M501\nM420 S1"));
|
||||
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
||||
SERIAL_ECHOLNF(F("Mesh changes abandoned, previous mesh restored."));
|
||||
}
|
||||
}
|
||||
|
||||
if (CodeSeen('G')) { // get
|
||||
SAVE_zprobe_zoffset = probe.offset.z;
|
||||
SEND_PGM("A31V ");
|
||||
LCD_SERIAL.print(float(SAVE_zprobe_zoffset), 2);
|
||||
SENDLINE_PGM("");
|
||||
else if (CodeSeen('D')) { // Save Z Offset tables and restore leveling state
|
||||
if (!isPrinting()) {
|
||||
setAxisPosition_mm(1.0,Z); // Lift nozzle before any further movements are made
|
||||
injectCommands(F("M500"));
|
||||
#if ENABLED(ANYCUBIC_TFT_DEBUG)
|
||||
SERIAL_ECHOLNF(F("Mesh changes saved."));
|
||||
#endif
|
||||
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
||||
}
|
||||
}
|
||||
|
||||
if (CodeSeen('D')) { // save
|
||||
SAVE_zprobe_zoffset = probe.offset.z;
|
||||
settings.save();
|
||||
set_bed_leveling_enabled(true);
|
||||
bedlevel.refresh_bed_level();
|
||||
else if (CodeSeen('G')) { // Get current offset
|
||||
SENDLINE_PGM("A31V ");
|
||||
// When printing use the live z Offset position
|
||||
// we will use babystepping to move the print head
|
||||
if (isPrinting())
|
||||
LCD_SERIAL.println(live_Zoffset);
|
||||
else {
|
||||
LCD_SERIAL.println(getZOffset_mm());
|
||||
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
|
||||
// Use babystepping to adjust the head position
|
||||
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;
|
||||
}
|
||||
SENDLINE_PGM("A31V ");
|
||||
LCD_SERIAL.println(live_Zoffset);
|
||||
}
|
||||
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);
|
||||
SENDLINE_PGM("A31V ");
|
||||
LCD_SERIAL.println(getZOffset_mm());
|
||||
|
||||
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;
|
||||
|
||||
case 32: // a32 clean leveling beep flag
|
||||
@@ -1670,25 +1636,36 @@
|
||||
|
||||
case 34: // a34 bed grid write
|
||||
{
|
||||
if (CodeSeen('X')) x = constrain(CodeValueInt(), 0, GRID_MAX_POINTS_X);
|
||||
if (CodeSeen('Y')) y = constrain(CodeValueInt(), 0, GRID_MAX_POINTS_Y);
|
||||
xy_uint8_t pos;
|
||||
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')) {
|
||||
float new_z_value = float(constrain(CodeValue() / 100, -10, 10));
|
||||
bedlevel.z_values[x][y] = new_z_value;
|
||||
set_bed_leveling_enabled(true);
|
||||
bedlevel.refresh_bed_level();
|
||||
float newval = float(constrain(CodeValue() / 100, -10, 10));
|
||||
#if ENABLED(ANYCUBIC_TFT_DEBUG)
|
||||
SERIAL_ECHOLNPGM("Change mesh point x:", pos.x, " y:", pos.y);
|
||||
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')) {
|
||||
bedlevel.refresh_bed_level();
|
||||
set_bed_leveling_enabled(true);
|
||||
settings.save();
|
||||
injectCommands(F("M500"));
|
||||
}
|
||||
if (CodeSeen('C')) {
|
||||
restore_z_values();
|
||||
probe.offset.z = SAVE_zprobe_zoffset;
|
||||
set_bed_leveling_enabled(true);
|
||||
bedlevel.refresh_bed_level();
|
||||
injectCommands(F("M501\nM420 S1"));
|
||||
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1698,13 +1675,8 @@
|
||||
break;
|
||||
|
||||
case 36: // A36 auto leveling (New Anycubic TFT)
|
||||
if (isPrinting())
|
||||
SENDLINE_DBG_PGM("J24", "TFT Serial Debug: Forbid auto leveling... J24");
|
||||
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"));
|
||||
|
||||
SENDLINE_DBG_PGM("J26", "TFT Serial Debug: Start auto leveling... J26");
|
||||
break;
|
||||
#endif // if ENABLED(KNUTWURST_TFT_LEVELING)
|
||||
|
||||
#if ENABLED(KNUTWURST_4MAXP2)
|
||||
@@ -1728,7 +1700,8 @@
|
||||
else
|
||||
SENDLINE_PGM("J34 ");
|
||||
}
|
||||
// break; <-- TODO: do we need it?
|
||||
break;
|
||||
|
||||
case 42:
|
||||
if (CaseLight == true) {
|
||||
SERIAL_ECHOLNPGM("Case Light OFF");
|
||||
@@ -1740,7 +1713,8 @@
|
||||
injectCommands(F("M355 S1 P255"));
|
||||
CaseLight = true;
|
||||
}
|
||||
// break; <-- TODO: do we need it?
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if ENABLED(KNUTWURST_DGUS2_TFT)
|
||||
case 50:
|
||||
|
@@ -21,15 +21,9 @@
|
||||
#ifndef anycubic_touchscreen_h
|
||||
#define anycubic_touchscreen_h
|
||||
|
||||
// #include <stdio.h>
|
||||
// #include "../inc/MarlinConfig.h"
|
||||
// #include "../module/configuration_store.h"
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
#include "../../../module/probe.h"
|
||||
|
||||
void initializeGrid();
|
||||
|
||||
char *itostr2(const uint8_t &x);
|
||||
|
||||
#ifndef ULTRA_LCD
|
||||
@@ -42,26 +36,13 @@ 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,
|
||||
AMPRINTSTATE_PAUSE_REQUESTED,
|
||||
AMPRINTSTATE_PAUSED,
|
||||
AMPRINTSTATE_STOP_REQUESTED
|
||||
AMPRINTSTATE_STOP_REQUESTED,
|
||||
AMPRINTSTATE_PROBING
|
||||
};
|
||||
|
||||
enum AnycubicMediaPauseState {
|
||||
@@ -164,7 +145,7 @@ enum AnycubicMediaPauseState {
|
||||
#endif // !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_S "<SPECI~1.GCO"
|
||||
@@ -250,15 +231,8 @@ enum AnycubicMediaPauseState {
|
||||
#define SM_BLTZ_EXIT_S "<EXTABLM.GCO"
|
||||
#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 {
|
||||
|
||||
public:
|
||||
AnycubicTouchscreenClass();
|
||||
|
||||
@@ -273,9 +247,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
|
||||
@@ -300,6 +276,11 @@ int currentFlowRate = 0;
|
||||
bool PrintdoneAndPowerOFF = true;
|
||||
bool powerOFFflag = 0;
|
||||
|
||||
#if ENABLED(KNUTWURST_TFT_LEVELING)
|
||||
xy_uint8_t selectedmeshpoint;
|
||||
float live_Zoffset;
|
||||
#endif
|
||||
|
||||
static AnycubicMediaPrintState mediaPrintingState;
|
||||
static AnycubicMediaPauseState mediaPauseState;
|
||||
|
||||
@@ -318,7 +299,6 @@ static AnycubicMediaPauseState mediaPauseState;
|
||||
int CodeValueInt();
|
||||
float CodeValue();
|
||||
bool CodeSeen(char);
|
||||
void PrintList();
|
||||
void StartPrint();
|
||||
void PausePrint();
|
||||
void StopPrint();
|
||||
@@ -331,12 +311,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;
|
||||
|
@@ -286,9 +286,11 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// RAMPS 1.4 DIO 4 on the servos connector
|
||||
#ifndef FIL_RUNOUT_PIN
|
||||
#define FIL_RUNOUT_PIN 19
|
||||
|
||||
#if ANY(KNUTWURST_CHIRON, KNUTWURST_4MAXP2)
|
||||
#define FIL_RUNOUT_PIN 33
|
||||
#else
|
||||
#define FIL_RUNOUT_PIN 19
|
||||
#endif
|
||||
|
||||
#ifndef PS_ON_PIN
|
||||
|
@@ -253,7 +253,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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user