This commit is contained in:
Michael Grote 2021-08-25 22:32:18 +02:00
parent da7488af4e
commit edef2aedb1

View file

@ -60,6 +60,10 @@ layers = {0: layer_0,
current_layer = 1 current_layer = 1
nutzbare_tasten = range(4,16) #zählt von 1-16; nicht 0-15 nutzbare_tasten = range(4,16) #zählt von 1-16; nicht 0-15
short_debounce = 0.03
long_debounce = 0.15
debounce = short_debounce
taste_ausgelöst = False
# The colours for each layer # The colours for each layer
# https://gist.github.com/ninrod/b0f86d77ebadaccf7d9d4431dd8e2983 # https://gist.github.com/ninrod/b0f86d77ebadaccf7d9d4431dd8e2983
@ -112,21 +116,28 @@ while True:
keybow.keys[3].set_led(252, 84, 4) keybow.keys[3].set_led(252, 84, 4)
for taste in layers[current_layer].keys(): for taste in layers[current_layer].keys():
if keys[taste].pressed: if keys[taste].pressed:
key_press = layers[current_layer][taste] key_press = layers[current_layer][taste]
if current_layer == 0:
keyboard.send(key_press) # If the key hasn't just fired (prevents refiring)
elif current_layer == 1: if not taste_ausgelöst:
keyboard.send(key_press) taste_ausgelöst = True
elif current_layer == 2:
layout.write(key_press) # Send the right sort of key press and set debounce for each
elif current_layer == 3: if current_layer == 0:
consumer_control.send(key_press) keyboard.send(key_press)
elif current_layer == 1:
keyboard.send(key_press)
elif current_layer == 2:
debounce = long_debounce
layout.write(key_press)
elif current_layer == 3:
consumer_control.send(key_press)
# keycode = current_layer[key.number]
# if keys[taste].pressed:
# keyboard.send(keycode)
# If enough time has passed, reset the fired variable
if taste_ausgelöst and time.monotonic() - keybow.time_of_last_press > debounce:
taste_ausgelöst = False
# farben als vars # farben als vars