Beispiel #1
0
def start(app, status=False):
	import esp
	if status:
		import term
		if app == "" or app == "launcher":
			term.header(True, "Loading menu...")
		else:
			term.header(True, "Loading application "+app+"...")
	esp.rtcmem_write_string(app)
	reboot()
Beispiel #2
0
def start_app(pushed):
    if (pushed):
        ugfx.clear(ugfx.BLACK)
        ugfx.string(40, 25, "Running:", "Roboto_BlackItalic24", ugfx.WHITE)
        ugfx.string(100, 75, packages[options.selected_index()]["name"],
                    "PermanentMarker22", ugfx.WHITE)
        ugfx.flush()
        selected = packages[options.selected_index()]["slug"]
        esp.rtcmem_write_string(selected)
        badge.eink_busy_wait()
        esp.start_sleeping(1)
Beispiel #3
0
def run_it(pushed):
    if (pushed):
        selected = options.selected_text()
        options.destroy()

        ugfx.clear(ugfx.BLACK)
        ugfx.string(40, 25, "Running:", "Roboto_BlackItalic24", ugfx.WHITE)
        ugfx.string(100, 75, selected, "PermanentMarker22", ugfx.WHITE)
        ugfx.flush()
        badge.eink_busy_wait()
        esp.rtcmem_write_string(selected)
        esp.start_sleeping(1)
Beispiel #4
0
def start_app(app, display=True):
    if display:
        ugfx.clear(ugfx.WHITE)
        ugfx.string(0, 0, "Loading...", "PermanentMarker22", ugfx.BLACK)
        if app:
            ugfx.string(0, 25, "Starting " + app + "...", "Roboto_Regular12",
                        ugfx.BLACK)
        else:
            ugfx.string(0, 25, "Returning to homescreen...",
                        "Roboto_Regular12", ugfx.BLACK)
        ugfx.flush(ugfx.LUT_FASTER)
    esp.rtcmem_write_string(app)
    deepsleep.reboot()
Beispiel #5
0
def start(app, status=False):
    import esp
    if status:
        import term, easydraw
        if app == "" or app == "launcher":
            term.header(True, "Loading menu...")
            easydraw.messageCentered("PLEASE WAIT\nStarting the menu...", True,
                                     "/media/busy.png")
        else:
            term.header(True, "Loading application " + app + "...")
            easydraw.messageCentered("PLEASE WAIT\nStarting '" + app + "'...",
                                     True, "/media/busy.png")
    esp.rtcmem_write_string(app)
    reboot()
Beispiel #6
0
def start_launcher(pushed):
    global splashTimer
    if (pushed):
        splashTimer.deinit()

        #By importing it...
        #import launcher

        #Or by sleeping...
        ugfx.clear(ugfx.WHITE)
        ugfx.string(0, 0, "Starting launcher...", "Roboto_Regular12",
                    ugfx.BLACK)
        ugfx.flush()
        import time
        time.sleep(0.5)
        import esp
        esp.rtcmem_write_string("launcher")
        esp.start_sleeping(1)
Beispiel #7
0
 def back_button_default_action(pressed):
     if pressed:
         esp.rtcmem_write_string("")
         machine.deepsleep(1)
Beispiel #8
0
time.settimezone(timezone)

if badge.safe_mode():
    splash = 'splash'
else:
    splash = badge.nvs_get_str('boot', 'splash', 'splash')

if machine.reset_cause() != machine.DEEPSLEEP_RESET:
    print('[BOOT] Cold boot')
else:
    print("[BOOT] Wake from sleep")
    load_me = esp.rtcmem_read_string()
    if load_me:
        splash = load_me
        print("starting %s" % load_me)
        esp.rtcmem_write_string("")

try:
    if not splash == "shell":
        if splash.startswith('bpp '):
            splash = splash[4:len(splash)]
            badge.mount_bpp()
        elif splash.startswith('remfs '):
            splash = splash[6:len(splash)]
            badge.mount_remfs()
        elif splash.startswith('sdcard '):
            splash = splash[7:len(splash)]
            badge.mount_sdcard()

        def back_button_default_action(pressed):
            if pressed:
Beispiel #9
0
def start_app(app, display = True):
	if display:
		easydraw.msg(app, "Loading...", True)
		term.header(True, "Loading application "+app+"...")
	esp.rtcmem_write_string(app)
	deepsleep.reboot()
    boxes = drawweather(r)

    ugfx.flush()

    try:
        boxes[0].destroy()
        boxes[1].destroy()
    except:
        print("no weather")


def wait_for_network():
    # Handle network connection
    if not wifi.sta_if.isconnected():
        while not wifi.sta_if.isconnected():
            log('Waiting for network')
            utime.sleep(1)
        log('Connected!')


clear_ghosting()
wait_for_network()
draw(makeRequest())
if (esp.rtcmem_read_string(2) != "niall"):
    esp.rtcmem_write_string("0", 0)
    esp.rtcmem_write_string("0", 1)
    esp.rtcmem_write_string("niall", 2)
# 35 mins, seems that works.
deepsleep.start_sleeping(2100 * 1000)