1 local toolName
= "TNS|LUA event tests|TNE"
2 ---- #########################################################################
4 ---- # Copyright (C) OpenTX #
6 ---- # License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html #
8 ---- # This program is free software; you can redistribute it and/or modify #
9 ---- # it under the terms of the GNU General Public License version 2 as #
10 ---- # published by the Free Software Foundation. #
12 ---- # This program is distributed in the hope that it will be useful #
13 ---- # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 ---- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 ---- # GNU General Public License for more details. #
17 ---- #########################################################################
19 local virtual_next
= 0
20 local virtual_prev
= 0
23 local virtual_next_rept
= 0
24 local virtual_prev_rept
= 0
25 local virtual_page_next
= 0
26 local virtual_page_prev
= 0
27 local virtual_enter
= 0
28 local virtual_enter_long
= 0
29 local virtual_menu
= 0
30 local virtual_menu_long
= 0
38 local function run(event
)
40 error("Cannot be run as a model script!")
43 if event
== EVT_VIRTUAL_EXIT
then
46 if event
== EVT_VIRTUAL_NEXT
then
47 virtual_next
= virtual_next
+ 1
49 if event
== EVT_VIRTUAL_PREV
then
50 virtual_prev
= virtual_prev
+ 1
52 if event
== EVT_VIRTUAL_INC
then
53 virtual_inc
= virtual_inc
+ 1
55 if event
== EVT_VIRTUAL_DEC
then
56 virtual_dec
= virtual_dec
+ 1
58 if event
== EVT_VIRTUAL_NEXT_REPT
then
59 virtual_next_rept
= virtual_next_rept
+ 1
61 if event
== EVT_VIRTUAL_PREV_REPT
then
62 virtual_prev_rept
= virtual_prev_rept
+ 1
64 if event
== EVT_VIRTUAL_NEXT_PAGE
then
65 virtual_page_next
= virtual_page_next
+1
67 if event
== EVT_VIRTUAL_PREV_PAGE
then
68 virtual_page_prev
= virtual_page_prev
+ 1
71 if event
== EVT_VIRTUAL_ENTER
then
72 virtual_enter
= virtual_enter
+ 1
74 if event
== EVT_VIRTUAL_MENU
then
75 virtual_menu
= virtual_menu
+ 1
79 lcd
.drawScreenTitle("LUA EVENT TEST", 0, 0)
80 lcd
.drawText(1, 10, "PREV:"..virtual_prev
)
81 lcd
.drawText(LCD_W
/2, 10, "NEXT: "..virtual_next
)
82 lcd
.drawText(1, 20, "DEC:"..virtual_dec
)
83 lcd
.drawText(LCD_W
/2, 20, "INC:"..virtual_inc
)
84 lcd
.drawText(1, 30, "NXT PAGE: "..virtual_page_next
)
85 lcd
.drawText(LCD_W
/2, 30, "PRV PAGE: "..virtual_page_prev
)
86 lcd
.drawText(1, 50, "ENTER: "..virtual_enter
)
87 lcd
.drawText(LCD_W
/2, 50, "MENU: "..virtual_menu
)
91 return { init
=init
, run
=run
}