Rebuild Chiron leveling feature.
This commit is contained in:
@@ -34,9 +34,9 @@
|
|||||||
#include "../../../module/settings.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_DGUS2_TFT
|
||||||
//#define KNUTWURST_TFT_LEVELING
|
#define KNUTWURST_TFT_LEVELING
|
||||||
|
|
||||||
#ifdef ANYCUBIC_TOUCHSCREEN
|
#ifdef ANYCUBIC_TOUCHSCREEN
|
||||||
#include "./anycubic_touchscreen.h"
|
#include "./anycubic_touchscreen.h"
|
||||||
@@ -355,7 +355,7 @@
|
|||||||
return (strtod(&TFTcmdbuffer[TFTbufindr][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindr] + 1], NULL));
|
return (strtod(&TFTcmdbuffer[TFTbufindr][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindr] + 1], NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AnycubicTouchscreenClass::FindToken(char code) {
|
bool AnycubicTouchscreenClass::CodeSeen(char code) {
|
||||||
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindr], code);
|
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindr], code);
|
||||||
return (TFTstrchr_pointer != NULL); // Return True if a character was found
|
return (TFTstrchr_pointer != NULL); // Return True if a character was found
|
||||||
}
|
}
|
||||||
@@ -727,7 +727,7 @@ void AnycubicTouchscreenClass::RenderCurrentFileList() {
|
|||||||
SENDLINE_PGM(SM_SPECIAL_MENU_L);
|
SENDLINE_PGM(SM_SPECIAL_MENU_L);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (FindToken('S')) {
|
if (CodeSeen('S')) {
|
||||||
selectedNumber = CodeValue();
|
selectedNumber = CodeValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1308,7 +1308,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (FindToken('S')) filenumber = CodeValue();
|
if (CodeSeen('S')) filenumber = CodeValue();
|
||||||
//PrintList();
|
//PrintList();
|
||||||
RenderCurrentFileList();
|
RenderCurrentFileList();
|
||||||
}
|
}
|
||||||
@@ -1387,12 +1387,12 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
case 16: // A16 set hotend temp
|
case 16: // A16 set hotend temp
|
||||||
{
|
{
|
||||||
unsigned int tempvalue;
|
unsigned int tempvalue;
|
||||||
if (FindToken('S')) {
|
if (CodeSeen('S')) {
|
||||||
tempvalue = constrain(CodeValue(), 0, 260);
|
tempvalue = constrain(CodeValue(), 0, 260);
|
||||||
if (getTargetTemp_celsius((extruder_t)E0) <= 260)
|
if (getTargetTemp_celsius((extruder_t)E0) <= 260)
|
||||||
setTargetTemp_celsius(tempvalue, (extruder_t)E0);; // do not set Temp from TFT if it is set via gcode
|
setTargetTemp_celsius(tempvalue, (extruder_t)E0);; // do not set Temp from TFT if it is set via gcode
|
||||||
}
|
}
|
||||||
else if ((FindToken('C')) && (!isPrinting())) {
|
else if ((CodeSeen('C')) && (!isPrinting())) {
|
||||||
if ((getAxisPosition_mm(Z) < 10))
|
if ((getAxisPosition_mm(Z) < 10))
|
||||||
injectCommands(F("G1 Z10")); // RASE Z AXIS
|
injectCommands(F("G1 Z10")); // RASE Z AXIS
|
||||||
tempvalue = constrain(CodeValue(), 0, 260);
|
tempvalue = constrain(CodeValue(), 0, 260);
|
||||||
@@ -1404,7 +1404,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
case 17: // A17 set heated bed temp
|
case 17: // A17 set heated bed temp
|
||||||
{
|
{
|
||||||
unsigned int tempbed;
|
unsigned int tempbed;
|
||||||
if (FindToken('S')) {
|
if (CodeSeen('S')) {
|
||||||
tempbed = constrain(CodeValue(), 0, 120);
|
tempbed = constrain(CodeValue(), 0, 120);
|
||||||
if (getTargetTemp_celsius((heater_t)BED) <= 100)
|
if (getTargetTemp_celsius((heater_t)BED) <= 100)
|
||||||
setTargetTemp_celsius(tempbed, (heater_t)BED); // do not set Temp from TFT if it is set via gcode
|
setTargetTemp_celsius(tempbed, (heater_t)BED); // do not set Temp from TFT if it is set via gcode
|
||||||
@@ -1414,7 +1414,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
|
|
||||||
case 18: // A18 set fan speed
|
case 18: // A18 set fan speed
|
||||||
float fanPercent;
|
float fanPercent;
|
||||||
if (FindToken('S')) {
|
if (CodeSeen('S')) {
|
||||||
fanPercent = CodeValue();
|
fanPercent = CodeValue();
|
||||||
fanPercent = constrain(fanPercent, 0, 100);
|
fanPercent = constrain(fanPercent, 0, 100);
|
||||||
setTargetFan_percent(fanPercent, FAN0);
|
setTargetFan_percent(fanPercent, FAN0);
|
||||||
@@ -1437,7 +1437,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
|
|
||||||
case 20: // A20 read printing speed
|
case 20: // A20 read printing speed
|
||||||
{
|
{
|
||||||
if (FindToken('S'))
|
if (CodeSeen('S'))
|
||||||
feedrate_percentage = constrain(CodeValue(), 40, 999);
|
feedrate_percentage = constrain(CodeValue(), 40, 999);
|
||||||
else
|
else
|
||||||
SEND_PGM_VAL("A20V ", feedrate_percentage);
|
SEND_PGM_VAL("A20V ", feedrate_percentage);
|
||||||
@@ -1446,15 +1446,15 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
|
|
||||||
case 21: // A21 all home
|
case 21: // A21 all home
|
||||||
if (!isPrinting() && !isPrintingFromMediaPaused()) {
|
if (!isPrinting() && !isPrintingFromMediaPaused()) {
|
||||||
if (FindToken('X') || FindToken('Y') || FindToken('Z')) {
|
if (CodeSeen('X') || CodeSeen('Y') || CodeSeen('Z')) {
|
||||||
if (FindToken('X'))
|
if (CodeSeen('X'))
|
||||||
injectCommands(F("G28X"));
|
injectCommands(F("G28X"));
|
||||||
if (FindToken('Y'))
|
if (CodeSeen('Y'))
|
||||||
injectCommands(F("G28Y"));
|
injectCommands(F("G28Y"));
|
||||||
if (FindToken('Z'))
|
if (CodeSeen('Z'))
|
||||||
injectCommands(F("G28Z"));
|
injectCommands(F("G28Z"));
|
||||||
}
|
}
|
||||||
else if (FindToken('C')) {
|
else if (CodeSeen('C')) {
|
||||||
injectCommands_P(G28_STR);
|
injectCommands_P(G28_STR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1465,12 +1465,12 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
float coorvalue;
|
float coorvalue;
|
||||||
unsigned int movespeed = 0;
|
unsigned int movespeed = 0;
|
||||||
char value[30];
|
char value[30];
|
||||||
if (FindToken('F')) // Set feedrate
|
if (CodeSeen('F')) // Set feedrate
|
||||||
movespeed = CodeValue();
|
movespeed = CodeValue();
|
||||||
|
|
||||||
queue.enqueue_now_P(PSTR("G91")); // relative coordinates
|
queue.enqueue_now_P(PSTR("G91")); // relative coordinates
|
||||||
|
|
||||||
if (FindToken('X')) { // Move in X direction
|
if (CodeSeen('X')) { // Move in X direction
|
||||||
coorvalue = CodeValue();
|
coorvalue = CodeValue();
|
||||||
if ((coorvalue <= 0.2) && coorvalue > 0)
|
if ((coorvalue <= 0.2) && coorvalue > 0)
|
||||||
sprintf_P(value, PSTR("G1 X0.1F%i"), movespeed);
|
sprintf_P(value, PSTR("G1 X0.1F%i"), movespeed);
|
||||||
@@ -1480,7 +1480,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
sprintf_P(value, PSTR("G1 X%iF%i"), int(coorvalue), movespeed);
|
sprintf_P(value, PSTR("G1 X%iF%i"), int(coorvalue), movespeed);
|
||||||
queue.enqueue_one_now(value);
|
queue.enqueue_one_now(value);
|
||||||
}
|
}
|
||||||
else if (FindToken('Y')) { // Move in Y direction
|
else if (CodeSeen('Y')) { // Move in Y direction
|
||||||
coorvalue = CodeValue();
|
coorvalue = CodeValue();
|
||||||
if ((coorvalue <= 0.2) && coorvalue > 0)
|
if ((coorvalue <= 0.2) && coorvalue > 0)
|
||||||
sprintf_P(value, PSTR("G1 Y0.1F%i"), movespeed);
|
sprintf_P(value, PSTR("G1 Y0.1F%i"), movespeed);
|
||||||
@@ -1490,7 +1490,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
sprintf_P(value, PSTR("G1 Y%iF%i"), int(coorvalue), movespeed);
|
sprintf_P(value, PSTR("G1 Y%iF%i"), int(coorvalue), movespeed);
|
||||||
queue.enqueue_one_now(value);
|
queue.enqueue_one_now(value);
|
||||||
}
|
}
|
||||||
else if (FindToken('Z')) { // Move in Z direction
|
else if (CodeSeen('Z')) { // Move in Z direction
|
||||||
coorvalue = CodeValue();
|
coorvalue = CodeValue();
|
||||||
if ((coorvalue <= 0.2) && coorvalue > 0)
|
if ((coorvalue <= 0.2) && coorvalue > 0)
|
||||||
sprintf_P(value, PSTR("G1 Z0.1F%i"), movespeed);
|
sprintf_P(value, PSTR("G1 Z0.1F%i"), movespeed);
|
||||||
@@ -1500,7 +1500,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
sprintf_P(value, PSTR("G1 Z%iF%i"), int(coorvalue), movespeed);
|
sprintf_P(value, PSTR("G1 Z%iF%i"), int(coorvalue), movespeed);
|
||||||
queue.enqueue_one_now(value);
|
queue.enqueue_one_now(value);
|
||||||
}
|
}
|
||||||
else if (FindToken('E')) { // Extrude
|
else if (CodeSeen('E')) { // Extrude
|
||||||
coorvalue = CodeValue();
|
coorvalue = CodeValue();
|
||||||
if ((coorvalue <= 0.2) && coorvalue > 0)
|
if ((coorvalue <= 0.2) && coorvalue > 0)
|
||||||
sprintf_P(value, PSTR("G1 E0.1F%i"), movespeed);
|
sprintf_P(value, PSTR("G1 E0.1F%i"), movespeed);
|
||||||
@@ -1597,9 +1597,9 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
|
|
||||||
case 28: // A28 filament test
|
case 28: // A28 filament test
|
||||||
{
|
{
|
||||||
if (FindToken('O'))
|
if (CodeSeen('O'))
|
||||||
;
|
;
|
||||||
else if (FindToken('C'))
|
else if (CodeSeen('C'))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
SENDLINE_PGM("");
|
SENDLINE_PGM("");
|
||||||
@@ -1615,44 +1615,40 @@ 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 (FindToken('X')) mx = CodeValueInt();
|
if (CodeSeen('X')) pos.x = CodeValueInt();
|
||||||
if (FindToken('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(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;
|
break;
|
||||||
|
|
||||||
@@ -1661,39 +1657,97 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
SENDLINE_DBG_PGM("J24", "TFT Serial Debug: Forbid auto leveling... J24");
|
SENDLINE_DBG_PGM("J24", "TFT Serial Debug: Forbid auto leveling... J24");
|
||||||
else
|
else
|
||||||
SENDLINE_DBG_PGM("J26", "TFT Serial Debug: Start auto leveling... J26");
|
SENDLINE_DBG_PGM("J26", "TFT Serial Debug: Start auto leveling... J26");
|
||||||
if (FindToken('S'))
|
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"));
|
injectCommands(F("G28\nG29\nM500\nG90\nM300 S440 P200\nM300 S660 P250\nM300 S880 P300\nG1 Z30 F4000\nG1 X0 F4000\nG91\nM84"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 31: // A31 z-offset
|
case 31: // A31 z-offset
|
||||||
if (FindToken('S')) { // set
|
// The tokens can occur in different places on the new panel so we need to find it.
|
||||||
// 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();
|
|
||||||
|
|
||||||
SEND_PGM("A31V ");
|
if (CodeSeen('C')) { // Restore and apply original offsets
|
||||||
LCD_SERIAL.print(float(probe.offset.z), 2);
|
if (!isPrinting()) {
|
||||||
SENDLINE_PGM("");
|
injectCommands(F("M501\nM420 S1"));
|
||||||
|
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
||||||
|
SERIAL_ECHOLNF(F("Mesh changes abandoned, previous mesh restored."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FindToken('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(1.0,Z); // Lift nozzle before any further movements are made
|
||||||
LCD_SERIAL.print(float(SAVE_zprobe_zoffset), 2);
|
injectCommands(F("M500"));
|
||||||
SENDLINE_PGM("");
|
SERIAL_ECHOLNF(F("Mesh changes saved."));
|
||||||
|
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FindToken('D')) { // save
|
else if (CodeSeen('G')) { // Get current offset
|
||||||
SAVE_zprobe_zoffset = probe.offset.z;
|
SENDLINE_PGM("A31V ");
|
||||||
settings.save();
|
// When printing use the live z Offset position
|
||||||
set_bed_leveling_enabled(true);
|
// we will use babystepping to move the print head
|
||||||
bedlevel.refresh_bed_level();
|
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); // disable endstops
|
||||||
|
// Allow temporary Z position nudging during print
|
||||||
|
// From the leveling panel use the all points UI to adjust the print pos.
|
||||||
|
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)) {
|
||||||
|
// Move Z axis
|
||||||
|
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
|
||||||
@@ -1707,25 +1761,35 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
|
|
||||||
case 34: // a34 bed grid write
|
case 34: // a34 bed grid write
|
||||||
{
|
{
|
||||||
if (FindToken('X')) x = constrain(CodeValueInt(), 0, GRID_MAX_POINTS_X);
|
xy_uint8_t pos;
|
||||||
if (FindToken('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);
|
||||||
|
|
||||||
if (FindToken('V')) {
|
float currmesh = getMeshPoint(pos);
|
||||||
float new_z_value = float(constrain(CodeValue() / 100, -10, 10));
|
|
||||||
bedlevel.z_values[x][y] = new_z_value;
|
if (CodeSeen('V')) {
|
||||||
set_bed_leveling_enabled(true);
|
float newval = float(constrain(CodeValue() / 100, -10, 10));
|
||||||
bedlevel.refresh_bed_level();
|
|
||||||
|
setMeshPoint(pos,newval);
|
||||||
|
if (!isPrinting()) {
|
||||||
|
// if we are at the current mesh point indicated on the panel Move Z pos +/- 0.05mm
|
||||||
|
// (The panel changes the mesh value by +/- 0.05mm on each button press)
|
||||||
|
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 (FindToken('S')) {
|
if (CodeSeen('S')) {
|
||||||
bedlevel.refresh_bed_level();
|
injectCommands(F("M500"));
|
||||||
set_bed_leveling_enabled(true);
|
|
||||||
settings.save();
|
|
||||||
}
|
}
|
||||||
if (FindToken('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;
|
||||||
@@ -1739,7 +1803,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
SENDLINE_DBG_PGM("J24", "TFT Serial Debug: Forbid auto leveling... J24");
|
SENDLINE_DBG_PGM("J24", "TFT Serial Debug: Forbid auto leveling... J24");
|
||||||
else
|
else
|
||||||
SENDLINE_DBG_PGM("J26", "TFT Serial Debug: Start auto leveling... J26");
|
SENDLINE_DBG_PGM("J26", "TFT Serial Debug: Start auto leveling... J26");
|
||||||
if (FindToken('S'))
|
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"));
|
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)
|
||||||
@@ -1751,15 +1815,15 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 41:
|
case 41:
|
||||||
if (FindToken('O')) {
|
if (CodeSeen('O')) {
|
||||||
PrintdoneAndPowerOFF = true;
|
PrintdoneAndPowerOFF = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (FindToken('C')) {
|
else if (CodeSeen('C')) {
|
||||||
PrintdoneAndPowerOFF = false;
|
PrintdoneAndPowerOFF = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (FindToken('S')) {
|
if (CodeSeen('S')) {
|
||||||
if (PrintdoneAndPowerOFF)
|
if (PrintdoneAndPowerOFF)
|
||||||
SENDLINE_PGM("J35 ");
|
SENDLINE_PGM("J35 ");
|
||||||
else
|
else
|
||||||
@@ -1797,7 +1861,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 36:
|
case 36:
|
||||||
if (FindToken('S')) {
|
if (CodeSeen('S')) {
|
||||||
int coorvalue;
|
int coorvalue;
|
||||||
coorvalue = CodeValueInt();
|
coorvalue = CodeValueInt();
|
||||||
if (coorvalue != 0)
|
if (coorvalue != 0)
|
||||||
@@ -1806,7 +1870,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
Laser_printer_st.pic_vector = 0;
|
Laser_printer_st.pic_vector = 0;
|
||||||
break;
|
break;
|
||||||
case 37:
|
case 37:
|
||||||
if (FindToken('S')) {
|
if (CodeSeen('S')) {
|
||||||
int coorvalue;
|
int coorvalue;
|
||||||
coorvalue = CodeValueInt();
|
coorvalue = CodeValueInt();
|
||||||
if (coorvalue == 0)
|
if (coorvalue == 0)
|
||||||
@@ -1817,7 +1881,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 38:
|
case 38:
|
||||||
if (FindToken('S')) {
|
if (CodeSeen('S')) {
|
||||||
int coorvalue;
|
int coorvalue;
|
||||||
coorvalue = CodeValueInt();
|
coorvalue = CodeValueInt();
|
||||||
Laser_printer_st.pic_laser_time = coorvalue;
|
Laser_printer_st.pic_laser_time = coorvalue;
|
||||||
@@ -1825,7 +1889,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 39:
|
case 39:
|
||||||
if (FindToken('S')) { // A39
|
if (CodeSeen('S')) { // A39
|
||||||
float coorvalue;
|
float coorvalue;
|
||||||
coorvalue = CodeValue();
|
coorvalue = CodeValue();
|
||||||
Laser_printer_st.laser_height = coorvalue;
|
Laser_printer_st.laser_height = coorvalue;
|
||||||
@@ -1836,7 +1900,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 40:
|
case 40:
|
||||||
if (FindToken('S')) { // A40
|
if (CodeSeen('S')) { // A40
|
||||||
float coorvalue;
|
float coorvalue;
|
||||||
coorvalue = CodeValue();
|
coorvalue = CodeValue();
|
||||||
Laser_printer_st.pic_pixel_distance = coorvalue;
|
Laser_printer_st.pic_pixel_distance = coorvalue;
|
||||||
@@ -1844,7 +1908,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 41:
|
case 41:
|
||||||
if (FindToken('S')) {
|
if (CodeSeen('S')) {
|
||||||
float coorvalue;
|
float coorvalue;
|
||||||
coorvalue = CodeValue();
|
coorvalue = CodeValue();
|
||||||
Laser_printer_st.x_offset = coorvalue;
|
Laser_printer_st.x_offset = coorvalue;
|
||||||
@@ -1852,7 +1916,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 42:
|
case 42:
|
||||||
if (FindToken('S')) {
|
if (CodeSeen('S')) {
|
||||||
float coorvalue;
|
float coorvalue;
|
||||||
coorvalue = CodeValue();
|
coorvalue = CodeValue();
|
||||||
Laser_printer_st.y_offset = coorvalue;
|
Laser_printer_st.y_offset = coorvalue;
|
||||||
@@ -1860,7 +1924,7 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 43:
|
case 43:
|
||||||
if (FindToken('S')) { // y
|
if (CodeSeen('S')) { // y
|
||||||
int coorvalue;
|
int coorvalue;
|
||||||
coorvalue = CodeValueInt();
|
coorvalue = CodeValueInt();
|
||||||
if (coorvalue == 0)
|
if (coorvalue == 0)
|
||||||
@@ -1892,27 +1956,27 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
|||||||
|
|
||||||
#if ENABLED(KNUTWURST_MEGA_P)
|
#if ENABLED(KNUTWURST_MEGA_P)
|
||||||
case 51:
|
case 51:
|
||||||
if (FindToken('H')) {
|
if (CodeSeen('H')) {
|
||||||
queue.enqueue_now_P(PSTR("G1 Z5 F500"));
|
queue.enqueue_now_P(PSTR("G1 Z5 F500"));
|
||||||
queue.enqueue_now_P(PSTR("G1 X30 Y30 F5000"));
|
queue.enqueue_now_P(PSTR("G1 X30 Y30 F5000"));
|
||||||
queue.enqueue_now_P(PSTR("G1 Z0.15 F300"));
|
queue.enqueue_now_P(PSTR("G1 Z0.15 F300"));
|
||||||
}
|
}
|
||||||
else if (FindToken('I')) {
|
else if (CodeSeen('I')) {
|
||||||
queue.enqueue_now_P(PSTR("G1 Z5 F500"));
|
queue.enqueue_now_P(PSTR("G1 Z5 F500"));
|
||||||
queue.enqueue_now_P(PSTR("G1 X190 Y30 F5000"));
|
queue.enqueue_now_P(PSTR("G1 X190 Y30 F5000"));
|
||||||
queue.enqueue_now_P(PSTR("G1 Z0.15 F300"));
|
queue.enqueue_now_P(PSTR("G1 Z0.15 F300"));
|
||||||
}
|
}
|
||||||
else if (FindToken('J')) {
|
else if (CodeSeen('J')) {
|
||||||
queue.enqueue_now_P(PSTR("G1 Z5 F500"));
|
queue.enqueue_now_P(PSTR("G1 Z5 F500"));
|
||||||
queue.enqueue_now_P(PSTR("G1 X190 Y190 F5000"));
|
queue.enqueue_now_P(PSTR("G1 X190 Y190 F5000"));
|
||||||
queue.enqueue_now_P(PSTR("G1 Z0.15 F300"));
|
queue.enqueue_now_P(PSTR("G1 Z0.15 F300"));
|
||||||
}
|
}
|
||||||
else if (FindToken('K')) {
|
else if (CodeSeen('K')) {
|
||||||
queue.enqueue_now_P(PSTR("G1 Z5 F500"));
|
queue.enqueue_now_P(PSTR("G1 Z5 F500"));
|
||||||
queue.enqueue_now_P(PSTR("G1 X30 Y190 F5000"));
|
queue.enqueue_now_P(PSTR("G1 X30 Y190 F5000"));
|
||||||
queue.enqueue_now_P(PSTR("G1 Z0.15 F300"));
|
queue.enqueue_now_P(PSTR("G1 Z0.15 F300"));
|
||||||
}
|
}
|
||||||
else if (FindToken('L')) {
|
else if (CodeSeen('L')) {
|
||||||
queue.enqueue_now_P(PSTR("G1 X100 Y100 Z50 F5000"));
|
queue.enqueue_now_P(PSTR("G1 X100 Y100 Z50 F5000"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -242,6 +242,9 @@ enum AnycubicMediaPauseState {
|
|||||||
extern int z_values_size;
|
extern int z_values_size;
|
||||||
// temp value which needs to be saved
|
// temp value which needs to be saved
|
||||||
extern float SAVE_zprobe_zoffset;
|
extern float SAVE_zprobe_zoffset;
|
||||||
|
|
||||||
|
static xy_uint8_t selectedmeshpoint;
|
||||||
|
static float live_Zoffset;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class AnycubicTouchscreenClass {
|
class AnycubicTouchscreenClass {
|
||||||
@@ -306,7 +309,7 @@ static AnycubicMediaPauseState mediaPauseState;
|
|||||||
|
|
||||||
int CodeValueInt();
|
int CodeValueInt();
|
||||||
float CodeValue();
|
float CodeValue();
|
||||||
bool FindToken(char);
|
bool CodeSeen(char);
|
||||||
void StartPrint();
|
void StartPrint();
|
||||||
void PausePrint();
|
void PausePrint();
|
||||||
void StopPrint();
|
void StopPrint();
|
||||||
|
Reference in New Issue
Block a user