adding back true that got deleted somehow - should probably just sleep instead of fixing stupid errors.
This commit is contained in:
+6
-4
@@ -1,8 +1,10 @@
|
|||||||
from datetime import datetime, time
|
|
||||||
|
|
||||||
import adafruit_character_lcd.character_lcd_rgb_i2c as character_lcd
|
|
||||||
import board
|
import board
|
||||||
import busio
|
import busio
|
||||||
|
import adafruit_character_lcd.character_lcd_rgb_i2c as character_lcd
|
||||||
|
|
||||||
|
from datetime import datetime, time
|
||||||
|
|
||||||
from pytz import timezone
|
from pytz import timezone
|
||||||
|
|
||||||
from calendar_grabber import CalGrab
|
from calendar_grabber import CalGrab
|
||||||
@@ -25,12 +27,11 @@ lcd = character_lcd.Character_LCD_RGB_I2C(i2c, lcd_columns, lcd_rows)
|
|||||||
def is_event_active(events, now):
|
def is_event_active(events, now):
|
||||||
for event in events:
|
for event in events:
|
||||||
if event.start_time < now and event.end_time > now:
|
if event.start_time < now and event.end_time > now:
|
||||||
|
return True
|
||||||
|
|
||||||
def is_work_time(now):
|
def is_work_time(now):
|
||||||
return now < WORK_STOP and now > WORK_START
|
return now < WORK_STOP and now > WORK_START
|
||||||
|
|
||||||
|
|
||||||
def update_display(color, text, cursor = False, blink = False):
|
def update_display(color, text, cursor = False, blink = False):
|
||||||
print(text)
|
print(text)
|
||||||
lcd.color = color
|
lcd.color = color
|
||||||
@@ -43,6 +44,7 @@ def process_events(events):
|
|||||||
now = datetime.now(tz=TIMEZONE)
|
now = datetime.now(tz=TIMEZONE)
|
||||||
print("PROCESSING EVENTS")
|
print("PROCESSING EVENTS")
|
||||||
is_working_time = is_work_time(now.time())
|
is_working_time = is_work_time(now.time())
|
||||||
|
print(is_working_time)
|
||||||
if is_event_active(events, now):
|
if is_event_active(events, now):
|
||||||
if is_working_time:
|
if is_working_time:
|
||||||
update_display(color=COLOR_RED, text="Meeting in Progress")
|
update_display(color=COLOR_RED, text="Meeting in Progress")
|
||||||
|
|||||||
Reference in New Issue
Block a user