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

Toggle with no dataref state #5

Open
devleaks opened this issue Aug 28, 2022 · 4 comments
Open

Toggle with no dataref state #5

devleaks opened this issue Aug 28, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@devleaks
Copy link

Hello,

there are a few cases where you have a command and the state of the command is not reflected in dataref.
For example, the sim/map/show_current command displays the map on screen, but there is no way to know map is open or not.
There are numerous such "toggle" commands. However, it is interesting to reflect the state (off or on) in the button icon.

I suggest we add a toggle type with two icons and switch between the two icons each time the button is pressed.
I understand there is not way to "guess" the initial state of the toggle, we assume it is OFF.

Pierre

@wortelus
Copy link
Owner

There once was ignored auto-switch yaml parameter for similar purpose.
Toggle key type should be the right approach, something like autodual handler by key callback event.

The method could just then swap the file_names Button instance field, so it could be treated as simple static icon in the main loop - deck_show_static.
Afterwards, initiate re-draw of the key, the swap would guarrantee that the deck_show_static would draw the correct state on switching between directories.

This way there won't be any additions to the main loop, preserving the efficiency.

@wortelus wortelus added the enhancement New feature or request label Aug 29, 2022
@devleaks
Copy link
Author

Here is my 2 cents suggestion: for all buttons, you maintain a incremental counter each time it is pushed. For buttons of type auto-cycle, you display the icon file_names Indexed by count_pushed modulo len(file_names). That way you can cycle through more than just 2 values.

@matt-ct
Copy link

matt-ct commented Aug 29, 2022

You can do this now in lua. Just create a user Dataref and control it in the streamdeckhandler lua script. In the 172 script I create a frame rate Dataref and 4 for the transponder digits. Let me know if you need a copy of it.

@wortelus
Copy link
Owner

Here is my 2 cents suggestion: for all buttons, you maintain a incremental counter each time it is pushed. For buttons of type auto-cycle, you display the icon file_names Indexed by count_pushed modulo len(file_names). That way you can cycle through more than just 2 values.

That would create 0-1-2-0-1-2 pattern, some buttons could cycle 0-1-2-1-0
Additional parameter like cycling would be required to specify the pattern.

This can be of course solved in lua, but having an internal solution would be nice to have.

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

No branches or pull requests

3 participants