mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
Frequency stepping using the uint32_t type is better than the float type.
This commit is contained in:
parent
0e982aa834
commit
c246209d34
6
main.c
6
main.c
|
|
@ -767,10 +767,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;
|
||||||
float span = stop - start;
|
uint32_t span = stop - start;
|
||||||
for (i = 0; i < points; i++) {
|
for (i = 0; i < points; i++) {
|
||||||
float offset = i * span / (float)(points - 1);
|
uint32_t offset = i * (span / (points - 1));
|
||||||
frequencies[i] = start + (uint32_t)offset;
|
frequencies[i] = start + offset;
|
||||||
}
|
}
|
||||||
// disable at out of sweep range
|
// disable at out of sweep range
|
||||||
for (; i < sweep_points; i++)
|
for (; i < sweep_points; i++)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue