diff options
author | root <root@avtech.domain.avtechpulse.com> | 1999-12-31 20:01:28 -0500 |
---|---|---|
committer | root <root@avtech.domain.avtechpulse.com> | 1999-12-31 20:01:28 -0500 |
commit | 9748bc5b219a973fe75dd01368a60ed24557d886 (patch) | |
tree | 16f3fd458ddf3f1a0a8ac57d14553fa8bc55db05 | |
parent | e1c46afc795176f55dcc680f5b29771e5f17b044 (diff) |
first full proper handling of local/remote control modes
-rw-r--r-- | dummy_functions.c | 2 | ||||
-rw-r--r-- | dummy_functions.h | 9 | ||||
-rw-r--r-- | globals.h | 2 | ||||
-rw-r--r-- | menus.c | 96 |
4 files changed, 55 insertions, 54 deletions
diff --git a/dummy_functions.c b/dummy_functions.c index 71d6b59..bb1e5ea 100644 --- a/dummy_functions.c +++ b/dummy_functions.c @@ -1,5 +1,3 @@ #include "dummy_functions.h" #include "globals.h" -void Main_return_to_local() {} - diff --git a/dummy_functions.h b/dummy_functions.h index 5f9ba2e..e69de29 100644 --- a/dummy_functions.h +++ b/dummy_functions.h @@ -1,9 +0,0 @@ -#ifndef DUMMY_FUNCTIONS_H_ -#define DUMMY_FUNCTIONS_H_ - -#include "globals.h" - -void Main_return_to_local(); - -#endif - @@ -771,6 +771,7 @@ typedef struct { typedef struct { int connections; + int mode; } RemoteStruct; @@ -786,7 +787,6 @@ typedef struct { TimeStruct Timers; MenuStatusStruct MenuStatus; RemoteStruct Remote; - int control_mode; // FIXME and all instances of control_mode } GlobalStruct; @@ -202,6 +202,7 @@ float Submenu_Value; /* actual value of the shown parameter (like frequency) int Submenu_extra_fine; /* is the extra-fine mode on? */ +static int update_remote_mode (); static int Menu_Is_Item_Visible(int LCD_entry); static void Menu_Move_Pointer(int move_amount); static void Display_Number_on_LCD(int Is_Item_Visible,int LCD_row,int LCD_col,char *start_string,int Show_What, int significant_digits, int width_of_column); @@ -216,6 +217,33 @@ static void Nonstd_menu_network(void); static void Read_Keypad(int *button_port_val, int *upper_encoder_val, int *lower_encoder_val); +#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 + + +static int update_remote_mode () +{ + int is_remote, is_lockout; + GPIB_check_remote_status (&is_remote, &is_lockout); + + globals.Remote.mode = 0; + if (is_lockout) { + globals.Remote.mode += RM_LOCK; + } + if (is_remote) { + globals.Remote.mode += RM_REM; + } + if (globals.Remote.connections > 0) { + globals.Remote.mode += RM_TERM; + } + +} + + static int Menu_Is_Item_Visible(int LCD_entry) { return ((LCD_entry/LCD_max_entries_per_page)==(menu_cursor_pos/LCD_max_entries_per_page)); @@ -257,26 +285,6 @@ void Show_Main_Menu(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) { @@ -896,9 +904,9 @@ void Show_Main_Menu(void) gchar *ctrl_str = NULL; + update_remote_mode(); -//FIXME delete all refs to globals.control_mode - switch (remote_mode) { + switch (globals.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"); @@ -1469,12 +1477,18 @@ static void Submenu_Display(int change_selection) break; - case Submenu1_rem_loc: - title = g_strdup ("Control Mode:"); - Submenu_max_entry=1; + case Submenu1_rem_loc: //0123456789012345678901234567890123456789 + title = g_strdup ("GPIB interface already in local mode."); - Submenu_Structure[0]=mode_go_to_local; - Submenu_Structure[1]=mode_exit_normal_submenu; + if (globals.Remote.mode == (RM_REM | RM_NOT_LOCK)) { + Submenu_max_entry=1; + title = g_strdup ("GPIB Remote:"); + Submenu_Structure[0]=mode_go_to_local; + Submenu_Structure[1]=mode_exit_normal_submenu; + } else { + Submenu_max_entry=0; + Submenu_Structure[0]=mode_exit_normal_submenu; + } break; case Submenu1_setup: @@ -2192,7 +2206,8 @@ static void Submenu_Service_Encoder(int encoder_change) reset_encoder=YES; /* quit if RWLS mode */ - if (globals.control_mode==RWLS_ctrl) { + update_remote_mode (); + if (globals.Remote.mode== (RM_REM | RM_LOCK)) { return; } @@ -2811,16 +2826,13 @@ void Menu_Check_Buttons(void) encoder_change = encoder_change - 0x100; } + update_remote_mode(); + if (!(button_port_val & Change_Button)) { /* ----- CHANGE BUTTON --------- */ - if ( globals.control_mode==LOCS_ctrl || globals.control_mode==LWLS_ctrl || - ( - ( globals.control_mode==REMS_ctrl - || globals.control_mode==RS232_ctrl - || globals.control_mode==WEB_ctrl - || globals.control_mode==TELNET_ctrl) - && globals.MenuStatus.Selected_Submenu==Submenu1_rem_loc - ) - ) { + if (globals.Remote.mode == (RM_REM | RM_LOCK)) { + // front panel is locked out + Show_Main_Menu(); + } else { if ((globals.MenuStatus.Type_Of_Menu==Main_Menu_On && globals.MenuStatus.Error_Screen==YES) || globals.MenuStatus.Nonstd_Display==YES) { Show_Main_Menu(); } else if (globals.MenuStatus.Type_Of_Menu==Submenu_On && globals.MenuStatus.Error_Screen==YES) { @@ -2842,21 +2854,21 @@ void Menu_Check_Buttons(void) Submenu_Move_Pointer(); } } else if (!(button_port_val & Mult10_Button)) { /* ----- X10 BUTTON ------------ */ - if (globals.MenuStatus.Type_Of_Menu==Submenu_On && (globals.control_mode==LOCS_ctrl || globals.control_mode==LWLS_ctrl)) { + if (globals.MenuStatus.Type_Of_Menu==Submenu_On && (globals.Remote.mode != (RM_REM | RM_LOCK))) { if (globals.MenuStatus.Error_Screen==YES) { Submenu_Display(NO); } queue_error_and_display_on_LCD(Submenu_Mult_Value(10.0)); } } else if (!(button_port_val & Div10_Button)) { /* ----- /10 BUTTON ------------ */ - if (globals.MenuStatus.Type_Of_Menu==Submenu_On && (globals.control_mode==LOCS_ctrl || globals.control_mode==LWLS_ctrl)) { + if (globals.MenuStatus.Type_Of_Menu==Submenu_On && (globals.Remote.mode != (RM_REM | RM_LOCK))) { if (globals.MenuStatus.Error_Screen==YES) { Submenu_Display(NO); } queue_error_and_display_on_LCD(Submenu_Mult_Value(0.1)); } } else if (!(button_port_val & Plus_Minus_Button)) { /* ----- +/- BUTTON ------------ */ - if (globals.MenuStatus.Type_Of_Menu==Submenu_On && (globals.control_mode==LOCS_ctrl || globals.control_mode==LWLS_ctrl)) { + if (globals.MenuStatus.Type_Of_Menu==Submenu_On && (globals.Remote.mode != (RM_REM | RM_LOCK))) { if (globals.MenuStatus.Error_Screen==YES) { Submenu_Display(NO); } @@ -2864,7 +2876,7 @@ void Menu_Check_Buttons(void) } } else if (!(button_port_val & Extra_Fine_Button)) { /* ----- EXTRA FINE BUTTON ----- */ if (globals.MenuStatus.Type_Of_Menu==Submenu_On && globals.MenuStatus.Nonstd_Display==NO && globals.MenuStatus.Error_Screen==NO && - (globals.control_mode==LOCS_ctrl || globals.control_mode==LWLS_ctrl)) { + (globals.Remote.mode != (RM_REM | RM_LOCK))) { if (Submenu_extra_fine==YES) { g_usleep (250e3); Submenu_extra_fine=NO; @@ -3019,7 +3031,7 @@ static int Submenu_Implement_Changes(void) } break; case mode_go_to_local: - Main_return_to_local(); + GPIB_go_to_local(); break; case mode_inv_no: if (error_num=Set_Pol(channel,pol_norm)) { |