Screen

Screens are independent from adapters, and use their global functions to get the data they need.

To get an idea which functions you can call, take a look at the global functions prefixed with pix_ in the example adapter.

Use this template below to create a new screen. Screen scripts are stored in /SCRIPTS/TELEMETRY/ on the SD card and prefixed with Pix.

Make sure the name of the script is not longer than 7 characters, else openTx will not recognize it!

--[[

My Example PixPilot Screen

]]--

local function init()
    return
end

local function background()
    return
end

local function run(key_event)
    background()

    lcd.clear()

    --[[
    Make absolutely sure to include this part! This will check if
    a adapter is running, and if not will points users to this
    documentation.
    ]]--

    if pix_adapter_running == nil or pix_adapter_running == false then
        lcd.drawText (0, 1,  "PixPilot has not been set up correctly!", SMLSIZE)
        lcd.drawText (0, 9,  "Please refer to the documentation at", SMLSIZE)
        lcd.drawText (0, 17, "https://goo.gl/4ylfQh", SMLSIZE)
        lcd.drawText (0, 25, "to install the correct mixer script", SMLSIZE)
        lcd.drawText (0, 33, "for your specific platform.", SMLSIZE)
        return
    end

    --[[
    Now go ahead and make your own screen logic here.
    Use the global functions exposed in the adapters to 
    display data :)
    Take a look at the example script (https://thedevleon.gitbooks.io/pixpilot/content/adapter.html) 
    to see what functions you can call.
    ]]--

end

return { run=run, background=background, init=init}