Using EVT_PLUS_FIRST in LUA script

openTx has introduced a range of new features, ideas and bling. It is fast becoming the firmware of choice for many users. openTx will run on ALL current hardware platforms, including the gruvin9x and sky9x boards. Work has already started to support the new FrSky X9D radio!
Post Reply
wilopaan
Posts: 155
Joined: Sun Sep 09, 2018 6:09 pm
Country: -

Using EVT_PLUS_FIRST in LUA script

Post by wilopaan »

Hi all,

I like to use EVT_PLUS_FIRST but the value is alway nil. Same with other key event constants.

What am I doing wrong?

Thanks.

User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Using EVT_PLUS_FIRST in LUA script

Post by Kilrah »

In 2.3 you should be using the VIRTUAL events which are mapped acoordingly to the different radios' control schemes.
https://opentx.gitbooks.io/opentx-2-3-l ... vents.html
wilopaan
Posts: 155
Joined: Sun Sep 09, 2018 6:09 pm
Country: -

Re: Using EVT_PLUS_FIRST in LUA script

Post by wilopaan »

Kilrah wrote: Thu Mar 12, 2020 8:48 am In 2.3 you should be using the VIRTUAL events which are mapped acoordingly to the different radios' control schemes.
https://opentx.gitbooks.io/opentx-2-3-l ... vents.html
Ok, thank you.

But I can't find the correct VIRTUAL events for the left/right buttons on the right keypad. They produce the code 100/101 in y jumper T12 simulated TX.
User avatar
3djc
Posts: 77
Joined: Mon Feb 22, 2016 7:15 am
Country: -

Re: Using EVT_PLUS_FIRST in LUA script

Post by 3djc »

For T12

{ "EVT_VIRTUAL_PREV", EVT_KEY_FIRST(KEY_UP) },
{ "EVT_VIRTUAL_PREV_REPT", EVT_KEY_REPT(KEY_UP) },
{ "EVT_VIRTUAL_NEXT", EVT_KEY_FIRST(KEY_DOWN) },
{ "EVT_VIRTUAL_NEXT_REPT", EVT_KEY_REPT(KEY_DOWN) },
{ "EVT_VIRTUAL_DEC", EVT_KEY_FIRST(KEY_DOWN) },
{ "EVT_VIRTUAL_DEC_REPT", EVT_KEY_REPT(KEY_DOWN) },
{ "EVT_VIRTUAL_INC", EVT_KEY_FIRST(KEY_UP) },
{ "EVT_VIRTUAL_INC_REPT", EVT_KEY_REPT(KEY_UP) },
{ "EVT_VIRTUAL_PREV_PAGE", EVT_KEY_LONG(KEY_LEFT) },
{ "EVT_VIRTUAL_NEXT_PAGE", EVT_KEY_BREAK(KEY_LEFT) },
{ "EVT_VIRTUAL_MENU", EVT_KEY_BREAK(KEY_RIGHT) },
{ "EVT_VIRTUAL_MENU_LONG", EVT_KEY_LONG(KEY_RIGHT) },
{ "EVT_VIRTUAL_ENTER", EVT_KEY_BREAK(KEY_ENTER) },
{ "EVT_VIRTUAL_ENTER_LONG", EVT_KEY_LONG(KEY_ENTER) },
{ "EVT_VIRTUAL_EXIT", EVT_KEY_BREAK(KEY_EXIT) },
wilopaan
Posts: 155
Joined: Sun Sep 09, 2018 6:09 pm
Country: -

Re: Using EVT_PLUS_FIRST in LUA script

Post by wilopaan »

3djc wrote: Thu Mar 12, 2020 11:26 am For T12

{ "EVT_VIRTUAL_PREV", EVT_KEY_FIRST(KEY_UP) },
{ "EVT_VIRTUAL_PREV_REPT", EVT_KEY_REPT(KEY_UP) },
{ "EVT_VIRTUAL_NEXT", EVT_KEY_FIRST(KEY_DOWN) },
{ "EVT_VIRTUAL_NEXT_REPT", EVT_KEY_REPT(KEY_DOWN) },
{ "EVT_VIRTUAL_DEC", EVT_KEY_FIRST(KEY_DOWN) },
{ "EVT_VIRTUAL_DEC_REPT", EVT_KEY_REPT(KEY_DOWN) },
{ "EVT_VIRTUAL_INC", EVT_KEY_FIRST(KEY_UP) },
{ "EVT_VIRTUAL_INC_REPT", EVT_KEY_REPT(KEY_UP) },
{ "EVT_VIRTUAL_PREV_PAGE", EVT_KEY_LONG(KEY_LEFT) },
{ "EVT_VIRTUAL_NEXT_PAGE", EVT_KEY_BREAK(KEY_LEFT) },
{ "EVT_VIRTUAL_MENU", EVT_KEY_BREAK(KEY_RIGHT) },
{ "EVT_VIRTUAL_MENU_LONG", EVT_KEY_LONG(KEY_RIGHT) },
{ "EVT_VIRTUAL_ENTER", EVT_KEY_BREAK(KEY_ENTER) },
{ "EVT_VIRTUAL_ENTER_LONG", EVT_KEY_LONG(KEY_ENTER) },
{ "EVT_VIRTUAL_EXIT", EVT_KEY_BREAK(KEY_EXIT) },
Mmh, the generated codes are 100 and 101 for the left/right buttons. But these codes do not correspond to the above values.

Post Reply

Return to “openTx”