Frequency stepping using the uint32_t type is better than the float type.

This commit is contained in:
hugen 2019-10-12 10:16:15 +08:00
parent 0e982aa834
commit c246209d34

6
main.c
View file

@ -767,10 +767,10 @@ void
set_frequencies(uint32_t start, uint32_t stop, int16_t points)
{
int i;
float span = stop - start;
uint32_t span = stop - start;
for (i = 0; i < points; i++) {
float offset = i * span / (float)(points - 1);
frequencies[i] = start + (uint32_t)offset;
uint32_t offset = i * (span / (points - 1));
frequencies[i] = start + offset;
}
// disable at out of sweep range
for (; i < sweep_points; i++)