Added measuring of minimum sweep times

pull/4/head
erikkaashoek 6 years ago
parent 7ef621beed
commit d0a7c0649b

@ -631,7 +631,7 @@ void reset_settings(int m);
enum { S_OFF=0, S_ON=1, S_AUTO_OFF=2, S_AUTO_ON=3 };
#ifdef __FAST_SWEEP__
#define MINIMUM_SWEEP_TIME 3000U // Minimum sweep time on zero span in uS
#define MINIMUM_SWEEP_TIME 2000U // Minimum sweep time on zero span in uS
#else
#define MINIMUM_SWEEP_TIME 15000U // Minimum sweep time on zero span in uS
#endif
@ -859,6 +859,7 @@ void SI4432_SetReference(int freq);
#define START_PROFILE systime_t time = chVTGetSystemTimeX();
#define RESTART_PROFILE time = chVTGetSystemTimeX();
#define STOP_PROFILE {char string_buf[12];plot_printf(string_buf, sizeof string_buf, "T:%06d", chVTGetSystemTimeX() - time);ili9341_drawstringV(string_buf, 1, 180);}
#define DELTA_TIME (time = chVTGetSystemTimeX() - time)
// Macros for convert define value to string
#define STR1(x) #x
#define define_to_STR(x) STR1(x)

@ -156,6 +156,12 @@ void reset_settings(int m)
dirty = true;
}
static uint32_t extra_vbw_step_time = 0;
static uint32_t etra_repeat_time = 0;
static uint32_t minimum_zero_span_sweep_time = 0;
static uint32_t minimum_sweep_time = 0;
uint32_t calc_min_sweep_time_us(void) // Calculate minimum sweep time in uS needed just because of the delays for the RSSI to become stable
{
float t;
@ -825,7 +831,12 @@ float temppeakLevel;
int temppeakIndex;
static unsigned long old_freq[4] = { 0, 0, 0, 0 };
static unsigned long real_old_freq[4] = { 0, 0, 0, 0 };
volatile int t;
//static uint32_t extra_vbw_step_time = 0;
//static uint32_t etra_repeat_time = 0;
//static uint32_t minimum_zero_span_sweep_time = 0;
//static uint32_t minimum_sweep_time = 0;
void setupSA(void)
{
@ -841,6 +852,15 @@ void setupSA(void)
SI4432_Transmit(0);
PE4302_init();
PE4302_Write_Byte(0);
setting.sweep_time_us = 0;
START_PROFILE
SI4432_Fill(0,200);
int t1 = DELTA_TIME;
RESTART_PROFILE
SI4432_Fill(0,0);
int t2 = DELTA_TIME;
t = (t2 - t1) * 100 * 290 / 200;
}
extern int SI4432_frequency_changed;
extern int SI4432_offset_changed;

@ -404,7 +404,7 @@ void SI4432_Fill(int s, int start)
t = 0;
SPI2_CLK_LOW;
int i = 0;
int i = start;
do {
palClearPad(GPIOC, sel);
shiftOut( 0x26 );
@ -414,7 +414,7 @@ void SI4432_Fill(int s, int start)
if (t)
my_microsecond_delay(t);
} while(1);
buf_index = start;
buf_index = start; // Is used to skip 1st entry during level triggering
buf_read = true;
}
#endif

Loading…
Cancel
Save

Powered by TurnKey Linux.