diff --git a/main.c b/main.c index 3b660fe..7cb6e73 100644 --- a/main.c +++ b/main.c @@ -2682,7 +2682,7 @@ int main(void) dacStart(&DACD2, &dac1cfg1); #endif setupSA(); - sweep_points = 290; + sweep_points = POINTS_COUNT; /* initial frequencies */ update_frequencies(); diff --git a/plot.c b/plot.c index 93f6daa..bd655a0 100644 --- a/plot.c +++ b/plot.c @@ -885,9 +885,9 @@ static void trace_get_value_string( } else { #if 1 uint32_t resolution = get_sweep_frequency(ST_SPAN); - if (resolution <= 2000*290) + if (resolution <= 2000*POINTS_COUNT) plot_printf(&buf2[1], sizeof(buf2) -1, "%3.3f" , (dfreq + 500) / 1000000.0); - else if (resolution <= 20000*290) + else if (resolution <= 20000*POINTS_COUNT) plot_printf(&buf2[1], sizeof(buf2) -1, "%3.2f" , (dfreq + 5000) / 1000000.0); else plot_printf(&buf2[1], sizeof(buf2) -1, "%3.1f" , (dfreq + 50000) / 1000000.0); diff --git a/sa_core.c b/sa_core.c index 04bbb36..c2cb2c8 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1208,7 +1208,7 @@ int avoid_spur(int f) // find if this frequency should be avoi // int window = ((int)actual_rbw ) * 1000*2; // if (window < 50000) // window = 50000; - if (! setting.mode == M_LOW || !setting.auto_IF || actual_rbw > 300.0) + if (setting.mode != M_LOW || !setting.auto_IF || actual_rbw > 300.0) return(false); return binary_search(f); } @@ -1239,7 +1239,7 @@ float perform(bool break_on_operation, int i, uint32_t f, int tracking) // M ls += 0.5; else ls -= 0.5; - float a = ((int)((setting.level + (i / 290.0) * ls)*2.0)) / 2.0; + float a = ((int)((setting.level + (i / sweep_points) * ls)*2.0)) / 2.0; if (a != old_a) { old_a = a; int d = 0; // Start at lowest drive level; @@ -1288,26 +1288,26 @@ float perform(bool break_on_operation, int i, uint32_t f, int tracking) // M } // ----------------------------------------------------- modulation for output modes --------------------------------------- - - if (MODE_OUTPUT(setting.mode) && (setting.modulation == MO_AM_1kHz||setting.modulation == MO_AM_10Hz)) { // AM modulation - int p = setting.attenuate * 2 + am_modulation[modulation_counter]; - if (p>63) - p = 63; - if (p<0) - p = 0; - PE4302_Write_Byte(p); - if (modulation_counter == 4) { // 3dB modulation depth - modulation_counter = 0; - } else { - modulation_counter++; + if (MODE_OUTPUT(setting.mode)){ + if (setting.modulation == MO_AM_1kHz || setting.modulation == MO_AM_10Hz) { // AM modulation + int p = setting.attenuate * 2 + am_modulation[modulation_counter]; + if (p>63) + p = 63; + if (p<0) + p = 0; + PE4302_Write_Byte(p); + if (modulation_counter == 4) { // 3dB modulation depth + modulation_counter = 0; + } else { + modulation_counter++; + } + if (setting.modulation == MO_AM_10Hz) + my_microsecond_delay(20000); + else + my_microsecond_delay(180); +// chThdSleepMicroseconds(200); } - if (setting.modulation == MO_AM_10Hz) - my_microsecond_delay(20000); - else - my_microsecond_delay(180); -// chThdSleepMicroseconds(200); - - } else if (MODE_OUTPUT(setting.mode) && (setting.modulation == MO_NFM || setting.modulation == MO_WFM )) { //FM modulation + else if (setting.modulation == MO_NFM || setting.modulation == MO_WFM ) { //FM modulation SI4432_Sel = 1; int offset; if (setting.modulation == MO_NFM ) { @@ -1326,7 +1326,9 @@ float perform(bool break_on_operation, int i, uint32_t f, int tracking) // M modulation_counter++; my_microsecond_delay(200); // chThdSleepMicroseconds(200); + } } + // -------------------------------- Acquisition loop for one requested frequency covering spur avoidance and vbwsteps ------------------------ float RSSI = -150.0; int t = 0; @@ -1910,7 +1912,7 @@ again: // Waiting for a trigger jumps back to here if (setting.measurement == M_LINEARITY && setting.linearity_step < setting._sweep_points) { - setting.attenuate = 29.0 - setting.linearity_step * 30.0 / 290.0; + setting.attenuate = 29.0 - setting.linearity_step * 30.0 / POINTS_COUNT; dirty = true; stored_t[setting.linearity_step] = peakLevel; setting.linearity_step++; @@ -2700,7 +2702,7 @@ int add_spur(int f) return stored_t[i]; } } - if (last_spur < 290) { + if (last_spur < POINTS_COUNT) { temp_t[last_spur] = f; stored_t[last_spur++] = 1; }