Skip to content

Commit

Permalink
Limit led cycle time to max 10ms
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreWohnsland committed Mar 7, 2023
1 parent aa0b913 commit 887ad15
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/machine/leds.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ def _preparation_thread(self):
"""Fills one by one with same random color, then repeats / overwrites old ones"""
# Make the circle / dot approximate 2 rounds per second
wait_ms = 500 / cfg.LED_COUNT
# not faster than 10ms
wait_ms = max(10, wait_ms)
self.turn_on(Color(randint(0, 255), randint(0, 255), randint(0, 255)))
while self.is_preparing:
color = Color(
Expand Down

0 comments on commit 887ad15

Please sign in to comment.