esp-iot-solution
esp-iot-solution copied to clipboard
feat(button): Refactor button press enum values and add BUTTON_PRESS_NORMAL event (AEGHB-527)
- Refactored the enum values for button press in
iot_button.hto include a new valueBUTTON_PRESS_NORMAL. - Added calls to the event callback function for
BUTTON_PRESS_NORMALiniot_button.cwhen the button is pressed down or released.
These changes improve the clarity and flexibility of handling different button press events.
| Messages | |
|---|---|
| :book: | 🎉 Good Job! All checks are passing! |
👋 Hello franz-ms-muc, we appreciate your contribution to this project!
Click to see more instructions ...
This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.
DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.
Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.
Review and merge process you can expect ...
We do welcome contributions in the form of bug reports, feature requests and pull requests.
1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.
Generated by :no_entry_sign: dangerJS against 46050bc1e9d5b29ccb1ed552af8b5ad42d0cb073
With this Callback to event Type NORMAL,
one can Register 3 Callbacks:
- BUTTON_PRESS_NORMAL
- BUTTON_PRESS_UP
- BUTTON_PRESS_DOWN
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:
- BUTTON_PRESS_NORMAL maps to a IX
- BUTTON_PRESS_UP maps to a IE
- BUTTON_PRESS_DOWN maps to a IE
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, another only get the DOWN Events, and a third is getting up and Down 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.
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 ?
The button now supports registering multiple callback functions for a single event. OK, will test. then we do not need this ! cool. !!!!!!
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