GithubHelp home page GithubHelp logo

Comments (6)

gmgunderground avatar gmgunderground commented on May 23, 2024 1

@gmgunderground Have you tried adjusting data? If it always shifts toward the center, I think you can compensate by changing the calibration value closer to the center. For example, try the following .

  uint16_t data[8];

  data[0] =  32;   // left top X
  data[1] =  32;   // left top Y
  data[2] =  32;   // left bottom X
  data[3] = 207;   // left bottom Y
  data[4] = 287;   // right top X
  data[5] =  32;   // right top Y
  data[6] = 287;   // right bottom X
  data[7] = 207;   // right bottom Y

  M5.Display.setTouchCalibrate(data);

BTW, there is an update to the Core2 touch panel firmware. This reduces the problem of coordinates being shifted vertically at the top of the screen. ( It may have already been updated if your purchase was recent. )

Try to write Core2_Tools once using M5Burner. If the touch panel firmware is out of date, Core2_Tools will perform the update at startup.

Once the firmware update is performed, it will remain effective even if other programs are written thereafter.

I installed M5 Tools and it updated the display firmware at startup. Now the touch screen seems to be doing much better.
Thank you

from m5unified.

gmgunderground avatar gmgunderground commented on May 23, 2024 1

Now all it's ok

from m5unified.

lovyan03 avatar lovyan03 commented on May 23, 2024

Hello @gmgunderground .

Do you mean that you shift slightly toward the center of the screen from the touched position?

If so, the following code will allow some adjustment.

#include <M5Unified.h>

void setup(void)
{
  M5.begin();

  uint16_t data[8];

/// Calibrate by touching the four corners of the screen in sequence.
  M5.Display.calibrateTouch(data, TFT_WHITE, TFT_BLACK, 32);

/// The data array contains the coordinate values of the four corners.
  Serial.print("calibrate data:\n");
  for (int i = 0 ; i < 8; ++i)
  {
    Serial.printf("[%d] = %d\n", i, data[i]);
  }

/// Or, directly specify the coordinate values of the four corners without touching the screen.
/// If the value is set a little closer to the center, the touch coordinates will be a little outward.
/*
  data[0] =   8;   // left top X
  data[1] =   8;   // left top Y
  data[2] =   8;   // left bottom X
  data[3] = 223;   // left bottom Y
  data[4] = 303;   // right top X
  data[5] =   8;   // right top Y
  data[6] = 303;   // right bottom X
  data[7] = 223;   // right bottom Y
*/

/// set calibrate data:
  M5.Display.setTouchCalibrate(data);
}

void loop(void)
{
  m5gfx::touch_point_t tp[5];
  auto tc = M5.Display.getTouch(tp, 5);
  if (tc)
  {
    M5.Display.fillScreen(0);
    for (int i = 0; i < tc; ++i)
    {
      M5.Display.drawCircle(tp[i].x, tp[i].y, 64, rand());
      M5.Display.drawFastHLine(0, tp[i].y, M5.Display.width(), rand());
      M5.Display.drawFastVLine(tp[i].x, 0, M5.Display.height(), rand());
    }
  }
}

from m5unified.

gmgunderground avatar gmgunderground commented on May 23, 2024

@lovyan03 Thanks for the code, it actually helps a bit to improve the touch behavior, but it still remains quite inaccurate. Especially in the corners, the measured values of X and Y are quite wrong, significantly improving towards the center of the screen

from m5unified.

lovyan03 avatar lovyan03 commented on May 23, 2024

@gmgunderground
Have you tried adjusting data?
If it always shifts toward the center, I think you can compensate by changing the calibration value closer to the center.
For example, try the following .

  uint16_t data[8];

  data[0] =  32;   // left top X
  data[1] =  32;   // left top Y
  data[2] =  32;   // left bottom X
  data[3] = 207;   // left bottom Y
  data[4] = 287;   // right top X
  data[5] =  32;   // right top Y
  data[6] = 287;   // right bottom X
  data[7] = 207;   // right bottom Y

  M5.Display.setTouchCalibrate(data);

BTW, there is an update to the Core2 touch panel firmware.
This reduces the problem of coordinates being shifted vertically at the top of the screen.
( It may have already been updated if your purchase was recent. )

Try to write Core2_Tools once using M5Burner.
If the touch panel firmware is out of date, Core2_Tools will perform the update at startup.

Once the firmware update is performed, it will remain effective even if other programs are written thereafter.

from m5unified.

lovyan03 avatar lovyan03 commented on May 23, 2024

@gmgunderground
Congratulations on the improvement of the touch panel performance issue !

Am I correct in assuming that this Issue has been resolved?

from m5unified.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.