Skip to content

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

Open
@kitor

Description

@kitor

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions