-
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Virtual events (WiP) #250
Virtual events (WiP) #250
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me so far.
What is the minimum OpenTX release to be able to run this?
And how well supported are the virtual events on the different devices? Are there any devices that will need specific testing?
This needs to run on latest opentx, which is 2.3.1 for now. We will need tests on basically all the targets. There is a test script that @3djc wanted to update to test the virtual events (in case it does not work as expected) and potential issues need to be reported to opentx for fixing the virtual events if necessary. Some targets with the exact same keys and hardware don’t need to be tested separately (ex: T16 / X10, all the X-lites share the same navigation). |
@raphaelcoeffic: We are close to releasing Betaflight 4.1. Normally we do a release of the lua scripts to go with a firmware release. Do you think this is stable enough to be released this or next week? If not we should look into fixing #245 independent of this, and then releasing the scripts for now, and adding this pull request after the release. |
Definitely not ready yet, lot’s of tests required on many targets I don’t own. Fixing the other issue might be just as challenging if we are to break other targets... I really don’t know what can be done best. |
@raphaelcoeffic: I guess in this case is to delay releasing a new version of the lua scripts until we've got the virtual events at a point where we can release them. We can crowdsource the testing to the users in here, and we can add an announcement about this to the release notes for Betaflight 4.1. |
@mikeller I assume so, yes. However, it would be really good to have the "crowdsourced tests" done ASAP ;-) |
That's pretty interesting! I took another approach a few months ago and mapped the inputs by radio-name identifier. But from my testing, it takes some more memory. |
Since this change uses functionality that is brand new in OpenTX this will need to be tested thoroughly on as many supported hardware types as possible.
betaflight-tx-lua-scripts_1.3.0_virtual_events_2.zip
Thank you very much for helping us to improve the scripts! |
@mikeller could you please update your zip file with my latest changes? I believe this should work better. The older version showed to have some flows when testing on the simulator and X9D+. |
@raphaelcoeffic: Done, it's |
An issue here with XLite Pro running v2.3.1 OTX. Joystick events are 90 degrees inverted, e.g.:
Note: enter event works as expected |
@vkolotov is this related to opentx/opentx#6916 ? Please note that the goal here is to have something that offer a consistent user experience with the normal OpenTx menus that work the same. |
I doubt it is related. I've copied over the new scripts and it changed direction. The navigation in the radio controller (not in lua script) remained unchanged when I upgraded it to v2.3.1 OTX. |
I have just reverted the scripts (copied over the backup, the latest release) and it works as expected. So it must be something wrong in the test version (zip archive provided here). |
Is there a reason to still use the events.lua for mapping events if we can just use the virtual events directly in the ui.lua script? |
Tested with QX7S, to me it seems that the wheel is inverted, but I'm not totally sure if it was like this before. |
In fact no, this is going away next. @vkolotov @McGiverGim I use different events now for +/- and prev/next, so that this should now work in the proper direction (same as radio nav). |
Please note that the navigation is still tilted by 90° on T12 and X-lite(s, etc...). This will be fixed in OpenTx and be available in 2.3.2. While testing, you might find that it works slightly differently from before, which should not be an issue, as long as it works. The goal here is really to make supporting different targets simple and automatic, so that new targets are supported automatically, rather than having to be added one by one. |
@raphaelcoeffic now the wheel works as expected. But there is another bug (it was before too), how can I change the page? If I remember correctly, before it was with the "menu" button (the three horizontal lines), but now it does nothing. But if I go out of the Betaflight lua script, the next time I enter in I'm on a new page. |
incValue(1) | ||
elseif event == userEvent.press.minus or event == userEvent.repeatPress.minus or event == userEvent.dial.left then | ||
elseif event == EVT_VIRTUAL_DEC or event == EVT_VIRTUAL_DEC_REPT then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file looks so much cleaner now! 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, a matter of taste as it seems :-) Anyway, that saves a bit of memory by avoiding the userEvent
structure.
src/SCRIPTS/BF/ui.lua
Outdated
menuActive = 1 | ||
currentState = pageStatus.displayMenu | ||
elseif userEvent.press.pageDown and (event == userEvent.longPress.enter) then -- Horus | ||
if (event == EVT_VIRTUAL_ENTER_LONG) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be if (event == EVT_VIRTUAL_MENU_LONG) then
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MENU_LONG cannot be used in telemetry scripts (triggers the “Reset ...” menu).
@McGiverGim I think it should be the "page" key. Have you tried it? "page long" should go back one page, and "page" should lead you to the next page. |
The page key returns to the others telemetry pages, as always did I think. |
Now I understand because each time I go out and in of the Betaflight script I have a different page: the page key, that rolls the telemetry pages, has been assigned to roll too the Betaflight pages. In the X7 this has been always the menu button. |
hmm... I obviously forgot that bit... Then I need to re-instate the menu key ;-) |
True, executing directly the script from the folders explorer, works ok. But I have it in the telemetry page. Is more intuitive to use the page key as you did, but it seems to interfere with Open TX. Maybe it can be disabled until we press Exit? Now I know because it was assigned to the menu key 😋 |
@McGiverGim can you please re-try with my latest change? |
Now it produces an infinite loop, rolling all the pages of the Betaflight script 😮 |
F...! that'S what happens when I don't test it before... sorry for that! |
I can't test it until tomorrow. You don't need to make the same change when long pressing the menu to move page back? |
@raphaelcoeffic that's working a lot better, however... ENTER_LONG triggers the “Reset ...” menu AND the BF popup menu on my X7 :| (unless I've done something wrong...) |
08c73b9
to
faf0976
Compare
src/BF/bf.lua
Outdated
@@ -9,6 +9,8 @@ assert(loadScript(radio.preLoad))() | |||
assert(loadScript(protocol.transport))() | |||
assert(loadScript(SCRIPT_HOME.."/MSP/common.lua"))() | |||
|
|||
isTelemScript = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra vowels don't cost extra. 😁 How about isTelemetryScript
?
- uses the screen resolution to determine the target. - changes menu key mapping based on telemetry script vs standalone script.
faf0976
to
6afc979
Compare
Testes in X9D+, I think it take a long time for saving pages, more slowly that the previous version, can it make more fast?? |
Tested latest version, some things that are different from the "old" script:
I think is important to have a backward key. I understand that the problem is that the page key does not work as expected. Is there a way to tell Open TX to ignore the page key until we get out of the script? |
no, it is actually reserved for changing between telemetry pages. |
This is a first PoC for the virtual events. It has been only tested with T16 on the simulator.The event checks in the UI can probably be simplified once we have something working.
This PR introduces support for virtual events (added to OpenTX 2.3) and implements automatic selection of the target platform (aka radio) based on the screen resolution, this supporting automatically all the radios supported in OpenTX, as long as the screen format is one of those already supported.
Let's make the tests properly. Here is a list of targets that need testing (non-exhaustive):
2.3
branch)Please make sure you have OpenTX 2.3.1 installed and unzip this file at the root of your SD card and report how it works:
betaflight-tx-lua-scripts_1.3.0_virtual_events.zip
Depending on your target, you should test executing the scripts directly from the SD manager and/or as a telemetry script. Both should work properly.