summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2020-03-18 12:58:55 +0100
committerjaseg <git-bigdata-wsl-arch@jaseg.de>2020-03-18 12:58:55 +0100
commit4c7c927f3c1d24aa7ced382a5a417e5314e104c2 (patch)
treecae1ae02815913ff84850b08cb6cc1f89d4d49ba
parent80de5c2e24056d38e49c4aeff4f84a299165d933 (diff)
downloadmaster-thesis-4c7c927f3c1d24aa7ced382a5a417e5314e104c2.tar.gz
master-thesis-4c7c927f3c1d24aa7ced382a5a417e5314e104c2.tar.bz2
master-thesis-4c7c927f3c1d24aa7ced382a5a417e5314e104c2.zip
Improve frequency measurement error detection
-rw-r--r--controller/fw/src/freq_meas.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/controller/fw/src/freq_meas.c b/controller/fw/src/freq_meas.c
index 6b9b54e..035ffd4 100644
--- a/controller/fw/src/freq_meas.c
+++ b/controller/fw/src/freq_meas.c
@@ -137,7 +137,7 @@ int adc_buf_measure_freq(uint16_t adc_buf[FMEAS_FFT_LEN], float *out) {
DEBUG_PRINT("done.");
*/
float res = (par[1] + first_bin) * binsize_hz;
- if (res < 5 || res > 150) {
+ if (par[1] < 2 || res < 5 || res > 150 || par[0] < 1) {
*out = NAN;
return -1;
}