lua脚本可以控制ELRS高频头的属性,比如发射功率, 发射频率,数传包的大小等。
lua脚本的详细的解释在官网中有,链接为:Using The Lua Script – ExpressLRS
Using The Lua Script
Now that you have flashed your TX it is time to learn how to use the ELRS lua script!
If you flashed via WiFi or were on a version previous to 2.x you need a different version of the lua than you already installed.
Installing the Lua Script¶
Download the ELRSv2 Lua Script(you can simply right-click, save-as) into your radio’s SD Card under the
Scripts/Tools
folder and Long Press the “SYS” button (for T16 or similar Radios) or the “Menu” button (for Taranis X9D or similar Radios) to access the Tools Menu where you can find the ExpressLRS script ready to run with only one click.Here’s how it looks in the Tools menu (X9D+ and T16 Shown):
Check if your TX is Connected¶
Enter the Lua script by selecting “ExpressLRS” in the Tools menu and pressing ENTER.
If the parameter list does not populate after a few seconds, and it’s stuck at
Loading...
, first verify the ExpressLRS module has power by checking its LED. If there is no LED lit up, it is possible the Protocol set for the External Module is incorrect (should be set to CRSF) or that the module is not properly connected to the pins of the JR bay of the radio. Another possible reason is that you haven’t updated the firmware of the module to version 2.x.If parameters do show up, but the Bad/Good section on the right side of the header is showing an unstable value, have a look at your model settings and make sure the Internal RF module is set to Off. If the Bad/Good indicates something other than
0/<your selected packet rate>
this meansCRSFshot
is not working– verify that you properly followed the Radio Preparation Guide.
The
master 942c40
from the photo above is the git branch and commit hash of the firmware version that the module has. You can reference this hash from Releases. On the first photo above,master
means the module is flashed with theMaster Branch
with the git commit942c40
. If you’re on a Released version or a Release Candidate, this will read something like2.0
or2.0-RC1
plus the commit hash of the release.Colors may differ from Handset to Handset, depending on the current theme in use.
Understanding and Using the Lua Script¶
Now, we can explore the complexities of the lua script, and how to interpret each of its many sections. ExpressLRS supports multiple configuration profiles, and the configuration profile is selected by setting the “Receiver” property in handset Model Setup -> External Module -> Receiver (number).
WARNING
Do not change parameters while ARMED. When a parameter is changed, the module goes into Parameter Commit mode, interrupting the normal loop. This could result on a desync on some hardware combination which would result in a FAILSAFE.
The Header¶
The first line, “Header”, will show you some information about your ExpressLRS link.
The first part will show you the current ExpressLRS TX Module ID, followed by the current status of the link.
The
0/nnn
is your Packet Counter. The second set of numbers should match with your currently selected Packet Rate. e.g. If you’ve set your Packet Rate to 500Hz, the Packet Counter should show 0/500, which means you’re not getting any Bad Packets ( 0 Bad Packets ) and only getting Good Packets ( 500 Good Packets ). Any small fluctuation is normal and often goes back to 100% Good Packets, especially when you change a setting and it’s commited into memory.Should the indicator starts showing Bad Packets, and Good Packets goes down, it isn’t a good situation. Make sure your module is not overheating and it’s still getting good connection with the radio. This is most dangerous when you’re armed and flying several kilometers/miles out, as this could mean a sudden Failsafe.
The
Connection Status
indicator shows your current RC link status. When not connected to any receiver, it will show a dash (-
); while aC
shows up when bound and connected.The
Model Mismatched
message will also show up to indicate your are connected to a receiver, but the model selected in your radio is incorrect. See the Model Match page for more info about Model Matching.Packet Rate and Telemetry Ratio¶
These are shown as
Packet Rate
andTelem Ratio
in the lua script, which allow you to change your performance parameters.
Packet Rate
sets how fast data packets are sent, higher rates send packets more frequently and have lower latency, but have reduced range. The options for Team2.4 are:50, 150, 250 & 500
Hz and the options for Team900 are25, 50, 100 & 200
Hz. The number following the rate in parentheses (e.g. -105dBm for 500Hz) is the Sensitivity Limit for the rate, the lowest RSSI where packets will still be received. See Signal Health for more information about the sensitivity limit.WARNING
NEVER change the packet rate while flying as this FORCES A DISCONNECT between the TX and RX.
Telem Ratio
sets the telemetry ratio, how much of the packet rate is used to send telemetry. The options, in order of increasing telemetry rate, are:Off, 1:128, 1:64, 1:32, 1:16, 1:8, 1:4, 1:2
. A Telem Ratio of 1:64 means one out of every 64 packets are used for telemetry data. For information on telemetry setup, see First Flight: Telemetry and Telemetry Bandwidth.Switch Mode¶
The Switch Mode setting controls how channels AUX1-AUX8 are sent to the receiver (the 4 main channels are always 10-bit). The options are
Hybrid & Wide
. Hybrid mode is 6x ⅔/6-position + 1x 16-position, and Wide is 7x 64 or 128-position. For detail about the differences, see the Switch Configs documentation.Hot Tip
The Switch Mode can only be changed when not connected to a receiver. The top right corner of the lua script will show a
-
if you’re not connected.Model Match¶
Model Match is used to prevent accidentally selecting the wrong model in the handset and flying with an unexpected handset or ELRS configuration. Setting this to
On
while a receiver is connected will make that receiver only connect with the current Receiver ID. Setting it toOff
will allow a connection with any bound receiver (including those using a Bind Phrase). Both sides of the connection must agree on their Model Match setting. For a detailed explanation of how this restricts connections see Model Match.TX Power¶
TX Power is a folder, press ENTER to enter the TX Power settings and use RTN/EXIT to exit the folder.
Max Power
sets the maxumum power level your TX will transmit at. Selecting a power level higher or lower than your TX supports will revert to the closest supported level. The options are10, 25, 50, 100, 250, 500, 1000 & 2000
mW. If Dynamic Power is set toOff
this is the power level your TX always uses.Dynamic
enables the Dynamic Power feature.Off
means that the TX will transmit at Max Power at all times.On
means the TX will dynamically lower power to save energy when maximum power is not needed. The optionsAUX9, AUX10, AUX11, AUX12
indicate that the TX can be changed from max power to dynamic power by changing the position of a switch. where switch HIGH (>1500us) = dynamic power, switch LOW (<1500us) = max power. For more information, Dynamic Transmit Power provides a deeper dive on the algorithm and usage.Fan Thresh
sets the power level the Fan should activate, e.g. if set to 100mW, then the fan should spin up if you setMax Power
to 100mW withDynamic
set to OFF after a short delay. The fan will continue running for some time even after the power level goes below the threshold. Not all modules have a Fan header that benefits from the setting. . Default fan threshold is 250mW.VTX Administrator¶
VTX Administrator allows you to change your VTX settings directly from your radio, and have those VTX settings be applied to any receiver you connect to. The VTX settings are sent every time a new connection is acquired, or when
[Send VTX]
is pressed. VTX Administrator will only send data when disarmed
Band
sets the VTX band, the options areOff, A, B, E, F, R & L
, the standard analog FPV bands.Off
means that VTX Administrator will not adjust any VTX settings.Channel
sets the VTX channel, the options are1, 2, 3, 4, 5, 6, 7 & 8
which are the standard channels in the above bands.Pwr Lvl
sets the VTX power by index, the options are-, 1, 2, 3, 4, 5, 6, 7, & 8
which are the power levels that your VTX can do. Refer to your VTX table settings on the flight controller for the exact power levels. For example a VTX may have 1 = 25mW, 2 = 100mwW, 3 = 200mW, 4 = 500mW.Pitmode
the options areOn & Off
which allow you to quickly switch into or out of pitmode- Finally pressing the
[Send VTX]
button sends the configured settings to the receiver and on to the VTX. These settings are also sent every time a connection is established.WiFi Connectivity¶
This section contains all the WiFi-related functions.
Enable WiFi
will activate Tx module WiFi mode for updating via WiFi (if the Tx Module has WiFi Capabilities). Visit this page for instructions on how the updating process works.Enable Rx WiFi
will put the bound and connected receiver into WiFi mode to facilitate updating via WiFi (if the receiver has WiFi capabilities).Enable Backpack WiFi
will put the Tx Backpack into WiFi mode (available only to TX modules with backpacks connected and updated to the new Backpack firmwares).Enable VRx WiFi
will put the VRx Backpack that is bound and connected to the onboard TX Backpack into WiFi mode to facilitate updating via WiFi.Bind¶
Pressing the
[Bind]
button activates binding mode for traditional binding. This does nothing for users who have configured a bind phrase and is not needed. For more information check out this page on binding.BLE Joystick (ESP32 TXes Only)¶
Pressing the
[BLE Joystick]
selection activates BluetoothLE Joystick mode which allows connection to simulators through the bluetooth of your computer. Reboot or change models to exit this mode.Troubleshooting the Lua Script¶
ExpressLRS Lua Script is stuck at
Loading...
¶Go back to the Radio Setup Guide and make sure your radio is prepped up for ExpressLRS.
Also make sure your module has been flashed with v2.0 firmware. V2 Lua for V2.0-flashed modules, V1 Lua for v1.x-flashed modules (including modules fresh from factory; except the new OLED-equipped NamimnoRC modules and the Happymodel ES24TX Pro full-size module).
For newly-acquired ExpressLRS modules, flashing via USB is the recommended update method.
On v1.x, I can choose 2W on the Lua, but I cannot do that anymore. What gives?¶
This means your module cannot go that high or that low. The power levels you can select on the new Lua script is based off the power levels your module supports.
This also applies to other options like
Enable Backpack WiFi
orBLE Joystick
. If your module doesn’t support any of these features, it won’t show up on the Lua Script.
数传的带宽解释:Telemetry Bandwidth – ExpressLRS
Telemetry Burst describes the allocation of telemetry packets in ExpressLRS added in #472. There are two types of packets, LINK and DATA. LINK is the standard link statistics and is always available, and DATA is “Advanced Telemetry” which is telemetry coming from the flight controller and shares bandwidth with MSP transfers. Burst mode attempts to maintain a minimum rate of LINK packets and use the rest of the available telemetry slots for DATA.
The LINK rate chosen was one every 512ms, roughly 2 per second but slightly higher to allow more rates to have an additional burst packet at lower ratios.
Air Rate Telem Ratio Telem Interval (ms) Packets/second Burst Count Bandwidth (no Burst) Bandwidth (Burst) 500 1:128 256 3.9 1 78bps 78bps 500 1:64 128 7.8 3 156bps 234bps 500 1:32 64 15.6 7 312bps 547bps 500 1:16 32 31.2 15 625bps 1172bps 500 1:8 16 62.5 31 1250bps 2422bps 500 1:4 8 125.0 63 2500bps 4922bps 500 1:2 4 250.0 127 5000bps 9922bps Air Rate Telem Ratio Telem Interval (ms) Packets/second Burst Count Bandwidth (no Burst) Bandwidth (Burst) 250 1:128 512 2.0 1 39bps 39bps 250 1:64 256 3.9 1 78bps 78bps 250 1:32 128 7.8 3 156bps 234bps 250 1:16 64 15.6 7 312bps 547bps 250 1:8 32 31.2 15 625bps 1172bps 250 1:4 16 62.5 31 1250bps 2422bps 250 1:2 8 125.0 63 2500bps 4922bps Air Rate Telem Ratio Telem Interval (ms) Packets/second Burst Count Bandwidth (no Burst) Bandwidth (Burst) 200 1:128 640 1.6 1 31bps 31bps 200 1:64 320 3.1 1 62bps 62bps 200 1:32 160 6.2 2 125bps 167bps 200 1:16 80 12.5 5 250bps 417bps 200 1:8 40 25.0 11 500bps 917bps 200 1:4 20 50.0 24 1000bps 1920bps 200 1:2 10 100.0 50 2000bps 3922bps Air Rate Telem Ratio Telem Interval (ms) Packets/second Burst Count Bandwidth (no Burst) Bandwidth (Burst) 150 1:128 853 1.2 1 23bps 23bps 150 1:64 426 2.3 1 47bps 47bps 150 1:32 213 4.7 1 94bps 94bps 150 1:16 106 9.4 3 188bps 281bps 150 1:8 53 18.8 8 375bps 667bps 150 1:4 26 37.5 18 750bps 1421bps 150 1:2 13 75.0 37 1500bps 2921bps Air Rate Telem Ratio Telem Interval (ms) Packets/second Burst Count Bandwidth (no Burst) Bandwidth (Burst) 100 1:128 1280 0.8 1 16bps 16bps 100 1:64 640 1.6 1 31bps 31bps 100 1:32 320 3.1 1 62bps 62bps 100 1:16 160 6.2 2 125bps 167bps 100 1:8 80 12.5 5 250bps 417bps 100 1:4 40 25.0 11 500bps 917bps 100 1:2 20 50.0 24 1000bps 1920bps Air Rate Telem Ratio Telem Interval (ms) Packets/second Burst Count Bandwidth (no Burst) Bandwidth (Burst) 50 1:128 2560 0.4 1 8bps 8bps 50 1:64 1280 0.8 1 16bps 16bps 50 1:32 640 1.6 1 31bps 31bps 50 1:16 320 3.1 1 62bps 62bps 50 1:8 160 6.2 2 125bps 167bps 50 1:4 80 12.5 5 250bps 417bps 50 1:2 40 25.0 11 500bps 917bps Air Rate Telem Ratio Telem Interval (ms) Packets/second Burst Count Bandwidth (no Burst) Bandwidth (Burst) 25 1:128 5120 0.2 1 4bps 4bps 25 1:64 2560 0.4 1 8bps 8bps 25 1:32 1280 0.8 1 16bps 16bps 25 1:16 640 1.6 1 31bps 31bps 25 1:8 320 3.1 1 62bps 62bps 25 1:4 160 6.2 2 125bps 167bps 25 1:2 80 12.5 5 250bps 417bps
12345678910111213141516171819202122232425262728 <button class="md-clipboard md-icon" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; background: transparent; border: 0px; font-family: inherit; font-size: inherit; margin: 0px; padding: 0px; border-radius: 0.1rem; color: var(--md-default-fg-color--light); cursor: pointer; height: 1.5em; outline: none; outline-offset: 0.1rem; position: absolute; right: 0.5em; top: 0.5em; transition: color 0.25s ease 0s; width: 1.5em; z-index: 1;" title="Copy to clipboard" data-clipboard-target="#__code_1 > code"></button><code tabindex="0">// Source code for table generatorint main(void){for (uint8_t rate=RATE_500HZ; rate<RATE_4HZ; ++rate){uint32_t hz = RateEnumToHz((expresslrs_RFrates_e)rate);printf("| Air Rate | Telem Ratio | Telem Interval (ms) | Packets/second | Bandwidth (no Burst) | Bandwidth (Burst)\n");if (rate == RATE_500HZ) printf("|---|---|---|---|---|---|\n");for (uint8_t ratio=TLM_RATIO_1_128; ratio<TLM_RATIO_ENUM_MAX; ++ratio){uint32_t tlmRatio = TLMratioEnumToValue((expresslrs_tlm_ratio_e)ratio);float telemPps = (float)hz / tlmRatio;uint32_t telemInterval = 1000 * tlmRatio / hz;uint32_t tlmBurst = TELEM_MIN_LINK_INTERVAL * hz / tlmRatio / 1000;// Reserve one slot for LINK telemetryif (tlmBurst > 1)--tlmBurst;elsetlmBurst = 1;printf("%u | 1:%u | %u | %.1f | %u | %.0fbps | %.0fbps\n",hz, tlmRatio, telemInterval, telemPps, tlmBurst, telemPps*1/2*5*8,5*8*telemPps*tlmBurst/(tlmBurst+1));}}return 0;}