Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Touch inputs enter wrong menu position with ENCODER_STEPS_PER_MENU_ITEM > 1 #27584

Open
1 task done
kitor opened this issue Dec 12, 2024 · 0 comments
Open
1 task done

Comments

@kitor
Copy link

kitor commented Dec 12, 2024

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

Technically I found this running PrusaAIO, but traced this back to Marlin code itself.
I'm running MKS Robin Nano 3.1 with TS35 v2.0

With this (partial) config:

#define MKS_TS35_V2_0
#define TFT_COLOR_UI
#define TFT_ROTATION TFT_ROTATE_90
#define TOUCH_SCREEN
#define TOUCH_CALIBRATION_X -11468
#define TOUCH_CALIBRATION_Y -17199
#define TOUCH_OFFSET_X         333
#define TOUCH_OFFSET_Y         507
#define TOUCH_ORIENTATION TOUCH_PORTRAIT
#define ENCODER_STEPS_PER_MENU_ITEM 2

steps per menu item were set as my displays were skipping steps

I have issue just in menus - touch input registers into position located at Y/2 relative to touch. Everything else (main screen, temperature/fan sliders, "touch" UI for moving axes and even bottom navigation bar in menus) seems to work fine.

I did some digging and I believe the issue is located in https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.1.x/Marlin/src/lcd/tft/touch.cpp in method touch():

    case MENU_CLICK:
      TERN_(SINGLE_TOUCH_NAVIGATION, ui.encoderPosition = control->data);
      ui.lcd_clicked = true;
      break;

From my understanding, touch code simulates encoder inputs... and it seems the value is not scaled by ENCODER_STEPS_PER_MENU_ITEM.

My workaround was to do:

    case MENU_CLICK:
      TERN_(SINGLE_TOUCH_NAVIGATION, ui.encoderPosition = control->data * ENCODER_STEPS_PER_MENU_ITEM);
      ui.lcd_clicked = true;
      break;

but I'm not sure if that's the root cause, or if there are any other cases that are broken.

Bug Timeline

No response

Expected behavior

No response

Actual behavior

No response

Steps to Reproduce

No response

Version of Marlin Firmware

Prusa AIO 2.1.x based on bugfix-2.1.x 23bc810

Printer model

Custom build

Electronics

MKS Robin Nano v3.1

LCD/Controller

MKS TS35 v2.0

Other add-ons

No response

Bed Leveling

None

Your Slicer

None

Host Software

None

Don't forget to include

  • A ZIP file containing your Configuration.h and Configuration_adv.h.

Additional information & file uploads

Sorry for skipping .zip since this is from PrusaAIO and I believe I pinpointed the issue source in the description.
I can attach diff vs HEAD if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant