Skip to content

BF Lua 1.4: long press decrement key does not make values run down, it just decrements by 1 #273

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

Closed
RipperDrone opened this issue Oct 25, 2019 · 13 comments

Comments

@RipperDrone
Copy link
Contributor

BF 4.1. / lua 1.4 / openTX 2.3.1 / lua script running on telemetry page / Taranis X9D 2013:

  • when long pressing '+' button, any edit value (PID, GPS rescue, ...) increases continuously until button is released or max of allowable range is reached.
  • when pressing '-' button, it just decrements by one and then stops. Long press does not seem to work, you have to single press multiple times.

Pbly a matter of virtual events not being propagated correctly to OTX for GPS rescue page lua fields?

@RipperDrone RipperDrone changed the title BF lua 1.4: long press decrement key does not make values run down, it just decrements by 1 BF Lua 1.4: long press decrement key does not make values run down, it just decrements by 1 Oct 25, 2019
@RipperDrone
Copy link
Contributor Author

RipperDrone commented Oct 25, 2019

Hardware OmniNXT F7, Crossfire Nano/Micro combo, telemetry over CRSF

@frozenskys
Copy link
Contributor

I think it's this in the lua scripts:

-- editing value
elseif currentState == pageStatus.editing then
    if event == EVT_VIRTUAL_EXIT or event == EVT_VIRTUAL_ENTER then
        currentState = pageStatus.display
    elseif event == EVT_VIRTUAL_INC or event == EVT_VIRTUAL_INC_REPT then
        incValue(1)
    elseif event == EVT_VIRTUAL_DEC or event == EVT_VIRTUAL_DEC_REPT then
        incValue(-1)
        killEvents(event)
    end
end

@raphaelcoeffic any idea why there is a killEvents here?

@RipperDrone
Copy link
Contributor Author

@frozenskys darn, which file is it in? I searched for EVT_VIRTUAL_DEC_RPT but could only find a symmetrical code snippet.

I think there has been problems of ''double key press' events being generated uncommanded. Pbly this is a leftover of this after it has been fixed by other means / in OTX meanwhile?

@frozenskys
Copy link
Contributor

Could be left from before the change to virtual events - this is in the SCRIPTS\BF\ui.lua file - I'll need to check the history when I get back from work - I'm limited to what I can do with code right now in the office... Also I checked latest master so not sure if it's in 1.4.x

@raphaelcoeffic
Copy link
Member

Yeah, looks like a left over to me as well. Or maybe on some platform it needs to not generate another key press... hard to remember what I did. Could you please try to check with “git blame” where this is coming from?

@frozenskys
Copy link
Contributor

@raphaelcoeffic commit 86860af

@RipperDrone
Copy link
Contributor Author

I deleted the killEvents line, but issue remains. Didn't find another occurence of EVT_VIRTUAL_DEC_REPT in the ui.lua file...

@frozenskys
Copy link
Contributor

Unfortunately I only have an X7 which doesn't generate the EVT_VIRTUAL_DEC_REPT event 😢 and I haven't worked out how to get the telemetry working with the OTX simulator to test this on a simulated X9

@RipperDrone
Copy link
Contributor Author

Tried again by installing 1.4.1 release, then deleting this line from it --> worked!

Seems I had pulled from master before, and for some reason this didn't.

@raphaelcoeffic so this line needs to go, and there are no side effects to be expected?

@frozenskys
Copy link
Contributor

Looks like this was a fix for an issue pre virtual events - see #245 and #251
so I'd assume it's no longer needed.

@RipperDrone
Copy link
Contributor Author

PR created.

@raphaelcoeffic
Copy link
Member

@RipperDrone @frozenskys Does it work properly on X9D+ without this line?

@RipperDrone
Copy link
Contributor Author

RipperDrone commented Oct 26, 2019

For me it does - yep. (OTX 2.3.1, Lua 1.4.1 without this line, Taranis X9D+ 2013, BF4.1 Release)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants