adding back true that got deleted somehow - should probably just sleep instead of fixing stupid errors.

This commit is contained in:
Lucas
2022-03-31 00:26:35 -04:00
parent e2c428003a
commit 53d163198b
+9 -7
View File
@@ -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,13 +27,12 @@ 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
lcd.message = text lcd.message = text
@@ -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")
@@ -50,9 +52,9 @@ def process_events(events):
update_display(color=COLOR_RED, text="Fuck me -_-") update_display(color=COLOR_RED, text="Fuck me -_-")
else: else:
if is_working_time: if is_working_time:
update_display(color=COLOR_BLUE, text="Work time - No event") update_display(color=COLOR_BLUE, text = "Work time - No event")
else: else:
update_display(color=COLOR_GREEN, text="Looks like 420 to me ayooo") update_display(color=COLOR_GREEN, text = "Looks like 420 to me ayooo")
def main(): def main():