From a1dc923315514ed6f23da5f2c0950830975299f8 Mon Sep 17 00:00:00 2001 From: jaseg Date: Mon, 16 Mar 2020 19:19:34 +0100 Subject: Fix serial --- controller/fw/src/freq_meas.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'controller/fw/src/freq_meas.c') diff --git a/controller/fw/src/freq_meas.c b/controller/fw/src/freq_meas.c index 020e12d..6b9b54e 100644 --- a/controller/fw/src/freq_meas.c +++ b/controller/fw/src/freq_meas.c @@ -136,7 +136,13 @@ int adc_buf_measure_freq(uint16_t adc_buf[FMEAS_FFT_LEN], float *out) { DEBUG_PRINT("done."); */ - *out = (par[1] + first_bin) * binsize_hz; + float res = (par[1] + first_bin) * binsize_hz; + if (res < 5 || res > 150) { + *out = NAN; + return -1; + } + + *out = res; return 0; } -- cgit