/* ************************************************************** */ /* * Module MF10DUI * This module contains functions for the Metrolab MF10D * user interface. * * Zachary Wolf * 9/6/98 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "mf10duir.h" #include "mf10dui.h" #include "mf10d.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int mf10d_ID; static int mf10d_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void mf10dui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * mf10dui_init * This function initializes the user interface for the MF10D. * * Input: * ID, MF10D device identifier * * Zachary Wolf * 9/6/98 */ void mf10dui_init(int ID) { /* Save the device ID */ mf10d_ID = ID; /* Open the MF10D panel */ mf10d_panel = LoadPanel(0, "mf10duir.uir", MF10DPAN); if (mf10d_panel < 0) { mf10dui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(mf10d_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * mf10dui_error * This function handles error messages for the MF10D user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 8/26/98 */ void mf10dui_error(char* message) { /* Declare variables */ char buf[80]; /* Notify the operator of the error */ printf("\nMF10DUI ERROR: %s\n", message); Beep(); Delay(.5); Beep(); /* Terminate the program if the operator desires */ printf("Press ENTER to continue.\nPress any key then ENTER to terminate program.\n"); fgets(buf, 80, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK mf10dui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: mf10d_exit(mf10d_ID); QuitUserInterface(0); break; } return 0; } /* ************************************************************** */ int CVICALLBACK mf10dui_get_VT_timer(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { char chan_string[2]; char chan; int gain; double delta_t_samp; int num_samp; double vt[5000]; double vt_time[5000]; double integrated_voltage; int i; switch (event) { case EVENT_COMMIT: GetCtrlVal(panel, MF10DPAN_STR_INT_CHAN, chan_string); chan = chan_string[0]; GetCtrlVal(panel, MF10DPAN_NUM_GAIN, &gain); GetCtrlVal(panel, MF10DPAN_NUM_TIME_BETWEEN_SAMP, &delta_t_samp); GetCtrlVal(panel, MF10DPAN_NUM_NUM_SAMPLES, &num_samp); //mf10d_get_VT_timer(mf10d_ID, chan, gain, delta_t_samp, // num_samp, vt); //integrated_voltage = vt[num_samp]; //SetCtrlVal(panel, MF10DPAN_NUM_INTEGRATED_VOLTAG, // integrated_voltage); //DeleteGraphPlot(panel, MF10DPAN_GRAPH_VT_SAMP, -1, VAL_IMMEDIATE_DRAW); //for (i = 0; i <= num_samp; i++) vt_time[i] = i * delta_t_samp; //PlotXY(panel, MF10DPAN_GRAPH_VT_SAMP, vt_time, vt, num_samp + 1, // VAL_DOUBLE, VAL_DOUBLE, VAL_THIN_LINE, VAL_SOLID_CIRCLE, // VAL_SOLID, 1, VAL_RED); break; } return 0; }