betaflight-tx-lua-scripts icon indicating copy to clipboard operation
betaflight-tx-lua-scripts copied to clipboard

Changing VTX settings from script causes issues with VTX Table

Open AndreaPro opened this issue 1 year ago • 57 comments

I am using Betaflight Lua Scripts 1.7.0 (I've even tried the nightly), Betaflight Configurator 10.9.0, Radiomaster TX16S with EdgeTX 2.8.5 and a BetaFPV Meteor 75 Pro updated to BF 4.4.2 and I am using ELRS 3.3.0 on BetaFPV Micro 1W TX and on the quad. If I open the lua script and I adjust some settings in the VTX section and save them and I power off the quad and connect it to Betaflight configurator the VTX table is wiped completely and the settings are not stored. I've tried generating the lua script VTX table from the configurator and retrieving them from the quad but the result is the same. Pratically the VTX section of the script is unusable because after restart the VTX table is completely wiped.

AndreaPro avatar Sep 01 '23 20:09 AndreaPro

Duplicate of https://github.com/betaflight/betaflight-tx-lua-scripts/issues/482

haslinghuis avatar Sep 01 '23 20:09 haslinghuis

Duplicate of #482

In my opinion it's not a duplicate, it is a different issue. I have compiled the firmware with VTX and OSD already. If it can be of any help the VTX is a BetaFPV M03 with SmartAudio

AndreaPro avatar Sep 01 '23 20:09 AndreaPro

Does this happen when making the same changes in the betaflight configurator?

klutvott123 avatar Sep 01 '23 20:09 klutvott123

No, it happens only when making changes to VTX parameters using the lua script from the radio. I've tried changing accelerometer trims and PID profiles without issues

AndreaPro avatar Sep 01 '23 21:09 AndreaPro

can you try downloading the vtx tables again? https://github.com/betaflight/betaflight-tx-lua-scripts#setting-up-vtx-tables

klutvott123 avatar Sep 01 '23 21:09 klutvott123

Yes, I've tried multiple times both downloading them from the script on the radio and even generating the lua script from the configurator and copied it manually on the radio but the outcome is the same, as soon as I do one change the VTX table is altered and becomes unusable

AndreaPro avatar Sep 01 '23 21:09 AndreaPro

That's strange. I'll have to see if I can reproduce

klutvott123 avatar Sep 01 '23 21:09 klutvott123

If there's something that I can do to troubleshoot the issue just let me know

AndreaPro avatar Sep 01 '23 21:09 AndreaPro

Is it the setting of a specific parameter that causes the issue? Could you try 4.4.1 and maybe 4.4.0?

klutvott123 avatar Sep 01 '23 21:09 klutvott123

It happened when changing VTX power. I can try to go back to these versions and let you know

AndreaPro avatar Sep 01 '23 21:09 AndreaPro

I have downgraded to BF 4.4.0 that was the previous release available for my board, and it happens the same. I've noticed one thing, that if I copy the VTX table lua script generated by Betaflight inside the script it works until I change a parameter, but if I download the VTX table from the quad it downloads a different VTX table that is the wiped one that I found inside the configurator. Attached there is the Lua script generated by Betaflight configurator and the lua script that is created inside the radio if I download the VTX table. And there is the VTX table json saved before and after the issue.

VTX Tables.zip

AndreaPro avatar Sep 01 '23 22:09 AndreaPro

Seems like the lua scripts end up with the "empty" vtx table after downloading? We'll have to figure out why that happens then. I just tested this with a betafpv meteor65 board with 4.4.2, and I'm not able to reproduce. Vtx table is correctly downloaded, and I can change all parameters.

klutvott123 avatar Sep 02 '23 19:09 klutvott123

@AndreaPro Can you share a diff please?

klutvott123 avatar Sep 02 '23 20:09 klutvott123

@AndreaPro Can you share a diff please?

For sure! I have tried both with the stock CLI provided by BetaFPV and with my custom settings but I have the same issue.

Do you have stock settings for your VTX table? Because the CLI on the BetaFPV website for the Meteor 65 appears to have the same VTX table as mine

CLI.zip

AndreaPro avatar Sep 03 '23 00:09 AndreaPro

Got the same issue if I download the vtx table or copy the lua script from betaflight to my controller, it overwrites my vtx table.

tomekste5 avatar Sep 11 '23 17:09 tomekste5

Got the same issue if I download the vtx table or copy the lua script from betaflight to my controller, it overwrites my vtx table.

Could you please share more infos about radio firmware version, Betaflight version, script version, drone model, etc...?

AndreaPro avatar Sep 11 '23 17:09 AndreaPro

Oh ye sure sry, Betaflight version: 4.3 Edge TX version: 2.8.0 (Radiomaster Boxer) Betaflight lua script version: 1.7 Flight controller: Speedybee F405 VTX: TBS Unify Pro32 (https://www.team-blacksheep.com/vtx-table-for-betaflight.txt) (unlocked)

After I try to switch a setting, my VTX table on the flight controller gets overwritten to the same table u shared

tomekste5 avatar Sep 11 '23 18:09 tomekste5

The only thing I can think of is that the payload somehow contains more bytes than it should, and this happens: https://github.com/betaflight/betaflight/blob/99be07729963e4b5e5cb540555450bda28bd2781/src/main/msp/msp.c#L3380-L3407

It's strange because in the BF lua scripts we're only sending four bytes back to the FC

klutvott123 avatar Sep 12 '23 18:09 klutvott123

@tomekste5 Which RX system are you using?

klutvott123 avatar Sep 12 '23 18:09 klutvott123

I am using Express LRS version 3.3 2.4GHz and as a Receiver I use the Radiomaster RP1

tomekste5 avatar Sep 21 '23 13:09 tomekste5

I am using Express LRS version 3.3 2.4GHz and as a Receiver I use the Radiomaster RP1

So we have in common ELRS 3.30 2.4GHz

AndreaPro avatar Sep 21 '23 16:09 AndreaPro

maybe try disabling vtx administrator in the elrs lua script.

klutvott123 avatar Sep 22 '23 18:09 klutvott123

maybe try disabling vtx administrator in the elrs lua script.

I have tried VTX administrator in elrs lua script because the Betaflight script was destroying the VTX table, but I have never used it before discovering this issue

AndreaPro avatar Sep 22 '23 19:09 AndreaPro

try disabling it by setting "band" to "off". did this happen with earlier versions of elrs? the payload sent back from the betaflight lua scripts is only 4 bytes, but if more bytes are sent the vtx tables could be reset. not sure where those bytes are coming from. needs more investigating.

klutvott123 avatar Sep 22 '23 19:09 klutvott123

try disabling it by setting "band" to "off". did this happen with earlier versions of elrs? the payload sent back from the betaflight lua scripts is only 4 bytes, but if more bytes are sent the vtx tables could be reset. not sure where those bytes are coming from. needs more investigating.

I have tried the Betaflight lua directly starting with ELRS 3.3.0. I will try disabling it but I am sure that the first time that I have noticed this issue I haven't enabled VTX admin yet

AndreaPro avatar Sep 23 '23 07:09 AndreaPro

I have never enabled VTX administrator

maybe try disabling vtx administrator in the elrs lua script.

tomekste5 avatar Sep 23 '23 12:09 tomekste5

If it's not too much hassle, could you guys please try ELRS 3.0? I'm not saying elrs is the issue, but we need to rule things out. As I said, the payload sent from the bf lua scripts is 4 bytes, but it could be that zero padding or something is added somewhere along the way to the FC.

klutvott123 avatar Sep 23 '23 18:09 klutvott123

There is no target for the internal module of the Boxer radio in ExpressLRS v3.0

tomekste5 avatar Sep 28 '23 14:09 tomekste5

If it's not too much hassle, could you guys please try ELRS 3.0? I'm not saying elrs is the issue, but we need to rule things out. As I said, the payload sent from the bf lua scripts is 4 bytes, but it could be that zero padding or something is added somewhere along the way to the FC.

I can try it and let you know

AndreaPro avatar Sep 30 '23 07:09 AndreaPro

Have the same issue with

  • Meteor65, Betaflight 4.42, ELRS 3.3 2.4GHz LBT
  • SpeedyBee F405 Mini BLS 35A 20x20 Stack, Betaflight 4.42, ELRS 3.3 2.4GHz LBT (BetaFPV lite receiver) and TBS Pro 32 Unify nano.

Transmitter

  • FrSky QX7 ACCST with BetaFPV ELRS 2.4GHz 1W module at ELRS 3.3 (150Hz currently due to limits of the X7)

Configuration through betaflight works fine (OSD or Configurator), just activating the LUA script even with vtx tables from betflight configurator switches the vtx channel to another band. After that nothing works and a reboot is required to reset to the old settings.

[EDIT] Tested VTX Admin in the ELRS lua script: that works fine and is able to reset the vtx config to a normal state. Never tried that before, but after this is set in ELRS the betaflight lua vtx script no longer changes the band.

CBockelmann avatar Oct 12 '23 20:10 CBockelmann