-
Notifications
You must be signed in to change notification settings - Fork 804
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
feat(button): Refactor button press enum values and add BUTTON_PRESS_NORMAL event (AEGHB-527) #327
feat(button): Refactor button press enum values and add BUTTON_PRESS_NORMAL event (AEGHB-527) #327
Conversation
👋 Hello franz-ms-muc, we appreciate your contribution to this project! Click to see more instructions ...
Review and merge process you can expect ...
|
…NORMAL event Added calls for `BUTTON_PRESS_NORMAL` in `iot_button.c` when the button is pressed down or released.
825650f
to
46050bc
Compare
With this Callback to event Type NORMAL, one can Register 3 Callbacks:
While the UP and DOWN Presses work as before, the "NORMAL" one gets both the Down and Up Events. for use in a IEC 61499 Environment see Video: Devcon23 - Turning the ESP32 into a PLC with the Eclipse 4diac™ Framework: The Project logiBUS® this maps then:
so this Button Driver then is a VERY Flexible Solution. |
Hi franz-ms-muc: Why introduce the BUTTON_PRESS_NORMAL event? Users can register the same callback for different events and use iot_button_get_event within the callback to determine which event was triggered. This approach offers flexibility in handling multiple events with a single callback. |
Hi, Why, it is not about register the same Callback for several Events but register 3 Callbacks: one only get the UP Events, |
The button now supports registering multiple callback functions for a single event. You can register the same function for both the 'up' and 'down' events to handle both, and then separately register functions to specifically handle 'up' and 'down' events if needed. It seems that we may not need the 'normal' event in this context. |
you can Register 2 Callbacks for 1 Event ? |
|
Yes. Please see https://docs.espressif.com/projects/esp-iot-solution/en/latest/input_device/button.html#register-callback-function |
Cool I will test it. Good work. |
@franz-ms-muc Hi, can the current button component meet your needs? If there are no other issues, this PR will be closed. Thank you for your contribution |
yes, did work . |
BUTTON_PRESS_NORMAL not needed anymore. |
@franz-ms-muc @diplfranzhoepfinger @lijunru-hub Thanks, I will close this PR since it is no longer needed |
iot_button.h
to include a new valueBUTTON_PRESS_NORMAL
.BUTTON_PRESS_NORMAL
iniot_button.c
when the button is pressed down or released.These changes improve the clarity and flexibility of handling different button press events.