From b646757a1b7e1a49fc4e91685307a316dd2f662b Mon Sep 17 00:00:00 2001 From: Knutwurst <36196269+knutwurst@users.noreply.github.com> Date: Wed, 14 Jun 2023 11:04:00 +0200 Subject: [PATCH] Implement 4MAX Pro 2.0 assisted level feature. --- .../extui/knutwurst/anycubic_touchscreen.cpp | 49 ++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp b/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp index 6e21e802..096d7bfb 100755 --- a/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp +++ b/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp @@ -1616,10 +1616,55 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) { } break; - case 32: // a32 clean leveling beep flag - break; #endif + #if ENABLED(KNUTWURST_4MAXP2) + + case 30: // a30 assist leveling + if (!isPrintingFromMedia()) { + + if (CodeSeen('S')) { + injectCommands(F("G28\nM420 S0\nG90\nG1 Z5\nG1 X15 Y15 F4000\nG1 Z0")); + } else if (CodeSeen('O')) { + injectCommands(F("G90\nG1 Z5\nG1 X15 Y15 F4000\nG1 Z0")); + } else if (CodeSeen('T')) { + injectCommands(F("G90\nG1 Z5\nG1 X255 Y15 F4000\nG1 Z0")); + } else if (CodeSeen('C')) { + injectCommands(F("G90\nG1 Z5\nG1 X255 Y195 F4000\nG1 Z0")); + } else if (CodeSeen('Q')) { + injectCommands(F("G90\nG1 Z5\nG1 X15 Y195 F4000\nG1 Z0")); + } else if (CodeSeen('H') || CodeSeen('L')) { + if (CodeSeen('L')) { + injectCommands(F("G90\nG1 Z10\nG1 X15 Y15 F4000\nM420 S1")); + } + } + } + SENDLINE_PGM(""); + + break; + + case 31: // a31 zoffset + if (!isPrintingFromMedia()) { + + if (CodeSeen('S')) { + SENDLINE_PGM("A9V "); + LCD_SERIAL.print(getZOffset_mm() * 100, 2); + SENDLINE_PGM(""); + } + if (CodeSeen('D')) { + const_float_t newOffset = CodeValue() / 100; + setZOffset_mm(newOffset); + injectCommands(F("M500")); + } + } + SENDLINE_PGM(""); + break; + #endif // #if ENABLED(KNUTWURST_4MAXP2) + + + case 32: // a32 clean leveling beep flag + break; + case 33: // A33 get version info SEND_PGM("J33 "); SEND_PGM("KW-");