Skip to content
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

options for btnmatrix #38

Closed
nagyrobi opened this issue Jan 12, 2024 · 19 comments
Closed

options for btnmatrix #38

nagyrobi opened this issue Jan 12, 2024 · 19 comments

Comments

@nagyrobi
Copy link

nagyrobi commented Jan 12, 2024

one_checked option from: https://docs.lvgl.io/8.3/widgets/core/btnmatrix.html#one-check

It's for making possible to check only one button from the matrix. When you toggle a button, the others will be "de-toggled".
It would also be nice to complement this feature with the select functionality.

also we need on_value trigger to retrieve in x the ID of the button that was pressed.

@nagyrobi nagyrobi changed the title one_checked option for btnmatrix options for btnmatrix Jan 12, 2024
@clydebarrow
Copy link
Owner

one_checked option from: https://docs.lvgl.io/8.3/widgets/core/btnmatrix.html#one-check

Already implemented.

we need on_value trigger to retrieve in x the ID of the button that was pressed.

Why? Each button in a button matrix can have its own actions. Although internally they are different to regular buttons, this is masked via the yaml config.

@nagyrobi
Copy link
Author

nagyrobi commented Jan 13, 2024

Why? Each button in a button matrix can have its own actions. Although internally they are different to regular buttons, this is masked via the yaml config.

For the users to easier implement something like key_collector to design an alarm input panel for example. With on_value you could use the same action to receive the different button presses...

It's like when you need to input a sequence of numbers like a pin code - without having to define complicated scripts to concatenate incoming strings located in global variables.
Actually, key_collector is a pretty well thought out component for this purpose. Maybe we could make btnmatrix work with it?

Also see #34 (comment)

@nagyrobi
Copy link
Author

one_checked option from: https://docs.lvgl.io/8.3/widgets/core/btnmatrix.html#one-check

Already implemented.

Tested, config passes through the schema, but doesn't have any effect. Multiple buttons can stay checked.

@clydebarrow
Copy link
Owner

Actually, key_collector is a pretty well thought out component for this purpose. Maybe we could make btnmatrix work with it?

Or maybe make key_collector work with LVGL.

@clydebarrow
Copy link
Owner

ested, config passes through the schema, but doesn't have any effect. Multiple buttons can stay checked.

Fixed.

@nagyrobi
Copy link
Author

Or maybe make key_collector work with LVGL.

I think both need to know about each other @ssieb

@ssieb
Copy link

ssieb commented Jan 17, 2024

If the btnmatrix provides the key_provider interface, then it will work automatically.

@nagyrobi
Copy link
Author

nagyrobi commented Jan 17, 2024

@ssieb Can you point out a sample in the code?

@ssieb
Copy link

ssieb commented Jan 17, 2024

Check out the wiegand and matrix_keypad components for example. It's very simple.

@nagyrobi
Copy link
Author

@clydebarrow maybe we could add a config option key_provider: true to btnmatrix root, and simply provide the texts put on the buttons to it as keys (and not allow symbols in this case).

@clydebarrow
Copy link
Owner

That will work, no need for the config option, and it will just send the first character of the button label (key_provider can only send single characters.)

@ssieb
Copy link

ssieb commented Jan 17, 2024

Symbols are fine. If you want to send more than a single character, then just call the send method multiple times.

@nagyrobi
Copy link
Author

nagyrobi commented Jan 18, 2024

@ssieb symbols here are graphical elements, not just *# keys.

@clydebarrow I thought about config option because one may use multiple btnmatrix instances (eg page navigation etc) and likely wouldn't want to use key_provider with those.

@clydebarrow
Copy link
Owner

Symbols in the LVGL world are just Unicode strings.

The btnmatrix won't send any keys unless it's connected to a key_collector.

@ssieb
Copy link

ssieb commented Jan 18, 2024

The key interface only handles uint8_t right now because it originally came from the keypad component. It could be expanded, but I'm not sure how useful that would be. What would you be using the keys for?
This should probably be a discord discussion. :-)

@nagyrobi
Copy link
Author

The btnmatrix won't send any keys unless it's connected to a key_collector.

Oh, you'd put at source_id the btnmatrix id?

@ssieb
Copy link

ssieb commented Jan 18, 2024

Yes. As with most things in esphome, if there's only one source, it will pick it up automatically, but otherwise, you need to specify the source id.

@clydebarrow
Copy link
Owner

If the btnmatrix provides the key_provider interface, then it will work automatically.

Done. Works a treat.

@nagyrobi
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants