Ejemplo n.º 1
0
def woezel_callback(text, error):
    global category_stats
    rgb.clear()
    rgb.framerate(20)
    rgb.setfont(rgb.FONT_7x5)
    print(text)

    if 'Connecting to WiFi' in text:
        data, size, frames = animation_connecting_wifi
        rgb.framerate(3)
        rgb.gif(data, (12, 0), size, frames)
    elif 'Failed to connect to WiFi' in text:
        data, frames = icon_no_wifi
        rgb.gif(data, (12, 0), (8, 8), frames)
        time.sleep(3)
        system.reboot()
    elif 'Downloading categories...' in text:
        data, size, frames = animation_loading
        rgb.gif(data, (1, 1), size, frames)
        rgb.scrolltext('Loading', pos=(8, 0), width=(rgb.PANEL_WIDTH - 8))
    elif 'Installing' in text:
        data, size, frames = animation_loading
        rgb.gif(data, (1, 1), size, frames)
        rgb.scrolltext(text, pos=(8, 0), width=(rgb.PANEL_WIDTH - 8))
    elif "Downloading '" in text:
        cur, total = text.split('(')[1].split(')')[0].split(
            '/')  # Definitely not proud of this
        progress = '(%s/%s)' % (cur, total)
        data, size, frames = animation_loading
        rgb.gif(data, (1, 1), size, frames)
        rgb.setfont(rgb.FONT_6x3)
        rgb.text(progress, pos=(8, 1))
    elif 'Done!' in text or 'Failed!' in text:
        pass
def woezel_callback(text, error):
    global category_stats
    rgb.clear()
    rgb.framerate(20)
    rgb.setfont(rgb.FONT_7x5)
    print(text)

    if 'Connecting to WiFi' in text:
        data, size, frames = animation_connecting_wifi
        rgb.framerate(3)
        rgb.gif(data, (12, 0), size, frames)
    elif 'Failed to connect to WiFi' in text:
        data, frames = icon_no_wifi
        rgb.gif(data, (12, 0), (8, 8), frames)
        time.sleep(3)
        system.reboot()
    elif 'Done!' in text or 'Failed!' in text:
        return
    else:
        data, size, frames = animation_loading
        rgb.gif(data, (1, 1), size, frames)
        rgb.scrolltext(text, pos=(8, 0), width=(rgb.PANEL_WIDTH - 8))
def prompt_message(message):
        rgb.clear()
        rgb.framerate(20)
        rgb.setfont(rgb.FONT_7x5)
        uinterface.skippabletext(message)
Ejemplo n.º 4
0
from time import sleep

rgb.background((0, 0, 0))
rgb.clear()
rgb.framerate(20)

WEATHER_API_SERVER = 'https://api.openweathermap.org/data/2.5/weather?id=2745726&mode=json&units=metric&appid=100135c6eb0eeba9bde50e165d4021c1'

action = 0
weather = None
last_update = 0
tick = 0

REFRESH_RATE = 31

rgb.setfont(0)


def disconnect_wifi():
    if wifi.status():
        wifi.disconnect()
        rgb.pixel((255, 0, 0), (31, 0))  # red for no wifi


def connect_wifi():
    rgb.pixel((255, 255, 0), (31, 0))  # yellow connecting to wifi
    if not wifi.status():
        wifi.connect()
        if wifi.wait():
            rgb.pixel((0, 255, 0), (31, 0))  # green for wifi
            rgb.framerate(20)
def _initialize_display():
    rgb.clear()
    rgb.setfont(_FONT)
    rgb.framerate(_MAIN_FRAMERATE)
def _initialize_display():
    rgb.clear()
    rgb.framerate(20)
    rgb.setfont(FONT)
Ejemplo n.º 7
0
counter = 0
daysindex = 0
for day in days:
    if day['doy'] == today:
        daysindex = counter
    counter += 1

eventtype = ['Compo', 'Activity']

while True:
    menu = []
    rgb.clear()
    # if not daysindex in days or 'date' not in days[daysindex]:
    #     system.start('activities')
    rgb.text(days[daysindex]['date'], (0, 255, 255), (6, 1))
    rgb.setfont(rgb.FONT_6x3)
    utime.sleep(0.5)
    for event in days[daysindex]['events']:
        time_utc = int(event['time'])
        time_local = time_utc + 60 * 60 * 2
        hour = str(utime.localtime(time_local)[3])
        minute = str(utime.localtime(time_local)[4])
        if len(minute) != 2:
            minute = '0' + minute

        menu.append(hour + ':' + minute + ' ' + event['name'])
    eventindex = uinterface.menu(menu, 0, call_left, call_right)
    print(eventindex)
    if eventindex != None:
        event = days[daysindex]['events'][eventindex]
        eventtext = 'Type: ' + eventtype[int(event['type'])]