Replace hardcoded values on defined constant

pull/4/head
DiSlord 6 years ago
parent f9ad83dbef
commit cf96ae7d22

@ -2682,7 +2682,7 @@ int main(void)
dacStart(&DACD2, &dac1cfg1); dacStart(&DACD2, &dac1cfg1);
#endif #endif
setupSA(); setupSA();
sweep_points = 290; sweep_points = POINTS_COUNT;
/* initial frequencies */ /* initial frequencies */
update_frequencies(); update_frequencies();

@ -885,9 +885,9 @@ static void trace_get_value_string(
} else { } else {
#if 1 #if 1
uint32_t resolution = get_sweep_frequency(ST_SPAN); 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); 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); plot_printf(&buf2[1], sizeof(buf2) -1, "%3.2f" , (dfreq + 5000) / 1000000.0);
else else
plot_printf(&buf2[1], sizeof(buf2) -1, "%3.1f" , (dfreq + 50000) / 1000000.0); plot_printf(&buf2[1], sizeof(buf2) -1, "%3.1f" , (dfreq + 50000) / 1000000.0);

@ -1208,7 +1208,7 @@ int avoid_spur(int f) // find if this frequency should be avoi
// int window = ((int)actual_rbw ) * 1000*2; // int window = ((int)actual_rbw ) * 1000*2;
// if (window < 50000) // if (window < 50000)
// 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(false);
return binary_search(f); 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; ls += 0.5;
else else
ls -= 0.5; 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) { if (a != old_a) {
old_a = a; old_a = a;
int d = 0; // Start at lowest drive level; 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 --------------------------------------- // ----------------------------------------------------- modulation for output modes ---------------------------------------
if (MODE_OUTPUT(setting.mode)){
if (MODE_OUTPUT(setting.mode) && (setting.modulation == MO_AM_1kHz||setting.modulation == MO_AM_10Hz)) { // AM modulation if (setting.modulation == MO_AM_1kHz || setting.modulation == MO_AM_10Hz) { // AM modulation
int p = setting.attenuate * 2 + am_modulation[modulation_counter]; int p = setting.attenuate * 2 + am_modulation[modulation_counter];
if (p>63) if (p>63)
p = 63; p = 63;
if (p<0) if (p<0)
p = 0; p = 0;
PE4302_Write_Byte(p); PE4302_Write_Byte(p);
if (modulation_counter == 4) { // 3dB modulation depth if (modulation_counter == 4) { // 3dB modulation depth
modulation_counter = 0; modulation_counter = 0;
} else { } else {
modulation_counter++; 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) else if (setting.modulation == MO_NFM || setting.modulation == MO_WFM ) { //FM modulation
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
SI4432_Sel = 1; SI4432_Sel = 1;
int offset; int offset;
if (setting.modulation == MO_NFM ) { 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++; modulation_counter++;
my_microsecond_delay(200); my_microsecond_delay(200);
// chThdSleepMicroseconds(200); // chThdSleepMicroseconds(200);
}
} }
// -------------------------------- Acquisition loop for one requested frequency covering spur avoidance and vbwsteps ------------------------ // -------------------------------- Acquisition loop for one requested frequency covering spur avoidance and vbwsteps ------------------------
float RSSI = -150.0; float RSSI = -150.0;
int t = 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) { 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; dirty = true;
stored_t[setting.linearity_step] = peakLevel; stored_t[setting.linearity_step] = peakLevel;
setting.linearity_step++; setting.linearity_step++;
@ -2700,7 +2702,7 @@ int add_spur(int f)
return stored_t[i]; return stored_t[i];
} }
} }
if (last_spur < 290) { if (last_spur < POINTS_COUNT) {
temp_t[last_spur] = f; temp_t[last_spur] = f;
stored_t[last_spur++] = 1; stored_t[last_spur++] = 1;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.