Skip to content

Conversation

@liebman
Copy link
Contributor

@liebman liebman commented Dec 24, 2020

Sometimes IRQ is very noisy an prevents things like idle time detection. This PR will check to insure there is pressure detected on the panel, not just the noisy IRQ signal. Disabled by default in Kconfig.
Fixes #7

@liebman
Copy link
Contributor Author

liebman commented Dec 25, 2020

I've added an additional config option to use pressure only and ignore IRQ (not even configure the pin).

@C47D
Copy link
Collaborator

C47D commented Dec 29, 2020

Hi @liebman, all looks good. Do you think is it possible to move the touch detection code into a new function that returns 0 when there's no touch detected and another positive number when there's touch detected? Something like xpt2048_is_press_detected?

@liebman
Copy link
Contributor Author

liebman commented Dec 29, 2020

@C47D is there a specific use case for this? (your asking for this to be non-static I assume)

EDIT: or maybe this is just to make the logic more readable.... Can it return a bool?

@C47D
Copy link
Collaborator

C47D commented Dec 29, 2020

EDIT: or maybe this is just to make the logic more readable.... Can it return a bool?

Yes, to make the logic more readable, and yes, it can return a bool or an enum, I find enums be more readables.

typedef enum {
TOUCH_NOT_DETECTED = 0,
TOUCH_DETECTED = 1,
} xpt2046_touch_detected;

@liebman
Copy link
Contributor Author

liebman commented Dec 29, 2020

@C47D I'm looking for a better name for the Z_MIN constant. Any ideas? (as usual it's naming that's the hardest) Maybe move to the header and name XPT2046_Z_MIN?)

@C47D
Copy link
Collaborator

C47D commented Dec 29, 2020

Maybe Z_TOUCH_DETECTION_THRESHOLD?, here I was exposing the z threshold in the menuconfig, and added a function so the user can change the threshold at runtime, but maybe that's an overkill.

@liebman
Copy link
Contributor Author

liebman commented Dec 29, 2020

@C47D I've refactored it a bit. One more change that may help is to make the Kconfig part more of a choose one of three.

  • IRQ only (default for backwards compatibility)
  • IRQ & Touch
  • Touch only

Thoughts?

@liebman
Copy link
Contributor Author

liebman commented Dec 29, 2020

Tried the Kconfig choice, let me know what you think.

@C47D
Copy link
Collaborator

C47D commented Dec 29, 2020

Hi, it looks good, I don't have any hardware to test it, is it ready to merge?

@liebman
Copy link
Contributor Author

liebman commented Dec 30, 2020

Yes :-)

@C47D C47D merged commit 6b1e219 into lvgl:master Dec 30, 2020
@C47D
Copy link
Collaborator

C47D commented Dec 30, 2020

Thanks for the work you've put into this. I will try to test this with hardware once I get some free time.

@liebman liebman deleted the use_z_test_for_press branch December 30, 2020 19:19
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

Successfully merging this pull request may close these issues.

XPT2046 improvement discussion

2 participants