Open devleaks opened 2 years ago
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.
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.
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.
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 iconfile_names
Indexed bycount_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.
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