Clean up timebase crasher

master
Ryan Rix 8 years ago
parent 1b9f170f04
commit 630a75348c

@ -59,9 +59,10 @@ class Lightrix:
return
def timebased(idx, msg):
"""Set different colors depending on the time of the day"""
time = datetime.datetime.now(tz=pytz.timezone('US/Pacific'))
m = time.minute
if time.hour < 7 and time.hour > 0: # low red at night
if time.hour < 7 and time.hour >= 0: # low red at night
return Color(64, 0, 0)
if time.hour == 7: # fade to brighter yellow over the morning
return Color(64 + m, m, 0)
@ -77,8 +78,7 @@ class Lightrix:
return Color(255 - m*2, 255 - m*2, 128 - m)
if time.hour == 23: # slowly fade to low red over the hour
return Color(64 + 60 - m, 64 + 60 - (m * 2), 0)
if time.hour == 24: # low red at night
return Color(64, 0, 0)
return Color(64, 0, 0) # failback
def wheelStrip(idx, msg):
val = int(msg.split(' ')[1])

Loading…
Cancel
Save