betaflight / betaflight-tx-lua-scripts

Collection of scripts to configure Betaflight from your TX (currently only supported in OpenTx)
GNU General Public License v3.0
590 stars 142 forks source link

Background script halves packet rates #501

Closed bastian2001 closed 3 months ago

bastian2001 commented 6 months ago

Describe your problem

When the Betaflight background script runs on the remote, only half of the RC packets are transmitted.

Reproduction

Run Background script and count the packets. Either how often a new packet arrives (time delta) or via a packet counter. I first noticed this with my own FC, but also using the blackbox I recorded on an off the shelf FC.

Hardware and software

I believe that this information is all that is necessary to reproduce the issue. However, I am referring to this issue I previously posted over at EdgeTX and this issue on ExpressLRS, that were needed to find out that the LUA script was actually the issue.

schugabe commented 6 months ago

This is no bug of the lua script and no expresslrs bug: https://github.com/ExpressLRS/ExpressLRS/issues/2564#issuecomment-1956102287

bastian2001 commented 6 months ago

@schugabe I recommend you read the issue over on ExpressLRS (the one where you commented) in detail, to understand why there is in fact a bug and why it is related to the BF Background Lua. If you disagree, please tell me why simply running the BF Background Lua halves the packet rate, or do the described test yourself.

klutvott123 commented 6 months ago

The BF background script is used for setting the RTC on the FC and for rssi IF there's no other rssi source available. If other sources are available it won't do anything after the RTC has been set. If using ELRS there is already rssi sources available from the RX

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within a week.

bastian2001 commented 5 months ago

The BF background script is used for setting the RTC on the FC and for rssi IF there's no other rssi source available. If other sources are available it won't do anything after the RTC has been set. If using ELRS there is already rssi sources available from the RX

Yeah, but RTC sync does not need to happen during flight, right? How about only transmitting RTC when the script sees the quad connect once, and not continuously sending updates?

klutvott123 commented 4 months ago

@bastian2001 no it doesn't, but to block it during flight we would have to request the arming status from the FC, which is also MSP, which would also halve the packet rate due to ELRS increasing the telemtry rate for MSP frames. The script IS transmitting RTC when the quad is first connected, and it keeps sending RTC until it succeeds, and then it stops. If the background script keeps sending something, it's because it couldn't get the API version, or it couldn't set the RTC, or because there's no other RSSI source than MSP available(but that's unlikely as it's ELRS). Unfortunately we don't have a visual indication for this as it runs as a background script.

github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within a week.

github-actions[bot] commented 3 months ago

Issue closed automatically as inactive.