vbw also vbw_x10 and repaired remaining rbw

pull/4/head
erikkaashoek 6 years ago
parent 5d0cd17718
commit 2186d202c3

@ -591,7 +591,7 @@ typedef struct setting
int harmonic;
int decay;
int noise;
float vbw;
uint32_t vbw_x10;
int tracking_output;
int repeat;
uint32_t frequency0;

@ -78,7 +78,7 @@ void reset_settings(int m)
setting.step_delay = 0;
setting.offset_delay = 0;
setting.step_delay_mode = SD_NORMAL;
setting.vbw = 0;
setting.vbw_x10 = 0;
setting.auto_reflevel = true; // Must be after SetReflevel
setting.decay=20;
setting.noise=5;
@ -1062,13 +1062,13 @@ case M_GENHIGH: // Direct output from 1
void update_rbw(void) // calculate the actual_rbw and the vbwSteps (# steps in between needed if frequency step is largen than maximum rbw)
{
if (setting.frequency_step > 0 && MODE_INPUT(setting.mode)) {
setting.vbw = (setting.frequency_step)/1000.0;
setting.vbw_x10 = (setting.frequency_step)/100;
} else {
setting.vbw = 300; // trick to get right default rbw in zero span mode
setting.vbw_x10 = 3000; // trick to get right default rbw in zero span mode
}
actual_rbw_x10 = setting.rbw_x10; // requested rbw
if (actual_rbw_x10 == 0) { // if auto rbw
actual_rbw_x10 = 20.0*setting.vbw; // rbw is twice the frequency step to ensure no gaps in coverage
actual_rbw_x10 = 2*setting.vbw_x10; // rbw is twice the frequency step to ensure no gaps in coverage
}
if (actual_rbw_x10 < 26)
actual_rbw_x10 = 26;
@ -1082,13 +1082,13 @@ void update_rbw(void) // calculate the actual_rbw and the vbwSteps (#
actual_rbw_x10 = SI4432_SET_RBW(actual_rbw_x10); // see what rbw the SI4432 can realize
if (setting.frequency_step > 0 && MODE_INPUT(setting.mode)) { // When doing frequency scanning in input mode
vbwSteps = ((int)(2 * (setting.vbw + (actual_rbw/2)) / actual_rbw)); // calculate # steps in between each frequency step due to rbw being less than frequency step
vbwSteps = ((int)(2 * (setting.vbw_x10 + (actual_rbw_x10/2)) / actual_rbw_x10)); // calculate # steps in between each frequency step due to rbw being less than frequency step
if (setting.step_delay==1) // if in Precise scanning
vbwSteps *= 2; // use twice as many steps
if (vbwSteps < 1) // at least one step
vbwSteps = 1;
} else { // in all other modes
setting.vbw = actual_rbw_x10/10.0;
setting.vbw_x10 = actual_rbw_x10;
vbwSteps = 1; // only one vbwSteps
}
dirty = true;
@ -2294,7 +2294,7 @@ void draw_cal_status(void)
ili9341_drawstring("VBW:", x, y);
y += YSTEP;
plot_printf(buf, BLEN, "%dkHz",(int)setting.vbw);
plot_printf(buf, BLEN, "%dkHz",(int)setting.vbw_x10/10.0);
buf[6]=0;
ili9341_drawstring(buf, x, y);
}
@ -2909,7 +2909,7 @@ do_again:
setting.step_delay_mode = SD_NORMAL;
setting.step_delay = setting.step_delay * 5 / 4;
setting.rbw_x10 = SI4432_force_RBW(j);
shell_printf("RBW = %d, ",setting.rbw/10);
shell_printf("RBW = %d, ",setting.rbw_x10/10);
set_sweep_frequency(ST_SPAN, (uint32_t)(setting.rbw_x10 * 20000));
setting.repeat = 10;
@ -2948,14 +2948,14 @@ do_again:
#endif
setting.offset_delay = 1600;
test_value = saved_peakLevel;
if ((uint32_t)(setting.rbw * 10000) / 290 < 8000) { // fast mode possible
if ((uint32_t)(setting.rbw_x10 * 1000) / 290 < 8000) { // fast mode possible
while (setting.offset_delay > 0 && test_value != 0 && test_value > saved_peakLevel - 1.5) {
test_prepare(i);
setting.step_delay_mode = SD_FAST;
setting.offset_delay /= 2;
setting.spur = 0;
// shell_printf("\n\rRBW = %f",SI4432_force_RBW(j));
set_sweep_frequency(ST_SPAN, (uint32_t)(setting.rbw * 200000)); // 200 times RBW
set_sweep_frequency(ST_SPAN, (uint32_t)(setting.rbw_x10 * 20000)); // 200 times RBW
setting.repeat = 10;
test_acquire(i); // Acquire test
test_validate(i); // Validate test

Loading…
Cancel
Save

Powered by TurnKey Linux.