/* ************************************************************** */ /* * Module GAPUI * This module contains functions for the gap measurements * user interface. * * Zachary Wolf * 5/25/00 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "gap vs z uir.h" #include "gap vs z ui.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int gap_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONS */ void gapui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * gapui_init * This function initializes the user interface for the Gap vs Z system. * * Input: * top_pos, vertical position of top left panel corner in screen coordinates * left_pos, horizontal position of top left panel corner in screen coordinates * * Zachary Wolf * 5/25/00 */ void gapui_init(int top_pos, int left_pos) { /* Open the Gap panel */ gap_panel = LoadPanel(0, "gap vs z uir.uir", GAPPAN); if (gap_panel < 0) { gapui_error("Could not open user interface panel"); return; } /* Set the panel position */ SetPanelPos(gap_panel, top_pos, left_pos); /* Display the panel */ DisplayPanel(gap_panel); /* Done */ return; } /* ************************************************************** */ /* * gapui_scale_horiz_axis * This function sets the scale on the horizontal axis of the * Bhall vs Z graph. * * Input: * num_z_pos, number of z positions * z_pos[0 to num_z_pos - 1], z positions * * Zachary Wolf * 5/25/00 */ void gapui_scale_horiz_axis(int num_z_pos, double z_pos[]) { /* Declare variables */ double z_min, z_max; int min_index, max_index; /* Determine the minimum and maximum z positions */ MaxMin1D(z_pos, num_z_pos, &z_max, &max_index, &z_min, &min_index); z_min = 0.; z_max = ceil(z_max); /* Set the horizontal scale of the Gap vs Z plots */ SetAxisRange(gap_panel, GAPPAN_GRAPH_V_VS_Z, VAL_MANUAL, z_min, z_max, VAL_AUTOSCALE, 0., 0.); SetAxisRange(gap_panel, GAPPAN_GRAPH_D_VS_Z, VAL_MANUAL, z_min, z_max, VAL_AUTOSCALE, 0., 0.); SetAxisRange(gap_panel, GAPPAN_GRAPH_H_VS_Z, VAL_MANUAL, z_min, z_max, VAL_AUTOSCALE, 0., 0.); SetAxisRange(gap_panel, GAPPAN_GRAPH_R_VS_Z, VAL_MANUAL, z_min, z_max, VAL_AUTOSCALE, 0., 0.); SetAxisRange(gap_panel, GAPPAN_GRAPH_X_VS_Z, VAL_MANUAL, z_min, z_max, VAL_AUTOSCALE, 0., 0.); /* Done */ return; } /* ************************************************************** */ void gapui_update_meas(double z, double v[], double d[], double height, double roll, double x) { /* Include parameter definitions */ #include "param.h" /* Plot the sensor voltages */ PlotPoint(gap_panel, GAPPAN_GRAPH_V_VS_Z, z, v[INDEX_UI], VAL_SMALL_SOLID_SQUARE, VAL_RED); PlotPoint(gap_panel, GAPPAN_GRAPH_V_VS_Z, z, v[INDEX_UO], VAL_SMALL_SOLID_SQUARE, VAL_GREEN); PlotPoint(gap_panel, GAPPAN_GRAPH_V_VS_Z, z, v[INDEX_LI], VAL_SMALL_SOLID_SQUARE, VAL_BLUE); PlotPoint(gap_panel, GAPPAN_GRAPH_V_VS_Z, z, v[INDEX_LO], VAL_SMALL_SOLID_SQUARE, VAL_CYAN); PlotPoint(gap_panel, GAPPAN_GRAPH_V_VS_Z, z, v[INDEX_UF], VAL_SMALL_SOLID_SQUARE, VAL_MAGENTA); PlotPoint(gap_panel, GAPPAN_GRAPH_V_VS_Z, z, v[INDEX_LF], VAL_SMALL_SOLID_SQUARE, VAL_YELLOW); PlotPoint(gap_panel, GAPPAN_GRAPH_V_VS_Z, z, v[INDEX_TILT], VAL_SMALL_SOLID_SQUARE, VAL_DK_RED); /* Plot the sensor distances */ PlotPoint(gap_panel, GAPPAN_GRAPH_D_VS_Z, z, d[INDEX_UI]*1000., VAL_SMALL_SOLID_SQUARE, VAL_RED); PlotPoint(gap_panel, GAPPAN_GRAPH_D_VS_Z, z, d[INDEX_UO]*1000., VAL_SMALL_SOLID_SQUARE, VAL_GREEN); PlotPoint(gap_panel, GAPPAN_GRAPH_D_VS_Z, z, d[INDEX_LI]*1000., VAL_SMALL_SOLID_SQUARE, VAL_BLUE); PlotPoint(gap_panel, GAPPAN_GRAPH_D_VS_Z, z, d[INDEX_LO]*1000., VAL_SMALL_SOLID_SQUARE, VAL_CYAN); PlotPoint(gap_panel, GAPPAN_GRAPH_D_VS_Z, z, d[INDEX_UF]*1000., VAL_SMALL_SOLID_SQUARE, VAL_MAGENTA); PlotPoint(gap_panel, GAPPAN_GRAPH_D_VS_Z, z, d[INDEX_LF]*1000., VAL_SMALL_SOLID_SQUARE, VAL_YELLOW); //PlotPoint(gap_panel, GAPPAN_GRAPH_V_VS_Z, z, d[INDEX_TILT], VAL_SMALL_SOLID_SQUARE, VAL_DK_RED); /* Plot the magnet height */ PlotPoint(gap_panel, GAPPAN_GRAPH_H_VS_Z, z, height*1000., VAL_SMALL_SOLID_SQUARE, VAL_RED); /* Plot the magnet roll */ PlotPoint(gap_panel, GAPPAN_GRAPH_R_VS_Z, z, roll*1000., VAL_SMALL_SOLID_SQUARE, VAL_RED); /* Plot the magnet x */ PlotPoint(gap_panel, GAPPAN_GRAPH_X_VS_Z, z, x*1000., VAL_SMALL_SOLID_SQUARE, VAL_RED); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * gapui_error * This function handles error messages for the BLwire user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 9/18/98 */ void gapui_error(char* message) { /* Declare variables */ char buf[80]; /* Notify the operator of the error */ printf("\nGAPUI 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); }