Skip to content

Template of App

Notice

  • The corresponding code for third-party developed apps should be stored in the '/apps' directory
  • When the device is booted up and initialized, it will search for files or directories that meet the App definition in the '/apps' directory
  • When it meets the App definition, it will be displayed on the menu page
  • When entering the app (on_start), at least one LVGL widgets needs to be created and loaded, otherwise the device will reboot.

Each app can be modified according to the current template and uploaded to Vobot Mini Dock Tiny, the following code is the minimum template for an app.

import lvgl as lv

# App Name
NAME = "Hello World"

# LVGL widgets
scr = None

async def on_stop():
    # User triggered to leave this App. This App is no longer visible. all function should be deactivated
    # This App becomes STOPPED state
    global scr
    print('on stop')
    if scr:
        scr.clean()
        scr = None


async def on_start():
    # User triggered to enter this App for the first time, or from STOPPED state, all function should be initialed
    # Then, this App becomes STARTED state
    global scr
    print('on start')
    # Create the LVGL widgets.
    scr = lv.obj()
    # Load the LVGL widgets.
    lv.scr_load(scr)