diff options
-rw-r--r-- | device-functions.c | 78 | ||||
-rw-r--r-- | error_utils.c | 2 | ||||
-rw-r--r-- | globals.h | 15 | ||||
-rw-r--r-- | instr-daemon.c | 3 | ||||
-rw-r--r-- | menus.c | 137 | ||||
-rw-r--r-- | menus.h | 1 |
6 files changed, 32 insertions, 204 deletions
diff --git a/device-functions.c b/device-functions.c index dd17ecd..3e8c6cf 100644 --- a/device-functions.c +++ b/device-functions.c @@ -118,7 +118,6 @@ void Main_Rst (void) // establishes min/max values for queries, but reports no errors Error_check(globals.ChannelState); - globals.Changes.update_whole_main_menu=YES; Ctrl_PRF_Limiter(1); @@ -444,10 +443,6 @@ int Set_Pw(int check_possible_only,int word_override,int range_override,int chan set_dac(globals.Flash.monocycle_dac[0],word_out); } - if (set_pw!=globals.ChannelState[channel].pw) { - globals.Changes.update_pw=YES; - } - globals.ChannelState[channel].pw=set_pw; Set_Update_Chans(); @@ -628,10 +623,6 @@ int Set_frequency(int check_possible_only,int word_override,int range_override,i globals.Registers.shift_reg_out[2] = ((long)(globals.Registers.shift_reg_out[2] & 0xfff00)) | ((long)cap_range_control); /* bottom 8 bits of 20 bits */ } - if (set_freq!=globals.ChannelState[channel].frequency) { - globals.Changes.update_freq=YES; - } - g_print_debug("freq range %d, word %d\n",relay_range,word_out); globals.ChannelState[channel].frequency=set_freq; @@ -726,10 +717,6 @@ int Set_Delay(int check_possible_only,int word_override,int range_override,int c control_pcb107(Second_Dly_Port,globals.Flash.delay_dac[channel],word_out,relay_range); } - if (set_delay!=globals.ChannelState[channel].delay) { - globals.Changes.update_delay=YES; - } - globals.ChannelState[channel].delay=set_delay; Set_Update_Chans(); @@ -761,10 +748,6 @@ int Set_Double(int channel,int new_setting) globals.Registers.shift_reg_out[0] |= 0x20; /* turn double-pulse on */ } - if (globals.ChannelState[channel].double_pulse!=new_setting) { - globals.Changes.update_delay=YES; - } - globals.ChannelState[channel].double_pulse=new_setting; Set_Update_Chans(); @@ -849,8 +832,6 @@ int Set_Func(int channel,int mode) globals.Registers.shift_reg_out[2] = ((long) (globals.Registers.shift_reg_out[2] & 0xbffff)) | (long) (((long) (mode & 0x08)) << (globals.Flash.ext_amplify_xtra_rly[channel]+11)); - - globals.Changes.update_func=YES; } @@ -892,10 +873,6 @@ int Set_Pol(int channel,int mode) return error_num; } - if (globals.ChannelState[channel].polarity!=mode) { - globals.Changes.update_inv=YES; - } - globals.ChannelState[channel].polarity=mode; Set_Mux(channel); @@ -912,10 +889,6 @@ int Set_Hold(int channel,int mode) return InvalidChannel; } - if (globals.ChannelState[channel].hold_setting!=mode) { - globals.Changes.update_pw=YES; - } - globals.ChannelState[channel].hold_setting=mode; Set_Update_Chans(); @@ -963,10 +936,6 @@ int Set_Output_State(int channel,int mode) globals.Timers.last_activity_at[channel] = 0L; } - if (globals.ChannelState[channel].output_state!=mode) { - globals.Changes.update_output=YES; - } - globals.ChannelState[channel].output_state=mode; Set_Update_Chans(); @@ -1018,8 +987,6 @@ int Set_Trig_Source(int channel,int mode) Set_frequency(0,0,0,channel,use_freq); Set_Pwmode(channel,use_ab_mode); } - - globals.Changes.update_freq=YES; } globals.ChannelState[channel].trigger_source=mode; @@ -1081,10 +1048,6 @@ int Set_Gate_Sync(int channel,int mode) globals.Registers.shift_reg_out[0] = (globals.Registers.shift_reg_out[0] & 0xfe) | 1; } - if (globals.ChannelState[channel].gate_type!=mode) { - globals.Changes.update_gate=YES; - } - globals.ChannelState[channel].gate_type=mode; Set_Update_Chans(); @@ -1105,10 +1068,6 @@ int Set_Gate_Level(int channel,int mode) globals.Registers.shift_reg_out[0] = (globals.Registers.shift_reg_out[0] & 0xfd) | 0; } - if (globals.ChannelState[channel].gate_level!=mode) { - globals.Changes.update_gate=YES; - } - globals.ChannelState[channel].gate_level=mode; Set_Update_Chans(); @@ -1351,10 +1310,6 @@ int Set_Pwmode(int channel,int mode) return AB_Mode_Error; } - if (globals.ChannelState[channel].ab_mode!=mode) { - globals.Changes.update_pw=YES; - } - globals.ChannelState[channel].ab_mode=mode; Set_Mux(0); @@ -1566,11 +1521,6 @@ int Set_Logic_Level(int channel,int mode) } } - - if (globals.ChannelState[channel].logic_level!=mode) { - globals.Changes.update_logic_level=YES; - } - globals.ChannelState[channel].logic_level=mode; Set_Update_Chans(); @@ -1689,7 +1639,6 @@ int Set_Route(int channel, int module, int mode) } if (mode!=globals.ChannelState[channel].route_primary) { - globals.Changes.update_routes=YES; globals.ChannelState[channel].route_primary=mode; } } @@ -1701,7 +1650,6 @@ int Set_Route(int channel, int module, int mode) } if (mode!=globals.ChannelState[channel].route_secondary) { - globals.Changes.update_routes=YES; globals.ChannelState[channel].route_secondary=mode; } } @@ -3366,11 +3314,6 @@ int Set_Burst_Count(int channel,int count,float new_burst_time) return check_valid; } - /* update variables if OK */ - if (count!=globals.ChannelState[channel].burst_count) { - globals.Changes.update_burst_count=YES; - } - globals.ChannelState[channel].burst_count = count; Set_Update_Chans(); @@ -3496,11 +3439,6 @@ int Set_Burst_Time(int check_possible_only,int word_override,int range_override, globals.Registers.last_relay_driver_settings[2] = relay_range; - /* update variables if OK */ - if (new_burst_time!=globals.ChannelState[channel].burst_time) { - globals.Changes.update_burst_time=YES; - } - globals.ChannelState[channel].burst_time = new_burst_time; Set_Update_Chans(); @@ -3631,11 +3569,6 @@ int Set_rise_time(int check_possible_only,int word_override,int range_override,i } } - /* update variables if OK */ - if (new_rise_time!=globals.ChannelState[channel].rise_time) { - globals.Changes.update_rise_time=YES; - } - globals.ChannelState[channel].rise_time = new_rise_time; globals.Registers.last_rise_time_relay_setting = range_control; @@ -3683,11 +3616,6 @@ int Set_current_limit(int check_possible_only,int channel,float new_adj_current_ word_out = (int) ( ((float) dac_max) * (limit/globals.Flash.current_limit_full_scale[channel]) ); set_dac(globals.Flash.current_limit_dac[channel],word_out); - /* update variables if OK */ - if (limit!=globals.ChannelState[channel].soft_current_limit) { - globals.Changes.update_soft_current_limit=YES; - } - globals.ChannelState[channel].soft_current_limit=limit; return OK; @@ -3837,11 +3765,6 @@ int Set_slew(int check_possible_only,int word_override,int range_override,int ch I2C_Write(PCF8574,range_control); - /* update variables if OK */ - if (new_slew!=globals.ChannelState[channel].slew) { - globals.Changes.update_slew=YES; - } - globals.ChannelState[channel].slew = new_slew; Set_Update_Chans(); @@ -4451,7 +4374,6 @@ void Set_Rcl(int setting_num) Menu_Clear_Buttons(); globals.Flags.do_check_settings=YES; /* check for conflicting settings */ - globals.Changes.update_whole_main_menu=YES; Error_check(globals.ChannelState); /* establishes min/max values for queries, but reports no errors */ diff --git a/error_utils.c b/error_utils.c index 8681808..c87c0e7 100644 --- a/error_utils.c +++ b/error_utils.c @@ -116,7 +116,7 @@ void queue_error_from_parser(gchar** response, int error_num) } queue_error_and_get_text(response, error_num); - Menu_Refresh(); + Show_Main_Menu(); return; } @@ -297,25 +297,10 @@ typedef struct { typedef struct { - int update_freq; - int update_func; - int update_delay; - int update_pw; int update_amp; int update_os; int update_zout; int update_load; - int update_output; - int update_inv; - int update_gate; - int update_logic_level; - int update_routes; - int update_burst_count; - int update_burst_time; - int update_rise_time; - int update_soft_current_limit; - int update_slew; - int update_whole_main_menu; } ChangeStruct; diff --git a/instr-daemon.c b/instr-daemon.c index 7943ae1..ffd7153 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -345,11 +345,12 @@ static gboolean periodic_poll (void) GPIB_check_for_device_clear_signal(); if (GPIB_check_for_messages(globals.Registers.gpib_buffer)) { if (GPIB_handle_new_input(globals.Registers.gpib_buffer)) { - // FIXME check_for_ctrl_mode_changes(); Parser_main(globals.Registers.gpib_buffer, 0, NULL, NULL); } } GPIB_check_for_device_clear_signal(); + + Update_Main_Menu_If_Visible(); return TRUE; } @@ -216,13 +216,6 @@ static void Nonstd_menu_network(void); static void Read_Keypad(int *button_port_val, int *upper_encoder_val, int *lower_encoder_val); -void Menu_Refresh() -{ - globals.Changes.update_whole_main_menu = YES; - Show_Main_Menu(); -} - - 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)); @@ -254,7 +247,6 @@ void Show_Main_Menu(void) (globals.MenuStatus.Error_Screen == YES) || (globals.MenuStatus.Nonstd_Display == YES) ) { LCD_clear(); - globals.Changes.update_whole_main_menu = TRUE; } LCD_entry=-1; @@ -308,9 +300,6 @@ void Show_Main_Menu(void) for (chan=0; chan<(globals.Flash.ChanKey_frequency?globals.Flash.channels:1); ++chan) { if (globals.ChannelState[chan].func_mode!=amp_mode_on) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_freq+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_freq+chan; /* keep track of what is displayed */ LCD_row=LCD_entry % LCD_rows; /* find next available row */ LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; /* find next available column */ @@ -338,7 +327,7 @@ void Show_Main_Menu(void) strcat(a_string,":"); } - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_freq) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig,LCD_col_width-1); } } @@ -347,9 +336,6 @@ void Show_Main_Menu(void) for (chan=0; chan<(globals.Flash.ChanKey_func_mode?globals.Flash.channels:1); ++chan) { if (globals.Flash.is_func_gen[chan]) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_func+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_func+chan; /* keep track of what is displayed */ LCD_row=LCD_entry % LCD_rows; /* find next available row */ LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; /* find next available column */ @@ -373,7 +359,7 @@ void Show_Main_Menu(void) strcat(a_string,b_string); } - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_func) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig,LCD_col_width-1); } } @@ -386,9 +372,6 @@ void Show_Main_Menu(void) || (globals.ChannelState[chan].func_mode==dc_mode_on)) ) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_delay+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_delay+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -404,7 +387,7 @@ void Show_Main_Menu(void) } strcat(a_string,":"); - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_delay) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,Show_delay+chan,sig_dig-globals.Flash.ChanKey_delay,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,Show_delay+chan,sig_dig-globals.Flash.ChanKey_delay,LCD_col_width-1); } @@ -418,9 +401,6 @@ void Show_Main_Menu(void) ) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_pw+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_pw+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -462,7 +442,7 @@ void Show_Main_Menu(void) } strcat(a_string,": DC"); } - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_pw) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_pw,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_pw,LCD_col_width-1); } } @@ -477,9 +457,6 @@ void Show_Main_Menu(void) ) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_rise_time+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_rise_time+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -491,7 +468,7 @@ void Show_Main_Menu(void) strcat(a_string,b_string); } strcat(a_string,":"); - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_rise_time) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_rise_time,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_rise_time,LCD_col_width-1); } } @@ -501,9 +478,6 @@ void Show_Main_Menu(void) for (chan=0; chan<(globals.Flash.ChanKey_amplitude?globals.Flash.channels:1); ++chan) { if ((globals.Flash.voltage_enabled[chan] || globals.Flash.current_enabled[chan]) ) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_amp+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_amp+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -533,7 +507,7 @@ void Show_Main_Menu(void) } strcat(a_string,":AMPLFY"); } - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_amp) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_amplitude,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_amplitude,LCD_col_width-1); } } @@ -543,9 +517,6 @@ void Show_Main_Menu(void) if (globals.Flash.enable_avrq_extra_ampls) { for (chan=2; chan<5; ++chan) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_avrq+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_avrq+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -555,7 +526,7 @@ void Show_Main_Menu(void) sprintf(b_string, "%d", chan+1); strcat(a_string,b_string); strcat(a_string,":"); - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_amp) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-1,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-1,LCD_col_width-1); } } @@ -565,9 +536,6 @@ void Show_Main_Menu(void) if (globals.Flash.soft_current_limit_enabled[chan]) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_soft_current_limit+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_soft_current_limit+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -579,7 +547,7 @@ void Show_Main_Menu(void) strcat(a_string,b_string); } strcat(a_string,":"); - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_soft_current_limit) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_current_limit,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_current_limit,LCD_col_width-1); } } @@ -591,9 +559,6 @@ void Show_Main_Menu(void) if ( globals.Flash.curr_slew[chan] ) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_slew+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_slew+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -605,7 +570,7 @@ void Show_Main_Menu(void) strcat(a_string,b_string); } strcat(a_string,":"); - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_slew) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_slew,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_slew,LCD_col_width-1); } } @@ -616,9 +581,6 @@ void Show_Main_Menu(void) if (globals.Flash.max_burst_count[chan]>1) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_burst_count+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_burst_count+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -630,7 +592,7 @@ void Show_Main_Menu(void) strcat(a_string,b_string); } strcat(a_string,":"); - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_burst_count) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,0,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,0,LCD_col_width-1); } } @@ -642,9 +604,6 @@ void Show_Main_Menu(void) if ((globals.Flash.max_burst_count[chan]>1) && !globals.Flash.burst_func[chan]) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_burst_time+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_burst_time+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -656,7 +615,7 @@ void Show_Main_Menu(void) strcat(a_string,b_string); } strcat(a_string,":"); - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_burst_time) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_Burst_Time,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_Burst_Time,LCD_col_width-1); } } @@ -668,9 +627,6 @@ void Show_Main_Menu(void) if ((globals.Flash.voltage_offset_enabled[chan] || globals.Flash.current_offset_enabled[chan]) && (globals.ChannelState[chan].amp_mode!=amp_mode_amplify)) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_offset+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_offset+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -693,7 +649,7 @@ void Show_Main_Menu(void) } strcat(a_string,":EXT"); } - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_os) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_offset,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_offset,LCD_col_width-1); } } @@ -724,9 +680,6 @@ void Show_Main_Menu(void) for (chan=0; chan<(globals.Flash.ChanKey_zout?globals.Flash.channels:1); ++chan) { if (globals.Flash.switchable_zout[chan] && !globals.Flash.volt_ctrl_pw[chan]) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_zout+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_zout+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -748,7 +701,7 @@ void Show_Main_Menu(void) } g_free (temp); - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_zout) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,Show_No_Number,sig_dig-globals.Flash.ChanKey_zout,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,Show_No_Number,sig_dig-globals.Flash.ChanKey_zout,LCD_col_width-1); } } @@ -757,9 +710,6 @@ void Show_Main_Menu(void) for (chan=0; chan<(globals.Flash.ChanKey_load_type?globals.Flash.channels:1); ++chan) { if (globals.Flash.switchable_load[chan]) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_loadtype+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_loadtype+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -771,7 +721,7 @@ void Show_Main_Menu(void) strcat(a_string,b_string); } strcat(a_string,":"); - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_load) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_load_type,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,sig_dig-globals.Flash.ChanKey_load_type,LCD_col_width-1); } } @@ -781,9 +731,6 @@ void Show_Main_Menu(void) if (globals.Flash.on_off_used) for (chan=0; chan<(globals.Flash.ChanKey_output_state?globals.Flash.channels:1); ++chan) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_output_state+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_output_state+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -802,7 +749,7 @@ void Show_Main_Menu(void) strcat(a_string,"OFF"); } - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_output) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,Show_No_Number,sig_dig-globals.Flash.ChanKey_output_state,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,Show_No_Number,sig_dig-globals.Flash.ChanKey_output_state,LCD_col_width-1); } /*----- display primary routing, as appropriate -----*/ @@ -811,9 +758,6 @@ void Show_Main_Menu(void) if (globals.Flash.routing_required[chan] > 0) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_route_primary+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_route_primary+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -831,7 +775,7 @@ void Show_Main_Menu(void) strcat(a_string,b_string); } strcat(a_string,":"); - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_routes) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,0,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,0,LCD_col_width-1); } } @@ -842,9 +786,6 @@ void Show_Main_Menu(void) if (globals.Flash.routing_required[chan] == 2) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_route_secondary+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_route_secondary+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -858,7 +799,7 @@ void Show_Main_Menu(void) strcat(a_string,b_string); } strcat(a_string,":"); - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_routes) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,0,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,0,LCD_col_width-1); } } @@ -868,9 +809,6 @@ void Show_Main_Menu(void) for (chan=0; chan<(globals.Flash.ChanKey_polarity?globals.Flash.channels:1); ++chan) { if (globals.Flash.invert_allowed[chan]) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_invert+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_invert+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -888,7 +826,7 @@ void Show_Main_Menu(void) strcat(a_string,"YES"); } - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_inv) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,Show_No_Number,sig_dig-globals.Flash.ChanKey_polarity,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,Show_No_Number,sig_dig-globals.Flash.ChanKey_polarity,LCD_col_width-1); } } @@ -897,9 +835,6 @@ void Show_Main_Menu(void) if (globals.Flash.logic_level_enabled) { for (chan=0; chan<(globals.Flash.ChanKey_logic_level?globals.Flash.channels:1); ++chan) { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_logic_level+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_logic_level+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -916,7 +851,7 @@ void Show_Main_Menu(void) strcat(a_string,"ECL"); } - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_logic_level) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,Show_No_Number,sig_dig-globals.Flash.ChanKey_logic_level,LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,Show_No_Number,sig_dig-globals.Flash.ChanKey_logic_level,LCD_col_width-1); } } @@ -927,9 +862,6 @@ void Show_Main_Menu(void) if (!globals.Flash.is_func_gen[chan]) { { ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_gate+chan) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_gate+chan; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -951,16 +883,13 @@ void Show_Main_Menu(void) strcat(a_string,"ASY,HI"); } - Display_Number_on_LCD((globals.Changes.update_whole_main_menu || globals.Changes.update_gate) && Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,Show_No_Number, sig_dig-(globals.Flash.ChanKey_gate_level | globals.Flash.ChanKey_gate_type),LCD_col_width-1); + Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,Show_No_Number, sig_dig-(globals.Flash.ChanKey_gate_level | globals.Flash.ChanKey_gate_type),LCD_col_width-1); } } /*----- display remote/local, always -----*/ ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_rem_loc) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_rem_loc; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; @@ -996,7 +925,7 @@ void Show_Main_Menu(void) } printf ("control mode: %s\n", ctrl_str); // FIXME - delete - if (globals.Changes.update_whole_main_menu && Menu_Is_Item_Visible(LCD_entry)) { + if (Menu_Is_Item_Visible(LCD_entry)) { LCD_write_padded_spaces(LCD_row,LCD_col,ctrl_str,LCD_col_width); } @@ -1005,14 +934,11 @@ void Show_Main_Menu(void) /*----- display memory, always -----*/ ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_memory) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_memory; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; - if (globals.Changes.update_whole_main_menu && Menu_Is_Item_Visible(LCD_entry)) { + if (Menu_Is_Item_Visible(LCD_entry)) { LCD_write_padded_spaces(LCD_row,LCD_col,"Memory menu",LCD_col_width); } @@ -1020,14 +946,11 @@ void Show_Main_Menu(void) /*----- display setup, always -----*/ ++LCD_entry; - if (Main_Menu_Structure[LCD_entry]!=Submenu1_setup) { - globals.Changes.update_whole_main_menu=YES; - } Main_Menu_Structure[LCD_entry]=Submenu1_setup; LCD_row=LCD_entry % LCD_rows; LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1; - if (globals.Changes.update_whole_main_menu && Menu_Is_Item_Visible(LCD_entry)) { + if (Menu_Is_Item_Visible(LCD_entry)) { LCD_write_padded_spaces(LCD_row,LCD_col,"Setup menu",LCD_col_width); } @@ -1058,8 +981,6 @@ void Show_Main_Menu(void) LCD_col=(i / LCD_rows) * LCD_col_width + 1; LCD_write_padded_spaces(LCD_row,LCD_col,"",LCD_col_width); } - - globals.Changes.update_whole_main_menu=NO; } @@ -1112,7 +1033,7 @@ static void Menu_Move_Pointer(int move_amount) new_page=menu_cursor_pos / LCD_max_entries_per_page; if (new_page!=old_page) { - Menu_Refresh(); + Show_Main_Menu(); } } @@ -1120,6 +1041,11 @@ 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) { + + if (!Is_Item_Visible) { + return; + } + gchar *units = NULL; int channel; @@ -1270,10 +1196,6 @@ static void Display_Number_on_LCD(int Is_Item_Visible,int LCD_row,int LCD_col,ch strcpy(LCD_string,start_string); } - if (Is_Item_Visible) { - LCD_write_padded_spaces(LCD_row, LCD_col, LCD_string, width_of_column); - } - g_free (units); } @@ -3327,7 +3249,6 @@ static int Submenu_Implement_Changes(void) Main_update_shift_registers(); /* update values in pulse generator circuit */ if (call_new_submenu==NO) { - globals.Changes.update_whole_main_menu=YES; Show_Main_Menu(); } @@ -1,6 +1,5 @@ #include <glib.h> -void Menu_Refresh(); void Update_Main_Menu_If_Visible(void); void Show_Main_Menu(void); void Menu_Clear_Buttons(void); |