1 #include "rxtx_devLua.h"
4 char strPowerLevels
[] = "10;25;50;100;250;500;1000;2000;MatchTX ";
5 const char STR_EMPTYSPACE
[] = { 0 };
7 void luadevGeneratePowerOpts(luaItem_selection
*luaPower
)
9 // This function modifies the strPowerLevels in place and must not
10 // be called more than once!
11 char *out
= strPowerLevels
;
12 PowerLevels_e pwr
= PWR_10mW
;
13 // Count the semicolons to move `out` to point to the MINth item
14 while (pwr
< POWERMGNT::getMinPower())
16 while (*out
++ != ';') ;
17 pwr
= (PowerLevels_e
)((unsigned int)pwr
+ 1);
19 // There is no min field, compensate by shifting the index when sending/receiving
20 // luaPower->min = (uint8_t)MinPower;
21 luaPower
->options
= (const char *)out
;
23 // Continue until after than MAXth item and drop a null in the orginal
24 // string on the semicolon (not after like the previous loop)
25 while (pwr
<= POWERMGNT::getMaxPower())
27 // If out still points to a semicolon from the last loop move past it
30 while (*out
&& *out
!= ';')
32 pwr
= (PowerLevels_e
)((unsigned int)pwr
+ 1);
36 #if defined(TARGET_RX)
37 // The RX has the dynamic option added on to the end
38 // the space on the end is to make it display "MatchTX mW"
39 // but only if it has more than one power level
40 if (POWERMGNT::getMinPower() != POWERMGNT::getMaxPower())
41 strcat(strPowerLevels
, ";MatchTX ");