From 6959b9dadb91c32c2582afe0b4abaa040af53504 Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Wed, 13 Aug 2014 15:43:49 -0400 Subject: first attempt at better AVRQ amplitude handling --- menus.c | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 145 insertions(+), 35 deletions(-) (limited to 'menus.c') diff --git a/menus.c b/menus.c index 9acdaeb..a98d9c9 100644 --- a/menus.c +++ b/menus.c @@ -115,8 +115,6 @@ #define mode_exit_rs232 5600 #define mode_logic_ttl 5700 #define mode_logic_ecl 5800 -#define mode_amp_min 5900 -#define mode_amp_max 6000 #define mode_os_normal 6300 #define mode_os_eo 6400 #define mode_amp_amplify 6500 @@ -133,8 +131,10 @@ #define mode_57600 7700 #define mode_115200 7800 #define mode_pw_ew 7900 +#define mode_ampl_fixed_points 8000 -#define Submenu_maximum_entries 10 /* used to be 4, before scrolling lists were added */ + +#define Submenu_maximum_entries 10 /* what parameter to adjust */ #define Show_frequency 0 @@ -1350,16 +1350,16 @@ static void Submenu_Display(int change_selection) title = g_strdup ("Amplitude:"); } - - if (globals.ChannelState[channel].amp_mode==amp_mode_normal && !globals.Flash.ampl_min_max_only[channel]) { + if (number_of_fixed_ampl_points(channel)>0) { + int fixed_count; + Submenu_max_entry = number_of_fixed_ampl_points(channel) - 1; + for (fixed_count = 0; fixed_count < number_of_fixed_ampl_points(channel); ++fixed_count) { + Submenu_Structure[i] = mode_ampl_fixed_points + fixed_count; + } + } else if (globals.ChannelState[channel].amp_mode==amp_mode_normal) { Submenu_Numeric_Parameter=Show_amplitude+channel; } - if (globals.Flash.ampl_min_max_only[channel]) { - Submenu_max_entry=1; - Submenu_Structure[0]=mode_amp_min; - Submenu_Structure[1]=mode_amp_max; - } if (globals.Flash.ea_enabled[channel]) { ++Submenu_max_entry; Submenu_Structure[0]=mode_amp_normal; @@ -1638,6 +1638,14 @@ static void Submenu_Display(int change_selection) for (i=0; i<=Submenu_max_entry; ++i) { gchar *mode_name; + gchar *fixed_ampl_units; + float use_ampl; + + if (globals.Flash.voltage_enabled[channel]) { + fixed_ampl_units = g_strdup("V"); + } else { + fixed_ampl_units = g_strdup("A"); + } switch (Submenu_Structure[i]-channel) { case mode_freq_int: @@ -1895,28 +1903,84 @@ static void Submenu_Display(int change_selection) current_operating_mode=i; } break; - case mode_amp_min: - if (globals.Flash.voltage_enabled[channel]) { - String_Parameter_To_Text(globals.Flash.min_ampl[channel],2,"","V",&mode_name,YES,LCD_col_width); - } else { - String_Parameter_To_Text(globals.Flash.min_ampl[channel],2,"","A",&mode_name,YES,LCD_col_width); - } - if (fabs(globals.ChannelState[channel].amplitude-globals.Flash.min_ampl[channel])0) { /* not used for fixed point amplitudes */ return; } @@ -3142,16 +3208,60 @@ static int Submenu_Implement_Changes(void) return error_num; } break; - case mode_amp_min: - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.min_ampl[channel],0)) { - return error_num; - } - break; - case mode_amp_max: - if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.max_ampl[channel],0)) { + + // hard-coded count of 10 - not ideal! + case mode_ampl_fixed_points + 0: + if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][0],0)) { return error_num; } break; + case mode_ampl_fixed_points + 1: + if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][1],0)) { + return error_num; + } + break; + case mode_ampl_fixed_points + 2: + if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][2],0)) { + return error_num; + } + break; + case mode_ampl_fixed_points + 3: + if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][3],0)) { + return error_num; + } + break; + case mode_ampl_fixed_points + 4: + if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][4],0)) { + return error_num; + } + break; + case mode_ampl_fixed_points + 5: + if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][5],0)) { + return error_num; + } + break; + case mode_ampl_fixed_points + 6: + if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][6],0)) { + return error_num; + } + break; + case mode_ampl_fixed_points + 7: + if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][7],0)) { + return error_num; + } + break; + case mode_ampl_fixed_points + 8: + if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][8],0)) { + return error_num; + } + break; + case mode_ampl_fixed_points + 9: + if (error_num=Set_Amplitude(0,0,0,0,0,0,channel,globals.Flash.fixed_ampl_points[channel][9],0)) { + return error_num; + } + break; + + case mode_amp_normal: if (error_num=Set_EA(channel,amp_mode_normal)) { return error_num; -- cgit