-
Notifications
You must be signed in to change notification settings - Fork 0
2.2 Level II : read & show telemetry
Now, I hope it’s getting really interesting for you.
Building on the very first widget, I want to expand its functionality to display two sensor values instead of static text.
The layout should no longer be "hardcoded" for specific displays.
The final result should look like this:

This introduces a new level of difficulty with topics such as:
- How to read telemetry (or, more generally, "values from a source")
- How to handle different displays/transmitter types
- How to refresh the screen
Each of these points may initially seem trivial, but they are essential for all widgets.
In the past, there were many examples of how easily one can fall into pitfalls with these topics, leading to strange widget behavior or significantly reduced transmitter performance.
I will first address each of these points separately before diving into the "complete widget."
Displaying telemetry values individually is certainly one of the main use cases for Lua widgets.
Here’s a few pages of explanation on the topic.
In general, Ethos Lua doesn’t distinguish whether you want to "query" telemetry sensors, physical switches, analog inputs, trims, logical switches, or anything else.
Lua treats these in an "object-oriented" way as a "source" (the object) with properties (attributes).
- Properties can be names, but also values.
- When querying a telemetry value, two steps are necessary:
- Step 1: Define the source ONCE in the entire script (by assigning it to a variable).
- Step 2: Query the source for its value whenever needed.
Important: Each source should be defined only once throughout the entire runtime!
But what is the correct method?
We remember that possible sources include analog inputs, switches, sensors, etc.
In the guide, you’ll find the corresponding entry under system.
Don’t be confused by the many examples.
The first example is actually quite poor and should never be used that way, as a logical switch of the same name could exist, leading to ambiguity about which source is returned.
Typically, you specify the name-category or "member" pair.
The member indicates where in the category list the source lies.
In the base section, you can get a good overview of the available categories.
- Our desired value, RSSI, is generated by the receiver as a telemetry sensor, and thus belongs to the
CATEGORY_TELEMETRY_SENSORcategory. - The transmitter voltage is "internal" and comes from
CATEGORY_SYSTEM.
Thus, I define the following two sources:
srcValue1 = system.getSource({category=CATEGORY_TELEMETRY_SENSOR, name="RSSI"})
srcValue2 = system.getSource({category=CATEGORY_SYSTEM, member=SYSTEM_MAIN_VOLTAGE})(Example code to follow later in the widget)