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 crsf-telemetry filtered queues #5773

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

wimalopaan
Copy link
Contributor

@wimalopaan wimalopaan commented Jan 10, 2025

This PR tries to implement #5757

It introduces the following new lua functions:

  • crossfireTelemetryCreatePrivateQueue()
  • crossfireTelemetryPopPrivate()
  • crossfireTelemetryRemovePrivateQueue()

and it changes (non-breaking) to interface of

  • create()

of lua widgets.

For lua widgets that use crossfireTelemetryPop() nothing changes.

The create(zone, options) function gets a third parameter create(zone, options, widget_id). The widget_id is a unique widget-identifier, that will be used in the other three new lua functions.

  • crossfireTelemetryCreatePrivateQueue(widget_id, filter_table)

inserts a new filter for the widget with the id widget_id. filter_table can contain up to 8 bytes that are compared against the first 8 bytes (startung with the length byt eof the frame) of an incoming crsf packet. 0 values serve as wild-cards. If a crsf-packet matches it is sorted out into the according private queue.

This function returns error codes:

  • -1 if an equivalent filter already exists,

  • -2 if no more private filter queues are possible (up to 8 filter queues are possible)

  • crossfireTelemetryPopPrivate(widget_id)

extract a crsf message out of the private crsf message queue for widget with widget_id. Return values are the same as for crossfireTelemetryPop().

  • crossfireTelemetryRemovePrivateQueue(widget_id)

removes a private crsf message queue (this also happens automatically if the widget is terminated).

@wimalopaan
Copy link
Contributor Author

Attached is a lua widget to test

crsfqueue.TGZ

@wimalopaan wimalopaan force-pushed the wmcrsffilter branch 3 times, most recently from 8afa2c6 to 2e0483e Compare January 17, 2025 06:30
@pfeerick
Copy link
Member

pfeerick commented Feb 2, 2025

What happened with the reversion of #5788 in the last commit?

Are you happy with how this is working now?

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

Successfully merging this pull request may close these issues.

2 participants