File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 MEDIA ,
2424 KEY_PRESS ,
2525 KEY_RELEASE ,
26+ CHANGE_LAYER ,
2627)
2728
28-
2929# seems to help the touchscreen not get stuck with chip not found
3030time .sleep (3 )
3131
4040cc = ConsumerControl (usb_hid .devices )
4141kbd_layout = KeyboardLayoutUS (kbd )
4242
43- # variables to envorce timout between icon presses
43+ # variables to enforce timout between icon presses
4444COOLDOWN_TIME = 0.5
4545LAST_PRESS_TIME = - 1
4646
132132# helper method to laod icons for an index by its index in the
133133# list of layers
134134def load_layer (layer_index ):
135-
136135 # show the loading screen
137136 main_group .append (loading_group )
138137 time .sleep (0.05 )
@@ -299,6 +298,17 @@ def load_layer(layer_index):
299298 elif _action [0 ] == KEY_RELEASE :
300299 kbd .release (* _action [1 ])
301300
301+ # Change Layer
302+ elif _action [0 ] == CHANGE_LAYER :
303+ if isinstance (
304+ _action [1 ], int
305+ ) and 0 <= _action [1 ] < len (
306+ touch_deck_config ["layers" ]
307+ ):
308+
309+ current_layer = _action [1 ]
310+ load_layer (_action [1 ])
311+
302312 # if there are multiple actions
303313 if len (_cur_actions ) > 1 :
304314 # small sleep to make sure
Original file line number Diff line number Diff line change 66STRING = 3
77KEY_PRESS = 4
88KEY_RELEASE = 5
9+ CHANGE_LAYER = 6
910
1011touch_deck_config = {
1112 "layers" : [
You can’t perform that action at this time.
0 commit comments