summaryrefslogtreecommitdiff
path: root/menus.c
diff options
context:
space:
mode:
Diffstat (limited to 'menus.c')
-rw-r--r--menus.c180
1 files changed, 145 insertions, 35 deletions
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])<globals.Flash.ampl_zero_equiv[channel]) {
- current_operating_mode=i;
- }
- break;
- case mode_amp_max:
- if (globals.Flash.voltage_enabled[channel]) {
- String_Parameter_To_Text(globals.Flash.max_ampl[channel],2,"","V",&mode_name,YES,LCD_col_width);
- } else {
- String_Parameter_To_Text(globals.Flash.max_ampl[channel],2,"","A",&mode_name,YES,LCD_col_width);
- }
- if (fabs(globals.ChannelState[channel].amplitude-globals.Flash.max_ampl[channel])<globals.Flash.ampl_zero_equiv[channel]) {
+ // hard-coded count of 10 - not ideal!
+ case mode_ampl_fixed_points + 0:
+ use_ampl = globals.Flash.fixed_ampl_points[channel][0];
+ String_Parameter_To_Text(use_ampl,2,"",fixed_ampl_units,&mode_name,YES,LCD_col_width);
+ if (fabs(globals.ChannelState[channel].amplitude-use_ampl)<globals.Flash.ampl_zero_equiv[channel]) {
+ current_operating_mode=i;
+ }
+ break;
+ case mode_ampl_fixed_points + 1:
+ use_ampl = globals.Flash.fixed_ampl_points[channel][1];
+ String_Parameter_To_Text(use_ampl,2,"",fixed_ampl_units,&mode_name,YES,LCD_col_width);
+ if (fabs(globals.ChannelState[channel].amplitude-use_ampl)<globals.Flash.ampl_zero_equiv[channel]) {
+ current_operating_mode=i;
+ }
+ break;
+ case mode_ampl_fixed_points + 2:
+ use_ampl = globals.Flash.fixed_ampl_points[channel][2];
+ String_Parameter_To_Text(use_ampl,2,"",fixed_ampl_units,&mode_name,YES,LCD_col_width);
+ if (fabs(globals.ChannelState[channel].amplitude-use_ampl)<globals.Flash.ampl_zero_equiv[channel]) {
+ current_operating_mode=i;
+ }
+ break;
+
+ case mode_ampl_fixed_points + 3:
+ use_ampl = globals.Flash.fixed_ampl_points[channel][3];
+ String_Parameter_To_Text(use_ampl,2,"",fixed_ampl_units,&mode_name,YES,LCD_col_width);
+ if (fabs(globals.ChannelState[channel].amplitude-use_ampl)<globals.Flash.ampl_zero_equiv[channel]) {
current_operating_mode=i;
}
break;
+
+ case mode_ampl_fixed_points + 4:
+ use_ampl = globals.Flash.fixed_ampl_points[channel][4];
+ String_Parameter_To_Text(use_ampl,2,"",fixed_ampl_units,&mode_name,YES,LCD_col_width);
+ if (fabs(globals.ChannelState[channel].amplitude-use_ampl)<globals.Flash.ampl_zero_equiv[channel]) {
+ current_operating_mode=i;
+ }
+ break;
+ case mode_ampl_fixed_points + 5:
+ use_ampl = globals.Flash.fixed_ampl_points[channel][5];
+ String_Parameter_To_Text(use_ampl,2,"",fixed_ampl_units,&mode_name,YES,LCD_col_width);
+ if (fabs(globals.ChannelState[channel].amplitude-use_ampl)<globals.Flash.ampl_zero_equiv[channel]) {
+ current_operating_mode=i;
+ }
+ break;
+ case mode_ampl_fixed_points + 6:
+ use_ampl = globals.Flash.fixed_ampl_points[channel][6];
+ String_Parameter_To_Text(use_ampl,2,"",fixed_ampl_units,&mode_name,YES,LCD_col_width);
+ if (fabs(globals.ChannelState[channel].amplitude-use_ampl)<globals.Flash.ampl_zero_equiv[channel]) {
+ current_operating_mode=i;
+ }
+ break;
+ case mode_ampl_fixed_points + 7:
+ use_ampl = globals.Flash.fixed_ampl_points[channel][7];
+ String_Parameter_To_Text(use_ampl,2,"",fixed_ampl_units,&mode_name,YES,LCD_col_width);
+ if (fabs(globals.ChannelState[channel].amplitude-use_ampl)<globals.Flash.ampl_zero_equiv[channel]) {
+ current_operating_mode=i;
+ }
+ break;
+ case mode_ampl_fixed_points + 8:
+ use_ampl = globals.Flash.fixed_ampl_points[channel][8];
+ String_Parameter_To_Text(use_ampl,2,"",fixed_ampl_units,&mode_name,YES,LCD_col_width);
+ if (fabs(globals.ChannelState[channel].amplitude-use_ampl)<globals.Flash.ampl_zero_equiv[channel]) {
+ current_operating_mode=i;
+ }
+ break;
+ case mode_ampl_fixed_points + 9:
+ use_ampl = globals.Flash.fixed_ampl_points[channel][9];
+ String_Parameter_To_Text(use_ampl,2,"",fixed_ampl_units,&mode_name,YES,LCD_col_width);
+ if (fabs(globals.ChannelState[channel].amplitude-use_ampl)<globals.Flash.ampl_zero_equiv[channel]) {
+ current_operating_mode=i;
+ }
+ break;
+
+
+
case mode_1200:
mode_name = g_strdup("1200 baud");
if (globals.Flash.baud==1200) {
@@ -1984,6 +2048,8 @@ static void Submenu_Display(int change_selection)
}
g_ptr_array_add (gparray, (gpointer) mode_name);
+
+ g_free (fixed_ampl_units);
}
/* If change_selection==NO, the submenu is being drawn from scratch.
@@ -2625,7 +2691,7 @@ static void Submenu_Service_Encoder(int encoder_change)
}
}
- if (globals.Flash.ampl_min_max_only[channel]) { /* not used for two-state amplitudes */
+ if (number_of_fixed_ampl_points(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;