‎2022-05-23 05:48 AM
How do we know if our hand is on the button? e.g; If our hand is on a button, the led is always on, if we raise our hand over that button, the led turns off.
‎2022-05-23 06:36 AM
Proximity sensors. Capacitive, thermal, IR reflective, make your choice.
‎2022-05-23 06:52 AM
What kind of "button" may have an influence...
‎2022-05-23 07:18 AM
You misunderstood the question as the title is incorrect. I meant the prepare button with TFT GUI. You can read the post below.
https://community.st.com/s/question/0D53W00001YdFteSAF/long-press-button-increment-fast-value
‎2022-05-23 07:33 AM
"You misunderstood the question as the title is incorrect"
:face_with_tears_of_joy: :grinning_face_with_sweat: :>
So what does the TouchGFX documentation tell you?
Presumably, you get an event to tell you when it's "touched", and another to tell when that touch has gone away ... ?
"You can read the post below"
So why start a new thread if it's still the same question?
Did the solution provided there by @Yoann KLEIN​ not work?
‎2022-05-23 07:42 AM
It's okay to detect that you're touching the button. I can't detect that you're pulling your hand away from the button
Did the solution provided there by @Yoann KLEIN (ST Employee)​ not work?
No, dont work
‎2022-05-23 07:49 AM
"No, dont work"
Then feed-back in the other thread so that he can help you further...
‎2022-05-23 07:54 AM
"I can't detect that you're pulling your hand away from the button"
But that is exactly what the example that @Yoann KLEIN​ linked you to does:
https://community.st.com/s/question/0D50X0000CBl0asSQB/long-touch-detect-on-stm32l4r9aieval
‎2022-05-24 04:00 AM
I write below like this. But dont call handleClickEvent so dont get buttonPressedFlag = 1
void Ana_MenuView::handleClickEvent(ClickEvent& evt)
{
if(evt.getType() == ClickEvent::PRESSED)
{
buttonPressedFlag = 1;
}
else if(evt.getType() == ClickEvent::RELEASED)
{
buttonPressedFlag = 0;
}
}
void Ana_MenuView::handleTickEvent()
{
if (buttonPressedFlag)
{
temp_counter++;
Unicode::snprintf(textArea2Buffer, TEXTAREA2_SIZE, "%d", temp_counter);
textArea2.invalidate();
}
}
‎2022-05-24 04:05 AM
Did you read & follow the rest of the linked thread?
Particularly, "Look at how a Button and AbstractButton is implemented" ...