def connect_wifi(): if wifi.status(): return True rgb.clear() data, size, frames = animation_connecting_wifi rgb.framerate(3) rgb.gif(data, (12, 0), size, frames) wifi.connect() wifi.wait() if not wifi.status(): data, frames = icon_no_wifi rgb.gif(data, (12, 0), (8, 8), frames) time.sleep(3) rgb.clear() rgb.framerate(20) return wifi.status()
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))
if system.__current_app__ == 'uinstaller': to_install = machine.nvs_getstr('uinstaller', 'to_install') machine.nvs_setstr('uinstaller', 'to_install', '') print('Installing %s' % to_install) if not to_install: system.reboot() ### For some reason normal uinterface.connect_wifi() doesn't ### work from dashboard.terminal.installer, so we have to do this ### odd workaround of connecting twice. wifi.connect() rgb.clear() data, size, frames = animation_connecting_wifi rgb.framerate(3) rgb.gif(data, (12, 0), size, frames) del data, size, frames, animation_connecting_wifi gc.collect() wifi.wait() wifi.connect() wifi.wait() if not wifi.status(): data, frames = icon_no_wifi rgb.gif(data, (12, 0), (8, 8), frames) time.sleep(3) system.reboot() ### rgb.clear()
import time, ntp, rgb, wifi, buttons, defines, system, machine from default_icons import animation_connecting_wifi, icon_no_wifi direction = 0 if not ntp.local_time_available(): if not wifi.status(): data, size, frames = animation_connecting_wifi rgb.clear() rgb.framerate(3) rgb.gif(data, (12, 0), size, frames) wifi.connect() if wifi.wait(): rgb.clear() rgb.framerate(20) else: print('No wifi') rgb.clear() rgb.framerate(20) data, frames = icon_no_wifi rgb.image(data, (12, 0), (8, 8)) time.sleep(3) rgb.clear() print("Error connecting to wifi") system.reboot() if not ntp.set_NTP_time(): print("Error setting time") system.reboot() wifi.disconnect()
def loading_text(text): data, size, frames = animation_loading rgb.gif(data, (1, 1), size, frames) rgb.scrolltext(text, pos=(8, 0), width=(rgb.PANEL_WIDTH - 8))
import machine, system, term_menu, virtualtimers, tasks.powermanagement as pm, buttons, defines, woezel import rgb saplings = [0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x51feb2ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x51feb2ff, 0x000000ff, 0x000000ff] def input_left(pressed): pm.feed() if pressed: rgb.setbrightness(rgb.getbrightness() - 2) def input_right(pressed): pm.feed() if pressed: rgb.setbrightness(rgb.getbrightness() + 2) buttons.register(defines.BTN_LEFT, input_left) buttons.register(defines.BTN_RIGHT, input_right) rgb.clear() rgb.framerate(2) rgb.gif(saplings, (0, 0), (32, 8), 3)