Lua script for telemetry

openTx has introduced a range of new features, ideas and bling. It is fast becoming the firmware of choice for many users. openTx will run on ALL current hardware platforms, including the gruvin9x and sky9x boards. Work has already started to support the new FrSky X9D radio!
Post Reply
cps
Posts: 5
Joined: Tue Mar 15, 2022 10:52 pm
Country: -

Lua script for telemetry

Post by cps »

Dear experts,

I am a new in the world of RC and OpenTX. I built a custom telemetry sensor with an ATTiny controller (FrSky S.PORT protocol) which successfully transfers data on Battery Voltage, driven distance and actual speed of my RC car to my sender (TX16 Radiomaster).
I see the telemetry values (chosen sensor IDs : 0x5100 0x5101 and 0x5102) in the transmitter telemetry model screen with correct values.
I now want to write a widget to nicely display the values, The widget displays as expected, however, the values are not arriving. (All 0). Obviously I have not understood how to use the getValue(source) lua function. My telemetry sensors have the "names" 5100 5101 and 5102 in the OpenTx telemetry screen (model setup). But these values passed as strings to the function do not work.
I found the page https://downloads.open-tx.org/2.3/relea ... s_x12s.txt with promising entries "telem1" ... "telem60" but how do I know which value corresponds to which sensor (if at all this list contains the strings I am supposed to use)?

In general:
How do I find the correct "source" parameter of the getValue() function for an arbitrary FrSky telemetry sensor sending data back to the transmitter with any 16 bit sensor ID (S.PORT protocol)?

...probably I haven't understood something very fundamental here...

Thanks a lot in advance !

User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Lua script for telemetry

Post by Kilrah »

The number for "telemx" is the slot number on the left.
You might rather want to rename the sensors after their discorvery to something more descriptive and then use those names.
cps
Posts: 5
Joined: Tue Mar 15, 2022 10:52 pm
Country: -

Re: Lua script for telemetry

Post by cps »

Thank you so much Kilrah, works like charm !!!
And thanks to all who contributed to OpenTX. Fantastic project !!!
Attachments
screen-2022-03-16-215255.png
screen-2022-03-16-215255.png (5.7 KiB) Viewed 1398 times

Post Reply

Return to “openTx”