Refactor Chiron A31 Adjust all Probe Points routine

This commit is contained in:
Knutwurst
2023-06-03 19:29:59 +02:00
parent 6bc410a0e3
commit 70ccd6a957

View File

@@ -1480,9 +1480,8 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
pos_z = getMeshPoint(pos);
SEND_PGM("A29V ");
LCD_SERIAL.print(pos_z * 100, 2);
SENDLINE_PGM("");
SENDLINE_PGM("A29V ");
LCD_SERIAL.println(pos_z * 100);
if (!isPrinting()) {
setSoftEndstopState(true);
@@ -1515,7 +1514,8 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
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"));
//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 {
@@ -1524,40 +1524,6 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
break;
case 31: // A31 z-offset
// The tokens can occur in different places on the new panel so we need to find it.
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."));
}
}
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;
}
}
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);
@@ -1608,7 +1574,38 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
}
}
}
if (CodeSeen('G')) { // Get current offset
SENDLINE_PGM("A31V ");
if (isPrinting())
LCD_SERIAL.println(live_Zoffset);
else {
LCD_SERIAL.println(getZOffset_mm());
selectedmeshpoint.x = selectedmeshpoint.y = 99;
}
}
if (CodeSeen('C')) { // Restore and apply original offsets
if (!isPrinting()) {
injectCommands(F("M501\nM420 S1"));
selectedmeshpoint.x = selectedmeshpoint.y = 99;
#if ENABLED(ANYCUBIC_TFT_DEBUG)
SERIAL_ECHOLNF(F("Mesh changes abandoned, previous mesh restored."));
#endif
}
}
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;
}
}
SENDLINE_PGM("");
break;
case 32: // a32 clean leveling beep flag