Mercurial > hg > fxanalyse
comparison 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 |
comparison
equal
deleted
inserted
replaced
198:5cac684eb12e | 199:111610d871af |
---|---|
199 N_MEASUREMENT_ADJUST_FREQ_MINUS, | 199 N_MEASUREMENT_ADJUST_FREQ_MINUS, |
200 N_MEASUREMENT_FREP_MINUS, | 200 N_MEASUREMENT_FREP_MINUS, |
201 }; | 201 }; |
202 | 202 |
203 int Measuring_1 = N_MEASUREMENT_NONE; | 203 int Measuring_1 = N_MEASUREMENT_NONE; |
204 int Measuring_2 = N_MEASUREMENT_NONE; | 204 int Measuring_2 = N_MEASUREMENT_NONE; |
205 int Measuring_3 = N_MEASUREMENT_NONE; | 205 int Measuring_3 = N_MEASUREMENT_NONE; |
206 | 206 |
207 int nobs = 0; | 207 int nobs = 0; |
208 int settling = 0; | 208 int settling = 0; |
209 | 209 |
357 | 357 |
358 | 358 |
359 static struct datalogger datalogger; | 359 static struct datalogger datalogger; |
360 | 360 |
361 | 361 |
362 void * muParserNew() | 362 static void onerror(int level, const char *msg) |
363 { | |
364 SetCtrlVal(MainPanel, PANEL_ERROR, 1); | |
365 } | |
366 | |
367 | |
368 static void * muParserNew() | |
363 { | 369 { |
364 void *parser = mupCreate(); | 370 void *parser = mupCreate(); |
365 | 371 |
366 mupDefineOprtChars(parser, "abcdefghijklmnopqrstuvwxyzµ" | 372 mupDefineOprtChars(parser, "abcdefghijklmnopqrstuvwxyzµ" |
367 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | 373 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
418 return -1; | 424 return -1; |
419 if ((EstimateNPanel = LoadPanel (MainPanel, "FXAnalyse.uir", ESTIMATEN)) < 0) | 425 if ((EstimateNPanel = LoadPanel (MainPanel, "FXAnalyse.uir", ESTIMATEN)) < 0) |
420 return -1; | 426 return -1; |
421 | 427 |
422 // logging | 428 // logging |
423 logger_init(); | 429 logger_init(&onerror); |
424 | 430 |
425 // load configuration file | 431 // load configuration file |
426 char path[MAX_PATHNAME_LEN]; | 432 char path[MAX_PATHNAME_LEN]; |
427 GetIniFilePath(path); | 433 GetIniFilePath(path); |
428 IniText configuration = Ini_New(TRUE); | 434 IniText configuration = Ini_New(TRUE); |
459 rv = Ini_GetDouble(configuration, "AD9912", "clock", &clock); | 465 rv = Ini_GetDouble(configuration, "AD9912", "clock", &clock); |
460 if (! rv) | 466 if (! rv) |
461 return -1; | 467 return -1; |
462 | 468 |
463 // initialize AD9912 DDS box | 469 // initialize AD9912 DDS box |
464 ad9912_init(&ad9912, host, clock); | 470 rv = ad9912_init(&ad9912, host, clock); |
471 if (rv) | |
472 logmessage(ERROR, "ad9912 init erorr=%d", -rv); | |
473 | |
465 GetCtrlVal(MainPanel, PANEL_DDS1, &frequency); | 474 GetCtrlVal(MainPanel, PANEL_DDS1, &frequency); |
466 ad9912_set_frequency_w(&ad9912, 0, frequency); | 475 ad9912_set_frequency_w(&ad9912, 0, frequency); |
467 GetCtrlVal(MainPanel, PANEL_DDS2, &frequency); | 476 GetCtrlVal(MainPanel, PANEL_DDS2, &frequency); |
468 ad9912_set_frequency_w(&ad9912, 1, frequency); | 477 ad9912_set_frequency_w(&ad9912, 1, frequency); |
469 GetCtrlVal(MainPanel, PANEL_DDS3, &frequency); | 478 GetCtrlVal(MainPanel, PANEL_DDS3, &frequency); |
1977 { | 1986 { |
1978 int visible; | 1987 int visible; |
1979 switch (event) | 1988 switch (event) |
1980 { | 1989 { |
1981 case EVENT_COMMIT: | 1990 case EVENT_COMMIT: |
1982 GetCtrlVal(panel, PANEL_SHOWLOG, &visible); | 1991 GetCtrlVal(panel, control, &visible); |
1983 logger_panel_visible(visible); | 1992 logger_panel_visible(visible); |
1993 break; | |
1994 } | |
1995 return 0; | |
1996 } | |
1997 | |
1998 int CVICALLBACK CB_ShowError (int panel, int control, int event, | |
1999 void *callbackData, int eventData1, int eventData2) | |
2000 { | |
2001 switch (event) | |
2002 { | |
2003 case EVENT_COMMIT: | |
2004 logger_panel_visible(TRUE); | |
2005 SetCtrlVal(panel, control, FALSE); | |
2006 SetCtrlVal(panel, PANEL_SHOWLOG, TRUE); | |
1984 break; | 2007 break; |
1985 } | 2008 } |
1986 return 0; | 2009 return 0; |
1987 } | 2010 } |
1988 | 2011 |