From 8b67bfe6958fd8b768030b6bc822141123710d2a Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Thu, 11 Jan 2024 19:57:11 +0100 Subject: [PATCH] fix manual leveling from Mega P TFT Conversion from enqueue_now_P() to injectCommands() causes issues when executing multiple consecutive commands. Inject a single multi-line string instead of 3 injections make the leveling feature work again. Fixes: 524d6fbcdfbce789b22320e25ed5b09c4dd5c42a --- .../extui/knutwurst/anycubic_touchscreen.cpp | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp b/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp index eb032bae1c..f4a2774613 100755 --- a/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp +++ b/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp @@ -1930,23 +1930,31 @@ void AnycubicTouchscreenClass::GetCommandFromTFT() { #if ENABLED(KNUTWURST_MEGA_P) case 51: if (CodeSeen('H')) { - injectCommands(F("G1 Z5 F500")); - injectCommands(F("G1 X30 Y30 F5000")); - injectCommands(F("G1 Z0.15 F300")); + injectCommands(F( + "G1 Z5 F500\n" + "G1 X30 Y30 F5000\n" + "G1 Z0.15 F300" + )); } else if (CodeSeen('I')) { - injectCommands(F("G1 Z5 F500")); - injectCommands(F("G1 X190 Y30 F5000")); - injectCommands(F("G1 Z0.15 F300")); + injectCommands(F( + "G1 Z5 F500\n" + "G1 X190 Y30 F5000\n" + "G1 Z0.15 F300" + )); } else if (CodeSeen('J')) { - injectCommands(F("G1 Z5 F500")); - injectCommands(F("G1 X190 Y190 F5000")); - injectCommands(F("G1 Z0.15 F300")); + injectCommands(F( + "G1 Z5 F500\n" + "G1 X190 Y190 F5000\n" + "G1 Z0.15 F300" + )); } else if (CodeSeen('K')) { - injectCommands(F("G1 Z5 F500")); - injectCommands(F("G1 X30 Y190 F5000")); - injectCommands(F("G1 Z0.15 F300")); + injectCommands(F( + "G1 Z5 F500\n" + "G1 X30 Y190 F5000\n" + "G1 Z0.15 F300" + )); } else if (CodeSeen('L')) { - injectCommands(F("G1 X100 Y100 Z50 F5000")); + injectCommands(F("G1 X100 Y100 Z50 F5000")); } break; #endif