diff FXAnalyse.c @ 199:111610d871af

Show error state in main user inteface panel
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Mon, 31 Mar 2014 17:03:37 +0200
parents 5cac684eb12e
children 31093786d41d
line wrap: on
line diff
--- a/FXAnalyse.c	Mon Mar 31 17:03:37 2014 +0200
+++ b/FXAnalyse.c	Mon Mar 31 17:03:37 2014 +0200
@@ -201,7 +201,7 @@
 };
 
 int Measuring_1 = N_MEASUREMENT_NONE;
-int Measuring_2 = N_MEASUREMENT_NONE;											  
+int Measuring_2 = N_MEASUREMENT_NONE;
 int Measuring_3 = N_MEASUREMENT_NONE;
 
 int nobs = 0;
@@ -359,7 +359,13 @@
 static struct datalogger datalogger;
 
 
-void * muParserNew()
+static void onerror(int level, const char *msg)
+{
+	SetCtrlVal(MainPanel, PANEL_ERROR, 1);
+}
+
+
+static void * muParserNew()
 {
 	void *parser = mupCreate();
 	
@@ -420,7 +426,7 @@
 		return -1;
 
 	// logging
-	logger_init();
+	logger_init(&onerror);
 	
 	// load configuration file
 	char path[MAX_PATHNAME_LEN];
@@ -461,7 +467,10 @@
 		return -1;
 	
 	// initialize AD9912 DDS box
-	ad9912_init(&ad9912, host, clock);
+	rv = ad9912_init(&ad9912, host, clock);
+	if (rv)
+		logmessage(ERROR, "ad9912 init erorr=%d", -rv);
+	
 	GetCtrlVal(MainPanel, PANEL_DDS1, &frequency);
 	ad9912_set_frequency_w(&ad9912, 0, frequency);
 	GetCtrlVal(MainPanel, PANEL_DDS2, &frequency);
@@ -1979,13 +1988,27 @@
 	switch (event)
 	{
 		case EVENT_COMMIT:
-			GetCtrlVal(panel, PANEL_SHOWLOG, &visible);
+			GetCtrlVal(panel, control, &visible);
 			logger_panel_visible(visible);
 			break;
 	}
 	return 0;
 }
 
+int CVICALLBACK CB_ShowError (int panel, int control, int event,
+		void *callbackData, int eventData1, int eventData2)
+{
+	switch (event)
+	{
+		case EVENT_COMMIT:
+			logger_panel_visible(TRUE);
+			SetCtrlVal(panel, control, FALSE);
+			SetCtrlVal(panel, PANEL_SHOWLOG, TRUE);
+			break;
+	}
+	return 0;
+}
+
 int CVICALLBACK CB_OnLoggingPanelEvent(int panel, int event,
 		void *callbackData, int eventData1, int eventData2)
 {