Servers by jDrones

SmartAudio for VTX Mateksys 405 WING

Hello All,

This is my first post here and I’m new to the hobby so please excuse and noobness.

I have a Mateksys 405 FC with a VTX with a Smartaudio input. The VTX I have is a pain to change the power / band / channel and I want to be able to do this outside of pressing the tiny button on the VTX and trying to understand the LED’s!

At the moment I’d be happy just to be able to control the power with a 3 point switch on the controller.

From what I can understand I have a few options as this is not supported by Ardupilot out of the box;

  1. Upgrade my FC so I can run LUA scripts and writing something that could control it. (would need to buy a F765)
  2. Build a custom firmware using the smartaudio branch on GitHub. (pain with new releases)
  3. Upgrade my RC receiver so it includes a smart audio link so I can change the settings via my Taranis qx7 (expensive?)

Any I missing something? Does anyone else have any other suggestions.

Thanks,

Craig

Trying to go down the LUA script route but I’m having issues opening the serial port. It seems that the examples say to use the following;

local port = serial:find_serial(0)
if not port then
gcs:send_text(0, “No Scripting Serial Port”)
return
end

However this just causes LUA to not run so I’m assuming the code is dodge.

Anyone know how I can send hex(hexidecimal) to a serial port in LUA?

you will need to run master branch code to use the master examples.

https://firmware.ardupilot.org/Plane/latest/

great thanks I will try that. How do I get the master examples to run in Mission Planner? I have tried downloading the latest beta build but I still get the same issue.

Ctrl + q in the load firmware page or download from the above link and upload with the custom firmware button

I don’t have my FC here at the moment so wanted to use sitl - is that possible to use the lastest Dev firmware in the simulation?

I have managed to get the latest 4.1 build onto a Matek F765-WING.

However, when running the following Lua script, it doesn’t find a serial port. How do I setup a serial port to be a ‘scripting’ serial port?

– find the serial first (0) scripting serial port instance
local port = serial:find_serial(0)

if not port or baud == 0 then
gcs:send_text(0, “No Scripting Serial Port”)
return
end

SERIALx_PROTOCOL = 28:Scripting

1 Like

Great thanks… I’m now trying to write a hexidecimal value to the port. As per the smart audio documentation, a low power command would be;

local SMARTAUDIO_V2_COMMAND_POWER_0 = { 0x05, 0x01, 0x00, 0x6B }
port:write(SMARTAUDIO_V2_COMMAND_POWER_0)

I can’t use this as the variable is a ‘table’. What is the syntax for writing that command to the port:write method?

I think I may have it…

for count = 1, #value do
port:write(value[count])
end

value being the table

This is the example,

I have not done writing myself, but it look like its one byte at a time. So you could do:
port:write(0x05)
port:write(0x01)
port:write(0x00)
port:write(0x6B)

You could write yourself a little helper to take a table and do that for each entry. That would make for a nice example.

If you have a telem connection, you can assign it to scripting rather than mavlink and then use a terminal program, such as the Arduino one, to see what your sending. I think it should also be possible to do that over the USB connection, but I have not tried, (this also means you can’t turn it off unless you have a second MAVLink connection). The H7 boards with dual USB endpoints would be great for this.

By the way we have a Scripting channel over on the AP discord if you want faster but even less well thought through advice.

Servers by jDrones