changeset 99:b06532c9642f

fc-rfcal-vcxo: abort on getting a NaN response
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 11 Aug 2017 02:21:32 +0000
parents 615df2fb1ec3
children 7ad5836d3b87
files autocal/vcxomeas.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/autocal/vcxomeas.c	Mon Jul 17 22:49:35 2017 +0000
+++ b/autocal/vcxomeas.c	Fri Aug 11 02:21:32 2017 +0000
@@ -2,6 +2,7 @@
  * This module contains the frequency measurement code for fc-rfcal-vcxo.
  */
 
+#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -25,5 +26,10 @@
 	tsid_command(cmd);
 	meas = atof(tsid_response + 1);
 	printf("Measured frequency offset %.2f Hz\n", meas);
+	if (isnan(meas)) {
+		printf("Error: got NaN response, aborting\n");
+		do_rfe(STOP_ALL);
+		exit(ERROR_TARGET);
+	}
 	return(meas);
 }