Skip to content

Commit 16c4739

Browse files
committed
Enhance touchscreen setup by refining Y movement execution and correcting X coordinate handling
1 parent 62df65b commit 16c4739

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,10 @@ void AnycubicTouchscreenClass::Setup() {
394394
else
395395
sprintf_P(cvalue, PSTR("G1 Y%sF%i"), ftostr42_52(y_start - i * laser_printer_st.pic_pixel_distance), ftemp);
396396

397+
// Execute Y movement before processing the row
398+
queue.enqueue_one_now(cvalue);
399+
while (commandsInQueue()) idle();
400+
397401
// Even rows: scan left to right
398402
if (i % 2 == 0) {
399403
for (j = 0; j < x_max; j++) {
@@ -434,12 +438,12 @@ void AnycubicTouchscreenClass::Setup() {
434438
}
435439
else {
436440
for (j = 0; j < x_max; j++) {
437-
read_bmp(&Y, i, x_max - j);
441+
read_bmp(&Y, i, x_max - j - 1);
438442
if (Y > MIN_GRAY_VLAUE && j != 0) {
439443
if (laser_printer_st.pic_x_mirror == 1)
440444
sprintf_P(cvalue, PSTR("G1 X%sF%i"), ftostr42_52(x_end + j * laser_printer_st.pic_pixel_distance), ftemp);
441445
else
442-
sprintf_P(cvalue, PSTR("G1 X%.1fF%i"), ftostr42_52(x_end - j * laser_printer_st.pic_pixel_distance), ftemp);
446+
sprintf_P(cvalue, PSTR("G1 X%sF%i"), ftostr42_52(x_end - j * laser_printer_st.pic_pixel_distance), ftemp);
443447
queue.enqueue_one_now(cvalue);
444448
while (commandsInQueue()) idle();
445449
WRITE(HEATER_0_PIN, 1);

0 commit comments

Comments
 (0)