mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
fix: #52
This commit is contained in:
parent
0d36621411
commit
4e2036ba36
5
main.c
5
main.c
|
|
@ -755,9 +755,10 @@ void
|
||||||
set_frequencies(uint32_t start, uint32_t stop, int16_t points)
|
set_frequencies(uint32_t start, uint32_t stop, int16_t points)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint32_t span = (stop - start) / 1000; /* prevents overflow because of maximum of int32_t(2.147e+9) */
|
float span = stop - start;
|
||||||
for (i = 0; i < points; i++)
|
for (i = 0; i < points; i++)
|
||||||
frequencies[i] = start + span * i / (points - 1) * 1000;
|
frequencies[i] = start + i * span / (float)(points - 1);
|
||||||
|
// disable at out of sweep range
|
||||||
for (; i < sweep_points; i++)
|
for (; i < sweep_points; i++)
|
||||||
frequencies[i] = 0;
|
frequencies[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue