Fix buffer overflow bug in peak array

The peak array is only 7 bytes long, but there are 8 bytes written to it. This overwrites the variable, that the compiler decides to put afterwards, most likely the sample buffer vReal[]. Maybe this is also the reason why you decided to omit the first sample when iterating through vReal[]?
pull/1/head
Clemens Kirchgatterer 2019-07-11 10:06:17 +02:00 zatwierdzone przez GitHub
rodzic da88434ac8
commit 88b43f9cb3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -19,7 +19,7 @@ arduinoFFT FFT = arduinoFFT();
int amplitude = 200;
unsigned int sampling_period_us;
unsigned long microseconds;
byte peak[] = {0, 0, 0, 0, 0, 0, 0};
byte peak[] = {0, 0, 0, 0, 0, 0, 0, 0};
double vReal[SAMPLES];
double vImag[SAMPLES];
unsigned long newTime, oldTime;
@ -114,4 +114,4 @@ void loop()
Serial.println();
ws2812fx.service();
}
}