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: 524d6fbcdf
This commit is contained in:
Stefan Kalscheuer
2024-01-11 19:57:11 +01:00
parent 48db31732f
commit 8b67bfe695

View File

@@ -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