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

Flipped X and Y coordinates #520

Open
Tobim6 opened this issue Sep 27, 2023 · 2 comments
Open

Flipped X and Y coordinates #520

Tobim6 opened this issue Sep 27, 2023 · 2 comments

Comments

@Tobim6
Copy link

Tobim6 commented Sep 27, 2023

Describe the bug

Adafruit FT6206 library after remapping coordinates to be flipped so 320 that the library thinks I am touching is actually 0 and 480 that the library thinks is actually 0 I am trying to find a way to remap those values on GUISlice but I couldn't find any way to do it

Device hardware

Checklist to try first

Most display/touch issues can be identified by working through the steps in the Configuring GUIslice guide.

Please confirm whether:

  • Display works correctly with standalone display driver library examples (eg. TFT_eSPI graphicstest, Adafruit graphicstest, etc.) without GUIslice: Display works with TFT_eSPI and GUISlice just fine
  • *Touch works correctly with standalone touch library examples without GUIslice: Adafruit FT6206 library after remapping coordinates to be flipped so 320 that the library thinks I am touching is actually 0 and 480 that the library thinks is actually 0

Expected behavior

Option to flip X or Y coordinates

Initialization messages

Additional info

@Pconti31
Copy link
Contributor

Pconti31 commented Sep 28, 2023

@Tobim6 Yes, I don't either. Some of Calvin's (@ImpulseAdventure ) other touch driver configs support flip with
#define ADATOUCH_REMAP_YX 1 but not this one.

Looking inside GUIslice_drv_tft_espi.cpp we see:

  // ----------------------------------------------------------------
  #elif defined(DRV_TOUCH_ADA_FT6206)

  if (m_touch.touched()) {
    TS_Point ptTouch = m_touch.getPoint();
    // FT6206 coordinates appear to have flipped both axes vs other controllers
    // - Confirmed by comments in Adafruit_FT6206 library example code:
    //   "rotate coordinate system. flip it around to match the screen."
    m_nLastRawX = nDispOutMaxX-ptTouch.x;
    m_nLastRawY = nDispOutMaxY-ptTouch.y;
    m_nLastRawPress = 255;  // Select arbitrary non-zero value
    m_bLastTouched = true;
    bValid = true;

  } else {
    if (!m_bLastTouched) {
      // Wasn't touched before; do nothing
    } else {
      // Touch release
      // Indicate old coordinate but with pressure=0
      m_nLastRawPress = 0;
      m_bLastTouched = false;
      bValid = true;
    }
  }

You might try commenting out

//    m_nLastRawX = nDispOutMaxX-ptTouch.x;
//    m_nLastRawY = nDispOutMaxY-ptTouch.y;
m_nLastRawX = ptTouch.x;
m_nLastRawY = ptTouch.y;

Paul--

@ilka-schulz
Copy link

I had the same problem (only X-axis touch was flipped, using AdafruitGfx with ILI9341 and XPT2046) and solved it with this line at the end of my GUI initialization:

m_gui.nFlipX = !m_gui.nFlipX;

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

No branches or pull requests

3 participants