fix frequencies and set minimum rate to 5 in vna.c
@@ -56,12 +56,12 @@ int main(int argc, char *argv[])
*tx_level[0] = 32766;
*tx_level[1] = 0;
- *rx_size = 5000 - 1;
+ *rx_size = 25000 - 1;
start = 10000;
stop = 60000000;
size = 6000;
- rate = 1;
+ rate = 5;
corr = 0;
*rst &= ~3;
@@ -126,9 +126,9 @@ int main(int argc, char *argv[])
break;
case 3:
/* set rate */
- if(value < 1 || value > 50000) continue;
+ if(value < 5 || value > 50000) continue;
rate = value;
- *rx_size = 2500 * (rate + 1) - 1;
+ *rx_size = 2500 * (rate + 5) - 1;
break;
case 4:
/* set correction */
@@ -160,10 +160,9 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
pthread_detach(thread);
- freq = start;
for(i = 0; i < size; ++i)
{
- if(i > 0) freq = start + (stop - start) * (i - 1) / (size - 1);
+ freq = start + (stop - start) * i / (size - 1);
freq *= (1.0 + 1.0e-9 * corr);
*rx_freq = (uint32_t)floor(freq / 125.0e6 * (1<<30) + 0.5);
}
@@ -191,14 +190,14 @@ int main(int argc, char *argv[])
void *read_handler(void *arg)
{
- int i, j, cntr;
+ uint32_t i, j, cntr;
uint32_t rate = rate_thread;
uint32_t size = size_thread;
float buffer[4];
i = 0;
cntr = 0;
- while(cntr < size * (rate + 1))
+ while(cntr < size * (rate + 5))
{
if(sock_thread < 0) break;
@@ -208,7 +207,7 @@ void *read_handler(void *arg)
continue;
}
- if(i == 0)
+ if(i < 5)
{
for(j = 0; j < 4; ++j)
{
@@ -227,7 +226,7 @@ void *read_handler(void *arg)
++i;
++cntr;
- if(i < rate + 1) continue;
+ if(i < rate + 5) continue;
i = 0;
