-
Notifications
You must be signed in to change notification settings - Fork 638
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 pin provider & runtime settings #2162
Conversation
// Deprecated: legacy mapping, changed to action from above | ||
#define BUTTON_MODE_NONE BUTTON_ACTION_NONE | ||
#define BUTTON_MODE_TOGGLE BUTTON_ACTION_TOGGLE | ||
#define BUTTON_MODE_ON BUTTON_ACTION_ON | ||
#define BUTTON_MODE_OFF BUTTON_ACTION_OFF | ||
#define BUTTON_MODE_AP BUTTON_ACTION_AP | ||
#define BUTTON_MODE_RESET BUTTON_ACTION_RESET | ||
#define BUTTON_MODE_PULSE BUTTON_ACTION_PULSE | ||
#define BUTTON_MODE_FACTORY BUTTON_ACTION_FACTORY | ||
#define BUTTON_MODE_WPS BUTTON_ACTION_WPS | ||
#define BUTTON_MODE_SMART_CONFIG BUTTON_ACTION_SMART_CONFIG | ||
#define BUTTON_MODE_DIM_UP BUTTON_ACTION_DIM_UP | ||
#define BUTTON_MODE_DIM_DOWN BUTTON_ACTION_DIM_DOWN | ||
#define BUTTON_MODE_DISPLAY_ON BUTTON_ACTION_DISPLAY_ON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecation path for these is a bit tricky. -DBUTTON1_CLICK=BUTTON_MODE_DIM_UP
would show error: ‘BUTTON_MODE_DIM_UP’ was not declared in this scope
, but that's it.
#pragma GCC poison TOKEN
can restrict token usage in code, assuming poison is set even before custom header is included. One issue with that it won't work with -D... flags, warning: poisoning existing macro "..."
is the best it could do.
Is it worthwhile adding a comment in the wiki that |
I have changed wiki to mention CONFIG: https://github.com/xoseperez/espurna/wiki/Buttons-and-switches/_compare/d7ebe181744cc33de0b4b33e204682aa0be48639...91f9bd8eb9b8e10eea38b1eacb3c770869e6d436 It should probably also mention the deprecation itself, something like "since version 1.14.2 BUTTON[1-8]_CONFIG is used instead of BUTTON[1-8]_MODE" |
I've added it, please amend if not correct :-) |
Thanks! Seems sorted now |
Remove direct pin control from debounceevent, implement basic class to override digitalRead(), digitalWrite() and pinMode()
Rework debouncevent header, move locally to simplify changes (may be subject to change)
Next on TODO is to re-implement sonoff dual through this approach and remove hardware-specific changes, replacing them with a different "pin" variant. Hopefully this approach isn't completely wrong.
@Tofandel as proposed buttons changes. still no schema, but will add that after (also with proxies to getSetting for ws properties)
as was noted when changing lights code, I am not sure I want getSetting in ctor code since we can't guarantee that settings storage is working. Instead, provide general constructor and apply every setting externally.