Skip to content

Commit

Permalink
short sleep after turning of each led
Browse files Browse the repository at this point in the history
  • Loading branch information
tobru committed Jun 2, 2024
1 parent 87fb7c4 commit da50bac
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions podstatus/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@

from config import *

# Configure logging
logging.basicConfig(
level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s"
)

# Initialize the Flask app
app = Flask(__name__)
app.secret_key = config.FLASK_APP_SECRET_KEY
Expand Down Expand Up @@ -66,12 +61,7 @@ def turn_off_blinkstick():
logging.info("Turning off BlinkStick")
for i in range(config.BLINKSTICK_TOTAL_LED):
bstick.set_color(channel=0, index=i, hex="#000000")


atexit.register(turn_off_blinkstick)

# Threading setup
stop_event = Event()
time.sleep(0.1)


def set_led_color(pod_index, color):
Expand Down Expand Up @@ -120,6 +110,11 @@ def background_blinkstick_update():
time.sleep(5) # Add a small delay to prevent high CPU usage


atexit.register(turn_off_blinkstick)

# Threading setup
stop_event = Event()

# Initialize the background thread and start it
background_thread = Thread(target=background_blinkstick_update, daemon=True)
background_thread.start()
Expand Down

0 comments on commit da50bac

Please sign in to comment.