1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 00:35:18 +03:00

Improve lua virtual event check script

This commit is contained in:
3djc 2019-10-06 10:03:20 +02:00
parent 7d90497e84
commit 7c30d15088

View file

@ -17,11 +17,13 @@ local toolName = "TNS|LUA event tests|TNE"
---- #########################################################################
local virtual_next = 0
local virtual_previous = 0
local virtual_prev = 0
local virtual_inc = 0
local virtual_dec = 0
local virtual_next_rept = 0
local virtual_previous_rept = 0
local virtual_prev_rept = 0
local virtual_page_next = 0
local virtual_page_previous = 0
local virtual_page_prev = 0
local virtual_enter = 0
local virtual_enter_long = 0
local virtual_menu = 0
@ -37,37 +39,52 @@ local function run(event)
if event == nil then
error("Cannot be run as a model script!")
return 2
elseif event == EVT_VIRTUAL_EXIT then
end
if event == EVT_VIRTUAL_EXIT then
return 2
elseif event == EVT_VIRTUAL_NEXT then
end
if event == EVT_VIRTUAL_NEXT then
virtual_next = virtual_next + 1
elseif event == EVT_VIRTUAL_PREVIOUS then
virtual_previous = virtual_previous + 1
elseif event == EVT_VIRTUAL_NEXT_REPT then
end
if event == EVT_VIRTUAL_PREV then
virtual_prev = virtual_prev + 1
end
if event == EVT_VIRTUAL_INC then
virtual_inc = virtual_inc + 1
end
if event == EVT_VIRTUAL_DEC then
virtual_dec = virtual_dec + 1
end
if event == EVT_VIRTUAL_NEXT_REPT then
virtual_next_rept = virtual_next_rept + 1
elseif event == EVT_VIRTUAL_PREVIOUS_REPT then
virtual_previous_rept = virtual_previous_rept + 1
elseif event == EVT_VIRTUAL_NEXT_PAGE then
end
if event == EVT_VIRTUAL_PREV_REPT then
virtual_prev_rept = virtual_prev_rept + 1
end
if event == EVT_VIRTUAL_NEXT_PAGE then
virtual_page_next = virtual_page_next +1
elseif event == EVT_VIRTUAL_PREVIOUS_PAGE then
virtual_page_previous = virtual_page_previous + 1
elseif event == EVT_VIRTUAL_ENTER then
end
if event == EVT_VIRTUAL_PREV_PAGE then
virtual_page_prev = virtual_page_prev + 1
killEvents(event);
end
if event == EVT_VIRTUAL_ENTER then
virtual_enter = virtual_enter + 1
elseif event == EVT_VIRTUAL_MENU then
end
if event == EVT_VIRTUAL_MENU then
virtual_menu = virtual_menu + 1
end
killEvents(event);
lcd.clear()
lcd.drawScreenTitle("LUA EVENT TEST", 0, 0)
lcd.drawText(1, 10, "NEXT: "..virtual_next)
lcd.drawText(1, 20, "PREVIOUS: "..virtual_previous)
lcd.drawText(1, 40, "NEXT_REPT: "..virtual_next_rept)
lcd.drawText(1, 50, "PREVIOUS_REPT: "..virtual_previous_rept)
lcd.drawText(LCD_W/2, 10, "ENTER: "..virtual_enter)
lcd.drawText(LCD_W/2, 20, "MENU: "..virtual_menu)
lcd.drawText(LCD_W/2, 40, "NEXT_PAGE: "..virtual_page_next)
lcd.drawText(LCD_W/2, 50, "PREVIOUS_PAGE: "..virtual_page_previous)
lcd.drawText(1, 10, "PREV:"..virtual_prev)
lcd.drawText(LCD_W/2, 10, "NEXT: "..virtual_next)
lcd.drawText(1, 20, "DEC:"..virtual_dec)
lcd.drawText(LCD_W/2, 20, "INC:"..virtual_inc)
lcd.drawText(1, 30, "NXT PAGE: "..virtual_page_next)
lcd.drawText(LCD_W/2, 30, "PRV PAGE: "..virtual_page_prev)
lcd.drawText(1, 50, "ENTER: "..virtual_enter)
lcd.drawText(LCD_W/2, 50, "MENU: "..virtual_menu)
return 0
end