From ed8f6aa8fe9cccbf6be0ce49a0a2be6660fe441e Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 16 Mar 2021 00:15:26 -0400 Subject: [PATCH] gyro_fft: fix bucket_index size - needed for larger FFT lengths (eg 1024, 2048, etc) --- src/modules/gyro_fft/GyroFFT.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/gyro_fft/GyroFFT.cpp b/src/modules/gyro_fft/GyroFFT.cpp index 31d5b2f368..862fe34c7c 100644 --- a/src/modules/gyro_fft/GyroFFT.cpp +++ b/src/modules/gyro_fft/GyroFFT.cpp @@ -292,7 +292,7 @@ void GyroFFT::Run() // start at 2 to skip DC // output is ordered [real[0], imag[0], real[1], imag[1], real[2], imag[2] ... real[(N/2)-1], imag[(N/2)-1] - for (uint8_t bucket_index = 2; bucket_index < (_imu_gyro_fft_len / 2); bucket_index = bucket_index + 2) { + for (uint16_t bucket_index = 2; bucket_index < (_imu_gyro_fft_len / 2); bucket_index = bucket_index + 2) { const float freq_hz = (bucket_index / 2) * resolution_hz; if (freq_hz > _param_imu_gyro_fft_max.get()) {