Display sweep time in zero span mode

tinySA-v0.2
erikkaashoek 6 years ago
parent eb706a2728
commit 58e2dd8dfb

@ -185,7 +185,7 @@ void set_step_delay(int t);
void set_repeat(int);
void set_level_sweep(float);
void set_level(float);
void set_sweep_time(int32_t);
void set_sweep_time(float);
//extern int setting.repeat;
//extern int setting.rbw;
#ifdef __SPUR__
@ -576,7 +576,7 @@ typedef struct setting
int linearity_step;
float level;
float level_sweep;
int32_t sweep_time;
float sweep_time;
int test_argument;
uint32_t checksum;
}setting_t;

@ -2068,7 +2068,6 @@ void frequency_string(char *buf, size_t len, int32_t freq)
#endif
}
void
draw_frequencies(void)
{
@ -2084,6 +2083,13 @@ draw_frequencies(void)
#endif
if (FREQ_IS_CW()) {
plot_printf(buf1, sizeof(buf1), " CW %qHz", get_sweep_frequency(ST_CW));
float t = setting.sweep_time*1000.0 + 25.0; // in mS
; // in mS
if (t>=1000)
plot_printf(buf2, sizeof(buf2), "%.2fS",t/1000.0);
else
plot_printf(buf2, sizeof(buf2), "%.2fmS", t);
} else if (FREQ_IS_STARTSTOP()) {
plot_printf(buf1, sizeof(buf1), " START %qHz", get_sweep_frequency(ST_START));
plot_printf(buf2, sizeof(buf2), " STOP %qHz", get_sweep_frequency(ST_STOP));

@ -65,7 +65,7 @@ void reset_settings(int m)
set_sweep_frequency(ST_START, (uint32_t) 0);
set_sweep_frequency(ST_STOP, (uint32_t) 350000000);
setting.attenuate = 30;
setting.sweep_time = 0;
setting.sweep_time = 0.0;
break;
#ifdef __ULTRA__
case M_ULTRA:
@ -74,7 +74,7 @@ void reset_settings(int m)
set_sweep_frequency(ST_START, (uint32_t) minFreq);
set_sweep_frequency(ST_STOP, (uint32_t) maxFreq);
setting.attenuate = 0;
setting.sweep_time = 0;
setting.sweep_time = 0.0;
break;
#endif
case M_GENLOW:
@ -83,7 +83,7 @@ void reset_settings(int m)
maxFreq = 520000000;
set_sweep_frequency(ST_CENTER, (int32_t) 10000000);
set_sweep_frequency(ST_SPAN, 0);
setting.sweep_time = 100;
setting.sweep_time = 10.0;
break;
case M_HIGH:
#ifdef __ULTRA_SA__
@ -95,7 +95,7 @@ void reset_settings(int m)
#endif
set_sweep_frequency(ST_START, (int32_t) minFreq);
set_sweep_frequency(ST_STOP, (int32_t) maxFreq);
setting.sweep_time = 0;
setting.sweep_time = 0.0;
break;
case M_GENHIGH:
setting.drive=8;
@ -103,7 +103,7 @@ void reset_settings(int m)
maxFreq = 960000000;
set_sweep_frequency(ST_CENTER, (int32_t) 300000000);
set_sweep_frequency(ST_SPAN, 0);
setting.sweep_time = 100;
setting.sweep_time = 10.0;
break;
}
for (int i = 0; i< MARKERS_MAX; i++) {
@ -168,12 +168,12 @@ void set_level_sweep(float l)
dirty = true;
}
void set_sweep_time(int32_t t)
void set_sweep_time(float t)
{
if (t < 5)
t = 5;
if (t > 6000)
t = 6000;
if (t < 0.0)
t = 0.0;
if (t > 600.0)
t = 600.0;
setting.sweep_time = t;
dirty = true;
}
@ -1231,12 +1231,12 @@ again:
RSSI = perform(break_on_operation, i, frequencies[i], setting.tracking);
if ( setting.sweep_time > 0 && !(MODE_OUTPUT(setting.mode) && setting.modulation != MO_NONE)) {
int32_t s = setting.sweep_time * (100000 / 290);
if ( setting.sweep_time > 0.0 && !(MODE_OUTPUT(setting.mode) && setting.modulation != MO_NONE)) {
float s = setting.sweep_time * (1000000.0 / 290.0);
if (s < 30000)
my_microsecond_delay(s);
my_microsecond_delay((int)s);
else
osalThreadSleepMilliseconds(s/1000);
osalThreadSleepMilliseconds(((int)s)/1000);
}
// back to toplevel to handle ui operation
@ -1767,15 +1767,17 @@ void draw_cal_status(void)
ili9341_drawstring("Scan:", x, y);
y += YSTEP;
int32_t t = ((int32_t)setting.sweep_time)*100 + (int)((2* vbwSteps * sweep_points * ( actualStepDelay / 100) )) /10
float t = setting.sweep_time*1000.0 + 25.0 + (float)((2* vbwSteps * sweep_points * ( actualStepDelay / 100) )) /10
#ifdef __SPUR__
* (setting.spur ? 2 : 1)
#endif
; // in mS
if (t>1000)
plot_printf(buf, BLEN, "%dS",(t+500)/1000);
if (t>=10000.0)
plot_printf(buf, BLEN, "%dS",(int)t);
else if (t>=1000)
plot_printf(buf, BLEN, "%.0fS",t);
else
plot_printf(buf, BLEN, "%dmS",t);
plot_printf(buf, BLEN, "%dmS",(int)t);
buf[5]=0;
ili9341_drawstring(buf, x, y);

@ -442,16 +442,18 @@ float SI4432_RSSI(uint32_t i, int s)
#endif
//START_PROFILE
SI4432_Sel = s;
if (actualStepDelay)
my_microsecond_delay(actualStepDelay);
// chThdSleepMicroseconds(actualStepDelay);
i = setting.repeat;
RSSI_RAW = 0;
while (i-->0)
RSSI_RAW += ((unsigned int)SI4432_Read_Byte( 0x26 )) << 4 ;
if (setting.repeat > 1)
RSSI_RAW = RSSI_RAW / setting.repeat;
// if (MODE_INPUT(setting.mode) && RSSI_RAW == 0)
// SI4432_Init();
float dBm = (((float)RSSI_RAW)/16.0 - 240.0)/2.0 + SI4432_RSSI_correction;
float dBm = ((float)RSSI_RAW)/32.0 - 120.0 + SI4432_RSSI_correction;
#ifdef __SIMULATION__
dBm = Simulated_SI4432_RSSI(i,s);
#endif

@ -422,8 +422,8 @@ static const char * const keypad_mode_label[] = {
#ifdef __SA__
static const char * const keypad_mode_label[] = {
"error", "START", "STOP", "CENTER", "SPAN", "FREQ", "REFPOS", "SCALE", // 0-7
"\2ATTENUATE\0 0-31dB", "ACTUALPOWER", "IF", "\2SAMPLE\0TIME", "DRIVE", "LEVEL", "LEVEL", "LEVEL", // 8-15
"OFFSET" , "REPEATS", "OFFSET", "TRIGGER", "\2LEVEL\0SWEEP", "SWEEP mS"// 16-
"\2ATTENUATE\0 0-31dB", "\2ACTUAL\0POWER", "IF", "\2SAMPLE\0TIME", "DRIVE", "LEVEL", "LEVEL", "LEVEL", // 8-15
"OFFSET" , "REPEATS", "OFFSET", "TRIGGER", "\2LEVEL\0SWEEP", "\2SWEEP\0SECONDS"// 16-
};
#endif

Loading…
Cancel
Save

Powered by TurnKey Linux.