From 4c7c927f3c1d24aa7ced382a5a417e5314e104c2 Mon Sep 17 00:00:00 2001 From: jaseg Date: Wed, 18 Mar 2020 12:58:55 +0100 Subject: Improve frequency measurement error detection --- controller/fw/src/freq_meas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- cgit