diff options
author | Harsh Sharma <harsh.sharma@multitech.com> | 2018-08-09 15:10:43 -0500 |
---|---|---|
committer | Harsh Sharma <harsh.sharma@multitech.com> | 2018-08-09 15:10:43 -0500 |
commit | 1e66084295f37f0d7f5f0a3518e43ae0cc613898 (patch) | |
tree | 3b6fcae715309aeec4f39c2b59f5945a18542c18 /util_tx_continuous | |
parent | 4a262a7c7e76e118cefb0cc7569a9597f230c888 (diff) | |
download | lora_gateway_mtac_full-1e66084295f37f0d7f5f0a3518e43ae0cc613898.tar.gz lora_gateway_mtac_full-1e66084295f37f0d7f5f0a3518e43ae0cc613898.tar.bz2 lora_gateway_mtac_full-1e66084295f37f0d7f5f0a3518e43ae0cc613898.zip |
Changed attenuation setup to be the difference between the LUT power and the tx packet power and make it automatically set
Diffstat (limited to 'util_tx_continuous')
-rw-r--r-- | util_tx_continuous/src/util_tx_continuous.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/util_tx_continuous/src/util_tx_continuous.c b/util_tx_continuous/src/util_tx_continuous.c index 79cf4b4..7768c22 100644 --- a/util_tx_continuous/src/util_tx_continuous.c +++ b/util_tx_continuous/src/util_tx_continuous.c @@ -59,6 +59,7 @@ Maintainer: Matthieu Leurent #define DEFAULT_FDEV_KHZ 25 #define DEFAULT_BT 2 #define DEFAULT_NOTCH_FREQ 129000U +#define DEFAULT_ATTENUATION 0.0 /* -------------------------------------------------------------------------- */ /* --- GLOBAL VARIABLES ----------------------------------------------------- */ @@ -95,6 +96,7 @@ int main(int argc, char **argv) {"fdev", 1, 0, 0}, {"bt", 1, 0, 0}, {"notch", 1, 0, 0}, + {"attn", 1, 0, 0}, {0, 0, 0, 0} }; unsigned int arg_u; @@ -107,6 +109,7 @@ int main(int argc, char **argv) uint8_t g_dac = DEFAULT_DAC_GAIN; uint8_t g_mix = DEFAULT_MIXER_GAIN; uint8_t g_pa = DEFAULT_PA_GAIN; + float g_atten = DEFAULT_ATTENUATION; char mod[64] = DEFAULT_MODULATION; uint8_t sf = DEFAULT_SF; unsigned int bw_khz = DEFAULT_BW_KHZ; @@ -146,6 +149,7 @@ int main(int argc, char **argv) printf(" --br <float> FSK bitrate in kbps, [0.5:250]\n"); printf(" --fdev <uint> FSK frequency deviation in kHz, [1:250]\n"); printf(" --bt <uint> FSK gaussian filter BT trim, [0:3]\n"); + printf(" --attn <float> Attenuator value in dB, Full Card Only [0.0:31.75]\n"); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); return EXIT_SUCCESS; break; @@ -262,6 +266,16 @@ int main(int argc, char **argv) tx_notch_freq = (uint32_t)arg_u * 1000U; } } + else if (strcmp(long_options[option_index].name,"attn") == 0) { + i = sscanf(optarg, "%f", &arg_f); + if ((i != 1) || (arg_f < 0.0) || (arg_f > 31.75)) { + printf("ERROR: argument parsing of --br argument. Use -h to print help\n"); + return EXIT_FAILURE; + } + else { + g_atten = arg_f; + } + } else { printf("ERROR: argument parsing options. Use -h to print help\n"); return EXIT_FAILURE; @@ -349,6 +363,10 @@ int main(int argc, char **argv) txpkt.tx_mode = IMMEDIATE; txpkt.rf_chain = TX_RF_CHAIN; txpkt.rf_power = 0; + if (read_fpga_version() == 32) { + i = lgw_set_attenuation(g_atten); + } + if (strcmp(mod, "FSK") == 0) { txpkt.modulation = MOD_FSK; txpkt.datarate = br_kbps * 1e3; |