Giter Site home page Giter Site logo

Comments (12)

stronnag avatar stronnag commented on August 27, 2024 1

Thanks. Probably thinks it's EdgeTX (where it does work) and using an inappropriate serial API.
Fix soon.

from ltm-lua.

stronnag avatar stronnag commented on August 27, 2024

Too soon. Should not be that, as the serialbaud API is common after 2.3.12. Leave it with me, I may need more info, just don't know what yet.

from ltm-lua.

stronnag avatar stronnag commented on August 27, 2024

I've modified the way the LUA serial baud rate is set; previously if the config file specified 115200, nothing was done because this was the default. In EdgeTX (and possibly in OpenTX), this is no longer a valid assumption.

  • In branch update_set_baud_rate
    • The baud rate is get from the config file unless it is configured as <= 0

Working on EdgeTX 2.7(.1), and seems to be generating messages in companion2.3.15

Can you give the changed files (ltm.lua, LTM/config.lua) from update_set_baud_rate (and in the Zip file) a test?
ltmlua-serial.zip

from ltm-lua.

skaman82 avatar skaman82 commented on August 27, 2024

Unfortunately no luck. If I try to execute the ltm.lua directly I also get an error message saying : "?:0 attempt to call nill value"
EDIT:I am getting the same error message also with the current master version

from ltm-lua.

stronnag avatar stronnag commented on August 27, 2024

Thanks for trying.
I'm not sure you can execute the scripts directly.
Can you see what the default baud is set too, and

  • Set it to the rate you desire
  • Set the lau script config baudrate to 0 (so the script doesn't set it).

Otherwise I'm rapidly running out of ideas. I'd prefer not to have to flash my radio back to OpenTX.

from ltm-lua.

stronnag avatar stronnag commented on August 27, 2024

OK, I relented and flashed my TX16S back to OpenTX

  • 2.3.14: Works perfectly
  • 2.3.15: Also works perfectly

In both cases, valid data displayed in mwp via BT bridge.

UART1 set to LUA, Max Bauds set to 115k, S.baudrate in config.lua also set to 115200.

from ltm-lua.

stronnag avatar stronnag commented on August 27, 2024

By not working do you mean:

  • Nothing is output on the UART; or
  • Something is output, but it's not valid LTM ?
  • Please also confirm the baud rate you have set for the LUA port in OTX?

from ltm-lua.

sashgorokhov avatar sashgorokhov commented on August 27, 2024
  • The problem is in
   elseif fm == "CRS" or fm == "3CRS" or fm == "CRSH" || fm == "CRUZ" then

|| seems confusing lua. I have no idea why it is not working for me, but changing from || to or fixed all issues.

Probably because I'm a very occasional LUA developer.
I you want your "name in lights", please generate a PR, otherwise I'll apply the change.

from ltm-lua.

sashgorokhov avatar sashgorokhov commented on August 27, 2024

screen-2022-07-24-171138
screen-2022-07-24-171152
screen-2022-07-24-171159
screen-2022-07-24-171132

from ltm-lua.

stronnag avatar stronnag commented on August 27, 2024

Apologies, I broke your comment above.
Anyway, please either generate a PR (or I'll make one).

from ltm-lua.

stronnag avatar stronnag commented on August 27, 2024

And apropos the loadScript syntax.

  • The 2nd, 3rd parameters are optional
  • The second set of (params...) provides parameters to the loaded script. It's pretty common usage.
  • The second return parameter is not much help, if the scripts fail to load or parse, we cannot continue anyhow.

from ltm-lua.

stronnag avatar stronnag commented on August 27, 2024

For posterity, here's the comment I erroneously broke, that demonstrates (last line) that the script works with CRSF.

Hey @stronnag!
This script is not working for me too on a freshly flashed 2.3.15 on radiomaster tx16s. (and was not working on 2.3.14)

I uploaded scripts with your instructions
Enabled logging inside config file (S.LOGGER = true)
Added lua script into global functions with ON trigger
Set serial 2 as LUA in system settings
Script is not working (literally) because:

I dont see any log file created in LOGS/ but your code should've created it
Connecting USB-TTL to serial 2 and serial monitor feed is empty. (if i change serial 2 output to telem mirror i can see characters flowing).
For some reason script just fails to start. If I execute it directly, it says ?:0 attempt to call nill value. Executing csrf.lua errors ``then expected near '|' at line 79.

Any thoughts why this particular lua script fails to run?

UPD:

I've added debug points, removed reading config.lua (pasted contents straight into ltm.lua). The way you use loadScript function is kinda strange and does not align what opentx docs say about this function. It returns tuple func, err but you are using loadScript()(). I am not a lua expert but this seems weird. So as i said i've added debug prints and this script fails at the moment it tries to load csrf.lua script.
The problem is in
elseif fm == "CRS" or fm == "3CRS" or fm == "CRSH" || fm == "CRUZ" then
|| seems confusing lua. I have no idea why it is not working for me, but changing from || to or fixed all issues.

This is the fix in #9 / v0.0.4

from ltm-lua.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.