Skip to content

Commit

Permalink
Remove some bad coding
Browse files Browse the repository at this point in the history
while True and ...
  • Loading branch information
moon-jam committed Oct 24, 2024
2 parents 5f01d06 + ed10230 commit 3800f91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions python/inputmodule/gui/ledmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def countdown(dev, seconds):
set_status('countdown')
start = datetime.now()
target = seconds * 1_000_000
while True and get_status() == 'countdown':
while get_status() == 'countdown':
if is_thread_stopped() or is_dev_disconnected(dev.device):
reset_thread()
return
Expand All @@ -51,7 +51,7 @@ def blinking(dev):
"""Blink brightness high/off every second.
Keeps currently displayed grid"""
set_status('blinking')
while True and get_status() == 'blinking':
while get_status() == 'blinking':
if is_thread_stopped() or is_dev_disconnected(dev.device):
reset_thread()
return
Expand All @@ -65,7 +65,7 @@ def random_eq(dev):
"""Display an equlizer looking animation with random values."""
animate(dev, False)
set_status('random_eq')
while True and get_status() == 'random_eq':
while get_status() == 'random_eq':
if is_thread_stopped() or is_dev_disconnected(dev.device):
reset_thread()
return
Expand All @@ -82,7 +82,7 @@ def clock(dev):
Loops forever, updating every second"""
animate(dev, False)
set_status('clock')
while True and get_status() == 'clock':
while get_status() == 'clock':
if is_thread_stopped() or is_dev_disconnected(dev.device):
reset_thread()
return
Expand Down
6 changes: 3 additions & 3 deletions python/inputmodule/inputmodule/ledmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def camera(dev):
end_x = min(dim[1], start_x + WIDTH)

# Pre-process the video into resized, cropped, grayscale frames
while True and get_status() == 'camera':
while get_status() == 'camera':
ret, frame = capture.read()
if not ret:
print("Failed to capture video frames")
Expand Down Expand Up @@ -166,7 +166,7 @@ def video(dev, video_file):
processed = []

# Pre-process the video into resized, cropped, grayscale frames
while True and get_status() == 'video':
while get_status() == 'video':
ret, frame = capture.read()
if not ret:
print("Failed to read video frames")
Expand Down Expand Up @@ -301,7 +301,7 @@ def breathing(dev):
Keeps currently displayed grid"""
set_status('breathing')
# Bright ranges appear similar, so we have to go through those faster
while True and get_status() == 'breathing':
while get_status() == 'breathing':
# Go quickly from 250 to 50
for i in range(10):
time.sleep(0.03)
Expand Down

0 comments on commit 3800f91

Please sign in to comment.