Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. brownb2
    3. Posts
    B
    • Continue chat with brownb2
    • Start new chat with brownb2
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by brownb2

    • RE: M5Core2 library fork that supports multi-touch and provides Arduino-style virtual buttons [update: and gestures and events] [update2: MERGED !]

      For anybody else looking at fixing the issue with multiple simultaneous button presses it seems it can't be done.

      Having dived into the M5Core2 source the events generated for two button presses, e.g. A & C, are press for A and move for A.
      This looked like a deeper bug (since the second should have been identified as C), so going further in I found that an else branch wasn't refreshing the currently identified touched button on second press (C) in the method "doEvents" in touch.cpp (it doesn't help the code isn't documented, isn't single responsibility and has an arrow antipattern too).

      Fixing that bug, so the correct button is refreshed, showed that two events together did not produce presses for A & C but instead (I assume - I'm fed up at this point) the hardware averages the presses' coordinates and declares it's button B(!) that is pressed.

      If you have old Core 1 code you're porting that uses two simultaneous button presses I'd suggest changing the code to double taps of a single button instead which is the workaround I'm about to use - to remain consistent this behaviour is both on Core 1 and Core 2

      More formally, I should have read the file header in touch.h earlier:

      the M5Stack Core2 touch display is only
      multi-touch in one dimension. What that means is that it can detect two
      separate touches only if they occur on different vertical positions.
      This has to do with the way the touch screen is wired, it's not
      something that can be changed in software. So you will only ever see
      two points if they do not occur side-by-side. Touches that do happen
      side-by-side blend into one touch that is detected somewhere between
      the actual touches.

      posted in Core 2
      B
      brownb2
    • RE: M5Core2 library fork that supports multi-touch and provides Arduino-style virtual buttons [update: and gestures and events] [update2: MERGED !]

      @Rop I've just started some work porting some old Core 1 M5Stack code to the Core 2 API and found that the 3 bottom buttons don't work quite in the same way.

      For instance this:

      if (M5.BtnA.isPressed() && M5.BtnC.isPressed()) {
      // do something
      }

      doesn't work on the Core 2 despite the multi touch. It only registers the first button to be pressed rather than both.

      Is this something you could fix or provide a hint as to what I need to look at to hack it myself?

      posted in Core 2
      B
      brownb2