Skip to content

Commit

Permalink
fix night mode issue and nicer fading on pi2
Browse files Browse the repository at this point in the history
  • Loading branch information
amcolash committed Oct 30, 2024
1 parent 21d42e0 commit 81888a7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/python/leds.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,14 @@ def updateLeds(cls):

for c in range(3):
if abs(led['current'][c] - currentTarget[c]) <= Config.FADE_SPEED: led['current'][c] = currentTarget[c]
elif led['current'][c] < currentTarget[c]: led['current'][c] = min(currentTarget[c], int((led['current'][c] + 1) * 1.25))
elif led['current'][c] > currentTarget[c]: led['current'][c] = max(currentTarget[c], int((led['current'][c] + 1) * 0.75))
elif led['current'][c] < currentTarget[c]: led['current'][c] = min(currentTarget[c], int((led['current'][c] + 1) * 1.15))
elif led['current'][c] > currentTarget[c]:
led['current'][c] = max(currentTarget[c], int((led['current'][c] + 1) * 0.85))

# Handle edge case with multiplication of 3 + 1 * 0.75 = 3, never actually fades
if led['current'][c] == led['previous'][c] and led['current'][c] > currentTarget[c]:
led['current'][c] -= 1

# elif led['current'][c] < currentTarget[c]: led['current'][c] += Config.FADE_SPEED
# elif led['current'][c] > currentTarget[c]: led['current'][c] -= Config.FADE_SPEED

Expand Down

0 comments on commit 81888a7

Please sign in to comment.