From 72b80d3dc84988f8a934395e07e174418a66457f Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Sat, 13 Oct 2012 09:05:22 -0400 Subject: started fixing control mode handling --- menus.c | 54 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 15 deletions(-) (limited to 'menus.c') diff --git a/menus.c b/menus.c index fce9623..3e57ab5 100644 --- a/menus.c +++ b/menus.c @@ -256,6 +256,26 @@ void Menu_Update_Display(void) globals.MenuStatus.Error_Screen=NO; globals.MenuStatus.Nonstd_Display=NO; + int is_remote, is_lockout; + GPIB_check_remote_status (&is_remote, &is_lockout); + +#define RM_NOT_LOCK 0 +#define RM_NOT_REM 0 +#define RM_NOT_TERM 0 +#define RM_LOCK 1 +#define RM_REM 2 +#define RM_TERM 4 + + int remote_mode = 0; + if (is_lockout) { + remote_mode += RM_LOCK; + } + if (is_remote) { + remote_mode += RM_REM; + } + if (globals.Remote.connections > 0) { + remote_mode += RM_TERM; + } /* fill in unused cursor columns */ for (i=0; i<(menu_cursor_pos % LCD_max_entries_per_page); ++i) { @@ -938,30 +958,34 @@ void Menu_Update_Display(void) gchar *ctrl_str = NULL; - switch (globals.control_mode) { - case REMS_ctrl: - ctrl_str = g_strdup ("GPIB CTRL"); + +//FIXME delete all refs to globals.control_mode + switch (remote_mode) { + case (RM_NOT_TERM | RM_NOT_REM | RM_NOT_LOCK): + case (RM_NOT_TERM | RM_NOT_REM | RM_LOCK): + ctrl_str = g_strdup ("LOCAL"); break; - case RWLS_ctrl: - ctrl_str = g_strdup ("GPIB LOCK"); + case (RM_NOT_TERM | RM_REM | RM_NOT_LOCK): + ctrl_str = g_strdup ("LOCAL+GPIB"); break; - case RS232_ctrl: - ctrl_str = g_strdup ("RS232 CTRL"); + case (RM_NOT_TERM | RM_REM | RM_LOCK): + ctrl_str = g_strdup ("GPIB"); break; - case WEB_ctrl: - ctrl_str = g_strdup ("WEB CTRL"); + case (RM_TERM | RM_NOT_REM | RM_NOT_LOCK): + case (RM_TERM | RM_NOT_REM | RM_LOCK): + ctrl_str = g_strdup_printf ("LOCAL+%dTER", globals.Remote.connections); break; - case TELNET_ctrl: - ctrl_str = g_strdup ("TELNET CTRL"); + case (RM_TERM | RM_REM | RM_NOT_LOCK): + ctrl_str = g_strdup_printf ("LO+GPIB+%dTER", globals.Remote.connections); break; - case LWLS_ctrl: - ctrl_str = g_strdup ("LOCAL LOCK"); + case (RM_TERM | RM_REM | RM_LOCK): + ctrl_str = g_strdup_printf ("GPIB+%dTER", globals.Remote.connections); break; - case LOCS_ctrl: default: - ctrl_str = g_strdup ("LOCAL CTRL"); + ctrl_str = g_strdup ("LOCAL"); break; } + printf ("control mode: %s\n", ctrl_str); // FIXME - delete if (globals.Changes.update_whole_main_menu && Menu_Is_Item_Visible(LCD_entry)) { LCD_write_padded_spaces(LCD_row,LCD_col,ctrl_str,LCD_col_width); -- cgit