From 81a250d6eacde3e1c62438099263bcf4f462e9a4 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Mon, 30 Nov 2020 13:04:44 +0100 Subject: [PATCH] Reduce warnings --- sa_cmd.c | 25 ++++++++++++++++++++++--- sa_core.c | 16 +++++++++------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/sa_cmd.c b/sa_cmd.c index 6769642..915a3d4 100644 --- a/sa_cmd.c +++ b/sa_cmd.c @@ -272,8 +272,8 @@ VNA_SHELL_FUNCTION(cmd_if) shell_printf("usage: if {433M..435M}\r\n"); return; } else { - int a = my_atoi(argv[0]); - if (a!= 0 &&( a < (DEFAULT_IF - 2000000) || a>(DEFAULT_IF + 2000000))) + uint32_t a = (uint32_t)my_atoi(argv[0]); + if (a!= 0 &&( a < (DEFAULT_IF - (uint32_t)2000000) || a>(DEFAULT_IF + (uint32_t)2000000))) goto usage; setting.auto_IF = false; set_IF(a); @@ -325,13 +325,13 @@ VNA_SHELL_FUNCTION(cmd_v) VNA_SHELL_FUNCTION(cmd_y) { int rvalue; - int lvalue = 0; if (argc != 1 && argc != 2) { shell_printf("usage: y {addr(0-95)} [value(0-0xFF)]\r\n"); return; } rvalue = my_atoui(argv[0]); #ifdef __SI4432__ + int lvalue = 0; SI4432_Sel = VFO; if (argc == 2){ lvalue = my_atoui(argv[1]); @@ -385,6 +385,25 @@ VNA_SHELL_FUNCTION(cmd_selftest) } #ifdef __ADF4351__ + +uint32_t xtoi(char *t) +{ + + uint32_t v=0; + while (*t) { + if ('0' <= *t && *t <= '9') + v = v*16 + *t - '0'; + else if ('a' <= *t && *t <= 'f') + v = v*16 + *t - 'a' + 10; + else if ('A' <= *t && *t <= 'F') + v = v*16 + *t - 'A' + 10; + else + return v; + t++; + } + return v; +} + VNA_SHELL_FUNCTION(cmd_x) { uint32_t reg; diff --git a/sa_core.c b/sa_core.c index 2118522..9f9ead6 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1666,8 +1666,8 @@ pureRSSI_t perform(bool break_on_operation, int i, uint32_t f, int tracking) modulation_delay += config.cor_nfm; // -17 default // modulation_index = 0; // default value } - if ((setting.mode == M_GENLOW && f > 480000000 - DEFAULT_IF) || - (setting.mode == M_GENHIGH && f > 480000000) ) + if ((setting.mode == M_GENLOW && f > ((uint32_t)480000000) - DEFAULT_IF) || + (setting.mode == M_GENHIGH && f > ((uint32_t)480000000) ) ) modulation_index += 2; current_fm_modulation = (int *)fm_modulation[modulation_index]; f -= fm_modulation_offset[modulation_index]; // Shift output frequency @@ -1725,13 +1725,14 @@ modulation_again: if (/* MODE_INPUT(setting.mode) && */ i > 0 && FREQ_IS_CW()) // In input mode in zero span mode after first setting of the LO's goto skip_LO_setting; // No more LO changes required, save some time and jump over the code - int32_t local_IF; + uint32_t local_IF; again: // Spur reduction jumps to here for second measurement - if (MODE_HIGH(setting.mode)) + local_IF=0; // to get rid of warning + if (MODE_HIGH(setting.mode)) { local_IF = 0; - else if (MODE_LOW(setting.mode)){ // All low mode + } else if (MODE_LOW(setting.mode)){ // All low mode if (!setting.auto_IF) { local_IF = setting.frequency_IF; } @@ -1949,13 +1950,14 @@ static bool sweep(bool break_on_operation) { float RSSI; int16_t downslope; +#ifdef __SI4432__ uint32_t agc_peak_freq = 0; float agc_peak_rssi = -150; float agc_prev_rssi = -150; int last_AGC_value = 0; uint8_t last_AGC_direction_up = false; int AGC_flip_count = 0; - +#endif // if (setting.mode== -1) // return; // START_PROFILE; @@ -3537,7 +3539,7 @@ void self_test(int test) setting.frequency_step = 30000; if (setting.test_argument > 0) setting.frequency_step=setting.test_argument; - int f = 400000; // Start search at 400kHz + uint32_t f = 400000; // Start search at 400kHz // int i = 0; // Index in spur table (temp_t) set_RBW(setting.frequency_step/100); last_spur = 0;