From f870877782ba8a279580f2df0ab7c244a4849ab0 Mon Sep 17 00:00:00 2001 From: Harsh Sharma Date: Fri, 15 Nov 2019 14:02:18 -0600 Subject: Changed attenuator power to be int instead of float --- util_tx_continuous/src/util_tx_continuous.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'util_tx_continuous') diff --git a/util_tx_continuous/src/util_tx_continuous.c b/util_tx_continuous/src/util_tx_continuous.c index 275c3eb..54d77f7 100644 --- a/util_tx_continuous/src/util_tx_continuous.c +++ b/util_tx_continuous/src/util_tx_continuous.c @@ -59,7 +59,7 @@ Maintainer: Matthieu Leurent #define DEFAULT_FDEV_KHZ 25 #define DEFAULT_BT 2 #define DEFAULT_NOTCH_FREQ 129000U -#define DEFAULT_ATTENUATION 0.0 +#define DEFAULT_ATTENUATION 0 /* -------------------------------------------------------------------------- */ /* --- GLOBAL VARIABLES ----------------------------------------------------- */ @@ -109,7 +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; + uint8_t g_atten = DEFAULT_ATTENUATION; char mod[64] = DEFAULT_MODULATION; uint8_t sf = DEFAULT_SF; unsigned int bw_khz = DEFAULT_BW_KHZ; @@ -267,13 +267,13 @@ int main(int argc, char **argv) } } else if (strcmp(long_options[option_index].name,"attn") == 0) { - i = sscanf(optarg, "%f", &arg_f); - if ((i != 1) || (arg_f < 0.0) ) { + i = sscanf(optarg, "%u", &arg_u); + if ((i != 1) || (arg_f > 127) ) { printf("ERROR: argument parsing of --attn argument. Use -h to print help\n"); return EXIT_FAILURE; } else { - g_atten = arg_f; + g_atten = arg_u; } } else { @@ -363,9 +363,9 @@ int main(int argc, char **argv) txpkt.tx_mode = IMMEDIATE; txpkt.rf_chain = TX_RF_CHAIN; if (fpga_supports_attenuator()) { - txpkt.rf_power = 32.0 - g_atten; + txpkt.rf_power = 32 - g_atten; } else { - txpkt.rf_power = 0.0; + txpkt.rf_power = 0; } if (strcmp(mod, "FSK") == 0) { -- cgit v1.2.3