Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
On radios with color display, a color may be added to the flags described above.
There are two types of color constants: one that is an index into a table holding a palette of theme colors, and one that is just a color.
These are the theme colors plus CUSTOM_COLOR, and they can be changed with the function lcd.setColor(color_index, color). Please note: if an indexed color is changed, then it changes everywhere that it is used. For the theme colors, this is not only in other widgets, but everywhere throughout the radio's user interface!
COLOR_THEME_PRIMARY1
COLOR_THEME_PRIMARY2
COLOR_THEME_PRIMARY3
COLOR_THEME_SECONDARY1
COLOR_THEME_SECONDARY2
COLOR_THEME_SECONDARY3
COLOR_THEME_FOCUS
COLOR_THEME_EDIT
COLOR_THEME_ACTIVE
COLOR_THEME_WARNING
COLOR_THEME_DISABLED
CUSTOM_COLOR
These color constants cannot be changed:
BLACK
WHITE
LIGHTWHITE
YELLOW
BLUE
DARKBLUE
GREY
DARKGREY
LIGHTGREY
RED
DARKRED
GREEN
DARKGREEN
LIGHTBROWN
DARKBROWN
BRIGHTGREEN
ORANGE
These should no longer be used, but they are included for backwards compatibility. The old OpenTX API had a large number of indexed theme colors, and these have been mapped to the new theme colors as follows:
ALARM_COLOR -> COLOR_THEME_WARNING
BARGRAPH_BGCOLOR -> COLOR_THEME_SECONDARY3
BARGRAPH1_COLOR -> COLOR_THEME_SECONDARY1
BARGRAPH2_COLOR -> COLOR_THEME_SECONDARY2
CURVE_AXIS_COLOR -> COLOR_THEME_SECONDARY2
CURVE_COLOR -> COLOR_THEME_SECONDARY1
CURVE_CURSOR_COLOR -> COLOR_THEME_WARNING
HEADER_BGCOLOR -> COLOR_THEME_FOCUS
HEADER_COLOR -> COLOR_THEME_SECONDARY1
HEADER_CURRENT_BGCOLOR -> COLOR_THEME_FOCUS
HEADER_ICON_BGCOLOR -> COLOR_THEME_SECONDARY1
LINE_COLOR -> COLOR_THEME_PRIMARY3
MAINVIEW_GRAPHICS_COLOR -> COLOR_THEME_SECONDARY1
MAINVIEW_PANES_COLOR -> COLOR_THEME_PRIMARY2
MENU_TITLE_BGCOLOR -> COLOR_THEME_SECONDARY1
MENU_TITLE_COLOR -> COLOR_THEME_PRIMARY2
MENU_TITLE_DISABLE_COLOR -> COLOR_THEME_PRIMARY3
OVERLAY_COLOR -> COLOR_THEME_PRIMARY1
SCROLLBOX_COLOR -> COLOR_THEME_SECONDARY3
TEXT_BGCOLOR -> COLOR_THEME_SECONDARY3
TEXT_COLOR -> COLOR_THEME_SECONDARY1
TEXT_DISABLE_COLOR -> COLOR_THEME_DISABLED
TEXT_INVERTED_BGCOLOR -> COLOR_THEME_FOCUS
TEXT_INVERTED_COLOR -> COLOR_THEME_PRIMARY2
TITLE_BGCOLOR -> COLOR_THEME_SECONDARY1
TRIM_BGCOLOR -> COLOR_THEME_FOCUS
TRIM_SHADOW_COLOR -> COLOR_THEME_PRIMARY1
WARNING_COLOR -> COLOR_THEME_WARNING
This section describes various constants that are provided for Lua by EdgeTX.
The radio's special characters can be used with the following text constants.
CHAR_RIGHT
CHAR_LEFT
CHAR_UP
CHAR_DOWN
CHAR_DELTA
CHAR_STICK
CHAR_POT
CHAR_SLIDER
CHAR_SWITCH
CHAR_TRIM
CHAR_INPUT
CHAR_FUNCTION
CHAR_CYC
CHAR_TRAINER
CHAR_CHANNEL
CHAR_TELEMETRY
CHAR_LUA
Name | Description |
---|---|
These constants are used with logical switch functions.
Constant name | Logical switch function |
---|---|
For detailed function explanation see Logiacal Switches functions in EdgeTX manual.
LCD_W
width in pixels
LCD_H
height in pixels
LS_FUNC_NONE
-
LS_FUNC_VEQUAL
a = x
LS_FUNC_VALMOSTEQUAL
a ~ x
LS_FUNC_VPOS
a > x
LS_FUNC_VNEG
a < x
LS_FUNC_RANGE
LS_FUNC_APOS
a > |x|
LS_FUNC_ANEG
a < |x|
LS_FUNC_AND
AND
LS_FUNC_OR
OR
LS_FUNC_XOR
XOR
LS_FUNC_EDGE
Edge
LS_FUNC_EQUAL
a = b
LS_FUNC_GREATER
a > b
LS_FUNC_LESS
a < b
LS_FUNC_DIFFEGREATER
∆ ≥ x
LS_FUNC_ADIFFEGREATER
|∆| ≥ x
LS_FUNC_TIMER
Timer
LS_FUNC_STICKY
Sticky
These constants determine the type of a Special Function
FUNC_OVERRIDE_CHANNEL
FUNC_TRAINER
FUNC_INSTANT_TRIM
FUNC_RESET
FUNC_SET_TIMER
FUNC_ADJUST_GVAR
FUNC_VOLUME
FUNC_SET_FAILSAFE
FUNC_RANGECHECK
FUNC_BIND
FUNC_PLAY_SOUND
FUNC_PLAY_TRACK
FUNC_PLAY_VALUE
FUNC_PLAY_SCRIPT
FUNC_RESERVE5
FUNC_BACKGND_MUSIC
FUNC_BACKGND_MUSIC_PAUSE
FUNC_VARIO
FUNC_HAPTIC
FUNC_LOGS
FUNC_BACKLIGHT
FUNC_SCREENSHOT
FUNC_RACING_MODE
FUNC_DISABLE_TOUCH
There are several option types that can be specified in the widget options table, which are exposed to the user via the Widget Settings menu.
Type | Description |
---|---|
Maximum fiveoptions
are allowed.
Note: from 2.11 ten options are allowed per widget.
Option variable name's length must be 10 characters or less and no spaces.
In addition to the key events described in the previous section, radios with a color touch screen also provide touch events to the widget scripts.
The following touch events are passed in the event
argument to the widget script refresh
function (when in full screen mode), just like the key events. The following touch events are provided:
Touch Event Name | Description |
---|---|
In addition to the above touch events a touchState
table is passed to refresh
with the following addional data fields:
touchState fields | Description |
---|---|
touchState
is nil
if event
is not a touch event. This can be used to test if we have a touch event or a key event.
Since Lua evaluates a nil
value to false
and everything else to true
:
if touchState then
we have a touch event.
x, y
are present for all touch events.
startX, startY, slideX, slideY
are only present with EVT_TOUCH_SLIDE
.
swipeUp
/ swipeDown
/ swipeLeft
/ swipeRight
may be present only withEVT_TOUCH_SLIDE
.
tapCount
is zero for anything but EVT_TOUCH_TAP
.
Index | Unit | Defined as |
---|---|---|
Name | Description | EdgeTX ver | Notes |
---|---|---|---|
Name | Description | EdgeTX ver | Notes |
---|---|---|---|
0
normal font, default precision for numeric
2.3
XXLSIZE
jumbo font
2.3
DBLSIZE
double size font
2.3
MIDSIZE
mid sized font
2.3
SMLSIZE
small font
2.3
BOLD
bold font
2.3
Only color displays. This is a font size on its own - cannot be combined with other font size flags.
SHADOWED
shadow font
2.3
Only color displays
INVERS
inverted display
2.3
BLINK
blinking text
2.3
LEFT
left justify
2.3
Default for most functions not related to bitmaps
RIGHT
right justify
2.3
CENTER
center justify
2.3
Only color displays
VCENTER
center vertically
2.5.0
Only color displays
PREC1
single decimal place
2.3
display with one decimal place (number 386 is displayed as 38.6)
PREC2
two decimal places
2.3
display with one decimal place (number 386 is displayed as 3.86)
GREY_DEFAULT
grey fill
2.3
TIMEHOUR
display hours
2.3
Only for lcd/drawTimer
FORCE
pixels will be black
2.3
ERASE
pixels will be white
2.3
SOLID
lines will appear soild
2.3
DOTTED
lines will appear dotted
2.3
COLOR
Displays a color picker, returns a color flag value
BOOL
Displays a toggle/checkbox, value toggles between 0 and 1
STRING
Text input option, limited to 8 characters in 2.10 or earlier, 12 characters in 2.11.
TIMER
Choice option, lets you pick from available timers
SOURCE
Choice option, lets you pick from available sources (i.e. sticks, switches, LS)
SWITCH
Choice option to select from available switches.
VALUE
Numerical input option, can specify default, min and max value
TEXT_SIZE
Choice option, lets you pick from the available text sizes (i.e. small, large)
ALIGNMENT
Choice option, lets you pick from available alignment options (i.e. left, center, right)
SLIDER
Select numerical value using a slider control (available in 2.11)
CHOICE
Select numerical value using a custom popup list (available in 2.11)
FILE
Select a file from SD card / internal storage (available in 2.11). Filename is limited to 12 characters maximum.
EVT_TOUCH_FIRST
When the finger touches down on the screen
EVT_TOUCH_TAP
If the finger leaves the screen after a quick tap
EVT_TOUCH_BREAK
If the finger leaves the screen without tap or slide
EVT_TOUCH_SLIDE
Repeats while the finger is sliding on the screen
x, y
Current touch point
startX, startY
Point where slide started
slideX, SlideY
Movement since previous SLIDE event (or start of slide)
swipeUp / swipeDown / swipeLeft / swipeRight
The field is present and equal to true
if a swipe event occurred in that direction
tapCount
Counts the number of consecutive taps
0
Raw unit (no unit)
UNIT_RAW
1
Volts
UNIT_VOLTS
2
Amps
UNIT_AMPS
3
Milliamps
UNIT_MILLIAMPS
4
Knots
UNIT_KTS
5
Meters per Second
UNIT_METERS_PER_SECOND
6
Feet per Second
UNIT_FEET_PER_SECOND
7
Kilometers per Hour
UNIT_KMH
8
Miles per Hour
UNIT_MPH
9
Meters
UNIT_METERS
10
Feet
UNIT_FEET
11
Degrees Celsius
UNIT_CELSIUS
12
Degrees Fahrenheit
UNIT_FAHRENHEIT
13
Percent
UNIT_PERCENT
14
Milliamp Hour
UNIT_MAH
15
Watts
UNIT_WATTS
16
Milliwatts
UNIT_MILLIWATTS
17
dB
UNIT_DB
18
RPM
UNIT_RPMS
19
G
UNIT_G
20
Degrees
UNIT_DEGREE
21
Radians
UNIT_RADIANS
22
Milliliters
UNIT_MILLILITERS
23
Fluid Ounces
UNIT_FLOZ
24
Ml per minute
UNIT_MILLILITERS_PER_MINUTE
35
Hours
UNIT_HOURS
36
Minutes
UNIT_MINUTES
37
Seconds
UNIT_SECONDS
38
Virtual unit
UNIT_CELLS
39
Virtual unit
UNIT_DATETIME
40
Virtual unit
UNIT_GPS
41
Virtual unit
UNIT_BITFIELD
42
Virtual unit
UNIT_TEXT