
X20/X20S and Ethos v1.2.10 User Manual
Avoid using too much ram for bit maps. It is suggested the users use lazy loading = load a
bitmap ONLY when needed. Then keep it in memory for the next use, to avoid multiple reads
from the SD card.
Basic Layout of a Lua Widget
A custom Lua widget has the following basic structure:
key (string)
The widget must have a unique key.
name (string or function)
The widget name can simply be a string, or the result of a function. For example, the name
can be in a different language depending on locale.
create (function)
The create handler function is called on widget creation. It will return the widget which is
then later passed to all functions.
configure (function)
The configure handler function is called on widget configuration.
wakeup (function)
The wakeup handler function called at each loop, i.e. every 50ms.
The wakeup() should check if anything has changed. If yes, a refresh is needed so the
invalidateWindow() function should be called. This will cause the paint() function to be
called.
event (function)
The event handler function called when an event is received. ETHOS provides the ability to
catch any event in a widget, through this event function.
paint (function)
The paint function ‘draws’ the widget. It should also be called when a refresh is needed.
read (function)
Optional read handler. In ETHOS it is possible to use the storage as the user wishes.
write (function)
Optional write handler. In ETHOS it is possible to use the storage as the user wishes.
Lua scripts are stored in the scripts/ folder on the SD card.
Please refer to the rcgroups ‘FrSky ETHOS Lua Script Programming’ thread for more
information.
163
rev 3
Содержание TANDEM X20
Страница 1: ...X20 and Ethos User Manual...