fixes for pacman and led circle
This commit is contained in:
1 parent
c3e6857477
commit
3a473ec51e
2 files changed
+43
-11
No files matched your search
+12
@@ -0,0 +1,12 @@
|
||||
### Windows
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
@@ -115,11 +115,20 @@ LED_ANIM_FRAME_MS = 150 # Lauflicht-Tempo ("chase", Zeit pro LED-Schritt)
|
||||
LED_BREATHE_STEP_MS = 15 # Puls-Update-Rate ("breathe", kleiner = weicher)
|
||||
LED_BREATHE_STEPS = 40 # Aufloesung einer Pulsphase ("breathe", rauf ODER runter)
|
||||
|
||||
# "chase": Reihenfolge der LEDs so, dass es wirklich im Kreis laeuft. Bei
|
||||
# der 2x2-Anordnung (1 oben-links, 2 oben-rechts, 3 unten-links, 4 unten-
|
||||
# rechts) ist die physische Kreis-Reihenfolge 1->2->4->3->1 - als 0-basierte
|
||||
# LED-Indizes also [0, 1, 3, 2].
|
||||
LED_CHASE_ORDER = [0, 1, 3, 2]
|
||||
LED_CHASE_BRIGHT_DUTY = 65535 # Helligkeit der "aktiven" LED (max. 65535)
|
||||
LED_CHASE_DIM_DUTY = 6000 # Helligkeit der inaktiven LEDs (0 = ganz aus)
|
||||
|
||||
# --- Bildschirmschoner ---
|
||||
SCREENSAVER_ENABLED = True
|
||||
SCREENSAVER_TIMEOUT_MS = 30000 # 30s Inaktivitaet bis der Screensaver startet
|
||||
SCREENSAVER_FRAME_MS = 80 # Bildwiederholrate der Animation
|
||||
SCREENSAVER_ANIMATION = "stars" # Startwert - "stars"|"pacman"|"matrix"|"bounce"
|
||||
PACMAN_SPEED_PX = 1 # Pac-Man Bewegung pro Bild in Pixel - kleiner = langsamer
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -322,7 +331,11 @@ PROFILES = [
|
||||
{"type": "keys", "keys": [K.LEFT_CTRL, K.S]},
|
||||
{"type": "keys", "keys": [K.LEFT_CTRL, K.F]},
|
||||
{"type": "keys", "keys": [K.F5]},
|
||||
{"type": "keys", "keys": [K.LEFT_CTRL, K.SLASH]},
|
||||
# Strg+Shift+OE: K.SEMICOLON ist die physische Tastenposition,
|
||||
# die bei deutschem Tastaturlayout "OE" ergibt (HID sendet
|
||||
# Positionen, keine Zeichen - das OS macht daraus je nach
|
||||
# eingestelltem Layout das richtige Zeichen).
|
||||
{"type": "keys", "keys": [K.LEFT_CTRL, K.LEFT_SHIFT, K.SEMICOLON]},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -342,7 +355,7 @@ PROFILES = [
|
||||
{"type": "open", "query": "Opera GX"},
|
||||
{"type": "open", "query": "Visual Studio Code"},
|
||||
{"type": "open", "query": "Thunderbird"},
|
||||
{"type": "open", "query": "Vaultwarden"},
|
||||
{"type": "open", "query": "Bitwarden"},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -430,6 +443,15 @@ def apply_led_mode():
|
||||
_led_breathe_dir = 1
|
||||
return
|
||||
|
||||
if LED_MODE == "chase":
|
||||
# "chase" laeuft ebenfalls ueber PWM, damit inaktive LEDs gedimmt
|
||||
# statt komplett aus sind.
|
||||
_led_chase_index = 0
|
||||
for i in range(len(LED_PINS)):
|
||||
active = i == LED_CHASE_ORDER[0]
|
||||
_led_pwm(i).duty_u16(LED_CHASE_BRIGHT_DUTY if active else LED_CHASE_DIM_DUTY)
|
||||
return
|
||||
|
||||
_release_led_pwms()
|
||||
if LED_MODE == "on":
|
||||
for led in leds:
|
||||
@@ -437,10 +459,6 @@ def apply_led_mode():
|
||||
elif LED_MODE == "off":
|
||||
for led in leds:
|
||||
led.value(0)
|
||||
elif LED_MODE == "chase":
|
||||
_led_chase_index = 0
|
||||
for led in leds:
|
||||
led.value(0)
|
||||
|
||||
|
||||
def set_led_mode(mode):
|
||||
@@ -457,11 +475,13 @@ apply_led_mode()
|
||||
|
||||
|
||||
def _led_chase_frame():
|
||||
"""Ein Schritt des Lauflichts - naechste LED an, Rest aus."""
|
||||
"""Ein Schritt des Lauflichts - naechste LED in LED_CHASE_ORDER hell,
|
||||
der Rest gedimmt (statt komplett aus)."""
|
||||
global _led_chase_index
|
||||
for i, led in enumerate(leds):
|
||||
led.value(1 if i == _led_chase_index else 0)
|
||||
_led_chase_index = (_led_chase_index + 1) % len(leds)
|
||||
active_i = LED_CHASE_ORDER[_led_chase_index]
|
||||
for i in range(len(LED_PINS)):
|
||||
_led_pwm(i).duty_u16(LED_CHASE_BRIGHT_DUTY if i == active_i else LED_CHASE_DIM_DUTY)
|
||||
_led_chase_index = (_led_chase_index + 1) % len(LED_CHASE_ORDER)
|
||||
|
||||
|
||||
def _led_breathe_frame():
|
||||
@@ -685,7 +705,7 @@ def _anim_pacman_frame():
|
||||
oled.fill_rect(x - _PACMAN_R, _PACMAN_Y - _PACMAN_R, _PACMAN_R * 2, _PACMAN_R * 2, 1)
|
||||
oled.show()
|
||||
_pacman_mouth_open = not _pacman_mouth_open
|
||||
_pacman_x += 3
|
||||
_pacman_x += PACMAN_SPEED_PX
|
||||
if _pacman_x > OLED_WIDTH + _PACMAN_R + 2:
|
||||
_pacman_x = -(_PACMAN_R + 2)
|
||||
|
||||
|
||||
Reference in new issue
Block a user