• I am currently developing an app for my new bangle.js 2. While attempting to troubleshoot some buggy behavior in my app, I noticed that the root cause was that I was expecting the values reported by Bangle.on("touch") to align with the pixels on the screen, meaning that both the X and Y coordinate would be somewhere between 0 and 175 because the screen is 176x176. However, this is not the case, so I was experiencing bugs. When tapping the bottom right corner of the screen, I am able to reach as high as (191, 184). This seems to imply that the touch resolution is 192x192. Is this correct? And if so, where can I find this documented?

  • Hi,

    What firmware version do you have?

    There are some other posts on the forum on this if you do a search, but basically:

    • The touchscreen stretches past the edge of the LCD, so to ensure touches actually align with the pixels the coordinates have to go past the edge of the screen (sometimes even negative) if you press somewhere past the edge of the screen.
    • On 'cutting edge' builds (and 2v13 when released) the touch coordinates will now be clipped to the screen coordinates (0..175) even if you tap outside
    • The 'drag' event coordinates are not clipped because we don't want to artificially limit the amount of scrolling area available

    The touch screen resolution isn't 192x192 -and I wouldn't rely on any particular value for its size.

    And if so, where can I find this documented?

    http://www.espruino.com/Reference is the best source of info. But if you think something is missing please let me know where and what you expect to find and I can fix it.

  • What firmware version do you have?

    Firmware 2v12, Boot v0.43.

    The touchscreen stretches past the edge of the LCD, so to ensure touches actually align with the pixels the coordinates have to go past the edge of the screen (sometimes even negative) if you press somewhere past the edge of the screen.

    Through experimentation, the lowest coordinate I can get in the top left is (5, 9) and the highest coordinate I can get in the bottom right is (191, 185). I can still get values in the 180s if I tap quite solidly on the screen, with my entire finger within the screen area.

    On 'cutting edge' builds (and 2v13 when released) the touch coordinates will now be clipped to the screen coordinates (0..175) even if you tap outside

    Does this mean areas still on the screen outside of this range will become unreachable?

    I wouldn't rely on any particular value for its size

    Is this because it could be different on every watch? If I can't rely on the touch resolution being a certain size, that means I can't rely on the coordinates to correspond to the pixels the user pressed. In that case, if I have multiple on-screen buttons, how am I supposed to tell which one the user pressed?

    http://www.espruino.com/Reference is the best source of info. But if you think something is missing please let me know where and what you expect to find and I can fix it.

    In https://www.espruino.com/Reference#l_Ban­gle_touch, it states that xy is an "Object of form {x,y} containing touch coordinates (if the device supports full touch)". If there was a quirk like this, I'd expect it to be mentioned here. (Additionally, I don't think this explains what happens on Bangle.js 1, a device which doesn't have full touch, though that's less important to me because I don't have a Bangle 1.)

  • Espruino code uses 160x160 from digging around, mb thats a close estimate of what you should be using?
    LCD_WIDTH / 160
    and
    LCD_HEIGHT / 160
    So these values would be your 'unit chunks' for touch grid size. So its like 0-160, is multiplies that number by LCD_HEIGHT/160 to get the amount in 'pixels', and it stores as int, so its naturally math.floor rounded down to its integer.

    But the main bottleneck concern, surely is whether your fat finger can touch that little pixels? The minimum size should be what your finger can hit and its location will not matter because the unitSize is small enough in relation to the 'fingerSize' that it won't matter.

  • Very good to know. Through experimentation, I've found that touch works OK if I clip it manually to be within 0..176. It's necessary to tap the center of the buttons, and difficult to distinguish anything much smaller than my buttons, but it works. If I get annoyed, maybe I'll try 160x160.

  • Ye i edited my msg, the thing about rounding isn't so true I think. Its just division, then flooring.

  • I dont have a Bangle v2, but out of curiosity, how does the touch callback fire? If you touch screen does it fire for each touchPixel that is touched, because I would imagine the finger hits multiple co-ordinates. Or does it just fire once? Or does the callback return a list of co-ordinates? If it fires just once, then how does it choose which touchPixel out of the possible ones that it touched, hm, does it take the center? Averge of them all, mb.
    I might check this out in code.
    Edit: looked at the code, its very automatically done by the touch controller device. Command is sent to it, and then read from it, and it returns a value from 0-160. So its handled by it, assuming it uses some sort of averaging to find center pixel.

  • 176 / 160 = 1.1 exactly.
    So every 1.1 units of LCD display, is roughly 1 touch pixel. The touch callback is returning LCD pixels, not touch pixels because it wants to abstract that away, its mostly irrelevant.

    the callback fires, converts the touch pixel into LCD pixels, and gives you that, so you can work with LCD pixels without converting.

  • Thank you! That sounds like it will be very useful.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Touch resolution and display resolution different?

Posted by Avatar for user141569 @user141569

Actions