-
Notifications
You must be signed in to change notification settings - Fork 783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUTTON] Different timeout trigger callback (AEGHB-128) #257
Comments
@law-ko I think it's theoretically possible, and we'll support it in the next release |
The current solution is that you can create multiple button_handles but the underlying layer can use the same hardware IO |
Thanks for the insight, I cannot seem to figure out how BUTTON_LONG_PRESS_START and BUTTON_LONG_PRESS_HOLD works. The current setup is like this:
Seems like I am only able to trigger the We want something like this:
where if the user presses more than 6 seconds and release, then it will trigger |
Thanks for your replay, BUTTON_LONG_PRESS_START only triggered once, but BUTTON_LONG_PRESS_HOLD triggered many times during long pressing |
You can register a button_press_up event, call iOT_BUTTTON_GET_TICKS_TIME in the event, judge the lifting time of 6-10s or 10s, and then make corresponding operations to the corresponding operation |
@lijunru-hub However, this way we are unable to trigger the 10second one without releasing the button, correct? In the original method, the 10 second will be triggered once the button is hold 10 seconds and not releasing the button. |
Yes, but it is also difficult for the driver to provide a longpress_cb that supports both 5s and 10s long presses. because when the 5s comes, it is not known whether the user will continue to press. So it is better to use release_up in the application layer to assist detection |
Multiple long press events are now supported |
@lijunru-hub I have tried it but it seems like the second hold callback cannot be triggered and the first hold callback will get triggered even if the button is not released yet.
|
Using |
In the original example under
esp-homekit-sdk
, we can set different release callback trigger functions with different timeout specified, like below:However, with the current version we can only define one long press timeout, with
.long_press_ticks
Any way we can define multiple timeout callbacks?
Thank you.
The text was updated successfully, but these errors were encountered: