Skip to content
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

Add direct interface from lua to output-stream #134

Open
wimalopaan opened this issue May 31, 2021 · 5 comments
Open

Add direct interface from lua to output-stream #134

wimalopaan opened this issue May 31, 2021 · 5 comments
Labels
enhancement ✨ New feature or request lua-api Lua API related

Comments

@wimalopaan
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Add a possibility to write directly to the output-buffer, that transferred via RF pakets. Also add a transactional / double buffered semantic, so that ist possible to prepare some data e.g. in different output channel values via non-atomar lua writes.

Describe the solution you'd like

Could imagine a interface like:

  • lua.prepareBuffer(index1, index2, ...) (begin transaction) (index1, ...: the channels, that should be overwritten)
  • lua.setBufferValue(index, value)
  • lua.sendBuffer() (end transaction)
  • lua.releaseBuffer(...) dismiss the overwrite of channel values

This could be useful to transfer values that do not fit into a single channel value, but could be transfered in multiple channels. This needs an atomar possibility to set the values.

@raphaelcoeffic
Copy link
Member

raphaelcoeffic commented May 31, 2021

transferred via RF pakets

What do you mean exactly here? Do you mean to access the serial connection which leads to the module? EdgeTX does not send any RF packets itself. It would help a bit if you could describe an example use-case.

@wimalopaan
Copy link
Contributor Author

I mean the sbus-like data-stream that is send to the RF-module.

imagine a widget that codes the state of several "virtual switches" (of a menu coded as lua widget) into the value of a channel. Due to the rounding in several places from mix to the RX-output one can use only 9-bits of the 11-bits in the values. This is a shortcoming for modelists that build ship-models or other kind of models that needs a lot of switches to turn on small motors, LEDs, sound effects and so on.
One possibility to extend the usable 9-bits (6-bits for the function (64) and 2-bits for the function state and 1-bit for config/control-messages) to more ist to combine two channels.
But if one uses two lua.setValue() calls it is not guaranteed that the two calls are made atomic. This leads to problems since the RX may then get and output one new channel-value and one old channel-value.

I know that this is very specific to this use-case but most RF-protocols miss the possibility to transport "virtual switch" states. The only one I am aware of is SumDV3 / Hott. Additionaly the interface to the multi-module lacks this feature.

@raphaelcoeffic
Copy link
Member

I see now, so basically a way to set channel values directly without any interaction from the mixer, right? This should be possible, and fits with the idea of using a new LUA touch api for exactly this: virtual buttons and knobs. Could be interesting for everyone.

@wimalopaan
Copy link
Contributor Author

Is there any info about the api for lua virtual buttons and knobs?

@raphaelcoeffic
Copy link
Member

Is there any info about the api for lua virtual buttons and knobs?

Yes, it’s “to be defined” :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request lua-api Lua API related
Projects
None yet
Development

No branches or pull requests

3 participants