-
Notifications
You must be signed in to change notification settings - Fork 2
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
External module support #2
Comments
Hi, Just updated the script for a large performance improvement (lower CPU usage). Neophyte lua programmer! With the TX16S, if you use the internal module with "Telem Mirror" you get "MPM (MultiProtocol Module) Telemetry" rather than S-Port, which I decided is a protocol too far. Not idea (yet) why it doesn't work with the external module; the OTX lua documentation is somewhat outdated. As with #1 we'll see where this goes. |
Could you please record a short OpenTX SDCard log (i.e. in /LOGS/) of a short flight with GPS telemetry. Including a number of different flight modes (e.g. Acro, PH, RTH, 3CRS, WP); don't need them all, just a few. Either post it here or PM me. That would be a help in deciding on the required telemetry Ids needed. |
Sent you an email..... |
Thanks. As discussed in the PM: The OpenTX "companion" application has a function to replay CSV logs; this will stimulate the LUA APIs and my LTM script. If I replay your log (the simulator does not care whether it's the internal or external module), then the correct LTM is generated by the LUA script. So my conclusion is that the problem is how OpenTX handles the internal / external modules, rather than the ltm.lua script not understanding the telemetry. |
Just as an FYI, I do know that if you use a cross fire module and use telemetry mirror, the output for that is CRSF on the serial port for telemetry mirror. |
I understand it goes something like this.
As I didn't want to deal with multiple raw telemetry protocols, it was easiest for me to transpose the OpenTX unified view of telemetry into LTM. |
that makes sense and it totally makes sense to go the way you do. i guess there's no way to read them from the telemetry screen i guess ? |
Not sure I get the significance the above? The internal OpenTX API |
@stronnag that's what I thought. my thinking was well if you can read them like you can for the telemetry screen i don't see how whether it's an MPM module or external module would make a difference. IE, if you use (lets say) RSSI.getvalue it shouldn't matter what module is generating that number/sensor all you care about is the number so you can put it into an LTM structure. Unless i'm misunderstanding something. NB i'm not a lua programmer :D |
Your understanding is correct. I'm not a Lua programmer either! |
I havent yet got it to work with crossfire yet lol. but it seems to me there shouldn't be any difference between internal or external. Just having a look at the script code it doesn't seem like you're doing anything special. Did you think at looking at how teckel did the inav script ? |
Extensively, Tom Lehrer's "Lobachevsky" is my bible:
Don't think there is any significant difference (between the CRSF bit of LTM-Lua and teckel's script). |
hey... if it good for presidential candidates it's good for us right lol i don't see though where it's sending it out of the serial port. unless i'm missing something. but that's for another issue. |
OK, so you're probably not in Nevada, and there may have more than 0 satellites. It would be useful to also have a OpenTX log matching the LTM. |
no but I have it sitting outside at the minute capturing some logs and i'll send them in a few |
try this. itll probably be the latter half of the csv, |
20210116163106.txt ok here you go... a couple minutes of it sitting on the bench with it armed and in different modes. |
Thanks, I'll have a look in the morning. |
Damn that. let's look now. I replay the LTM; looks like some bloke in suburban Daytona Beach walking around with between 5 - 7 satellites and c. 15.7V on Vbat. A couple of flight mode changes in the mix. Does this mean it's working? Toto, I've a feeling we're not in Nevada anymore ... or something like that. |
hahaha yea that would be correct, but im not getting anything out of the serial port like i said |
and just think i nearly thought about doing an airforce phallic logo LOL |
You're assuming I can keep up .... So the CSV comes of the radio, the LTM is from ? |
The csv is open tx logs the other is from the script with logging on |
As far as the serial port is concerned, opentx uses the port that is set to LUA. The data is written to the port using serialWrite(). OpenTX gives you zero control over the port. You don't even open the port; opentx just uses the LUA port. It may be that there is a limitation / bug in OpenTX that this only works when the internal module is active; it worked just fine last time I tested it with the internal module (and I have no external module). Since then I've updated to 2.3.11, so I'll try that tomorrow. |
Ok. Makes sense, i have uart 1 set to lua and in global functions i have lua/lrm set and its on "ON" so its running all the time while im testing. I dont see where in the script (unless im blind) you are actually opening the serial port unless thats handled by otx on write. The other thing i thought of just glancing through the code on my phone. You are using the d.fm variable to tell whether its crossfire or not. Im assuming that "WAIT" is a value of -1? Or is it a string value (comparing to what you are using in crsf.lua). |
As described in the previous message, there is no API to open the serial port, the port set to "LUA" is used. Anyway, I just get junk from the internal module as well, so something has changed in openTX. I've asked on the RCG forum if anything's changed. There is nothing pertainent in the release note or git log. |
We have a prime suspect ... https://www.rcgroups.com/forums/showpost.php?p=46337621&postcount=4280 |
So much for release notes lol |
related openTX PR opentx/opentx#8228 |
here's some logs for todays 2 flights. both with inav 2.6 and the latest tbs nightly and the latest alpha of the module firmware |
Thanks for the logs. The LUA serial issue is fixed in OpenTX nightly 2.3.12N420, tested with the internal module / UART1 |
@stronnag with the release of the "official" 2.3.12 is there any way to find out if the fix for this got merged (i assume so if it was in the nightlies) but there was no mention of it in the release notes that i could find. just an RSSI thing and a new memory "command" |
I haven't tested the released 2.3.12, but as it was merged into the 2.3 branch for N420, I would be surprised if it somehow got lost again. Looking at the source code, the fix is there. I can test it again over the weekend. Don't expect the RN to have every small tweak. |
ok great... not planning on upgrading the day before I go flying to say the least :D but was planning on doing it next week. if only for the supposed touch support if it's in there :D |
Just tested LUA-ltm over AUX1 on OpenTX 2.3.12 (internal module, as I have no externals). |
Has anyone got this working with an external module? I'm working on an ESP32-based antenna tracker but am running into the problem that the telemetry stream is too much data for the BT connection (I think, I get a lot of I have placed the Lua files in the correct folders and have set up a special function on a switch. What do I need to set Serial port (TTL) in the OpenTX system menu to? I only get data over bluetooth with "Telem Mirror" and the data rate doesn't seem to be affected by the special function switch. With any of the other settings I get nothing. I am using a TX16S on 2.3.15N562 with an external ExpressLRS module. ExpressLRS handles the telemetry a bit differently from Crossfire but once it gets to OpenTX it should be pretty similar. |
You need to set the port to LUA (not telemetry, that will be full speed module format telemetry). I upgraded my TX to Edge, so I can't tell you exactly what the option is on OTX. |
in open tx go into the system menu and then croll to thebottom of the list and set the serial port to "LUA" and then page across to global special functions and put a special function to "ON" and set itt o lua and the script and then turn on the little tick mark. |
i must admit, i need to update my OTX to the latest one, but also, if you're using crossfire, make sure you are on the latest 6.10 release and 2.04 for the wifi else it might not work as there as a bug with 6.09 and below (in the 6.x range) where they had telemetry issues. I ended up having to use telemetry mirror and CRSF to the mfd tracker bt i havent updated to the latest one yet as im in the UK |
Turns out I did make a mistake, I had a 20ms delay in my program. After removing that it seems I can receive the normal CRSF telemetry mirror data. With the serial port set to ' |
not sure... might need to be armed first maybe? i beleive OTTOMH you can turn on a flag for script logging but i could be wrong. |
Not sure what is the problem with the LTM-lua script but the following Lua works with an external ExpressLRS module in my TX16S:
(I know this is hugely inefficient) |
Hi Jonathan
Great little project..... Just experimenting, and seems to work.
I appreciate this is still very experimental, but I can see this is opening up nice possibilities.
I noticed, it does work with internal module (Radiomaster TX16S), but it doesn't give any data when using an R9M external module (which also provides S-port data).
However, if I set the radio Serial port in the system menu from Lua to Telem Mirror (i.e. bypassing the Lua script), I do get raw S-port data from the BT module. But then telem mirror only seems to work with external modules, not the build-in..... But I guess that is OpenTx related, not your Lua script.
I'm pretty sure, that will get resolved in upcoming releases of openTx (currently running 2.3.9)
Thanks a lot !
The text was updated successfully, but these errors were encountered: