summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--menus.c317
1 files changed, 155 insertions, 162 deletions
diff --git a/menus.c b/menus.c
index e2aef86..7c5f833 100644
--- a/menus.c
+++ b/menus.c
@@ -262,8 +262,8 @@ void Show_Main_Menu(void)
GStaticMutex mutex = G_STATIC_MUTEX_INIT;
g_static_mutex_lock (&mutex); // can be triggered simultaneously by local or remote users
- char a_string[2*LCD_col_width];
- char b_string[2*LCD_col_width];
+ GString *menu_string = g_string_new ("");
+
int LCD_entry, LCD_row, LCD_col;
int sig_dig; /* number of significant digits to display */
int i;
@@ -315,27 +315,27 @@ void Show_Main_Menu(void)
show_item=Show_No_Number;
if (globals.ChannelState[chan].trigger_source==source_internal) {
- strcpy(a_string,"INT");
+ menu_string = g_string_append (menu_string, "INT");
show_item=Show_frequency+chan;
} else if (globals.ChannelState[chan].trigger_source==source_external) {
- strcpy(a_string,"EXT TRIG");
+ menu_string = g_string_append (menu_string, "EXT TRIG");
} else if (globals.ChannelState[chan].trigger_source==source_manual) {
- strcpy(a_string,"MAN TRIG");
+ menu_string = g_string_append (menu_string, "MAN TRIG");
} else if (globals.ChannelState[chan].trigger_source==source_hold) {
- strcpy(a_string,"HOLD TRIG");
+ menu_string = g_string_append (menu_string, "HOLD TRIG");
} else if (globals.ChannelState[chan].trigger_source==source_immediate) {
- strcpy(a_string,"IMMED TRIG");
+ menu_string = g_string_append (menu_string, "IMMED TRIG");
}
if (globals.Flash.ChanKey_frequency) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
if (globals.ChannelState[chan].trigger_source==source_internal) {
- strcat(a_string,":");
+ menu_string = g_string_append (menu_string, ":");
}
- Display_Number_on_LCD(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,menu_string->str,show_item,sig_dig,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -351,23 +351,23 @@ void Show_Main_Menu(void)
show_item=Show_No_Number;
if (globals.ChannelState[chan].func_mode==pulse_mode_on) {
- strcpy(a_string,"SHAPE:PULSE");
+ menu_string = g_string_append (menu_string, "SHAPE:PULSE");
} else if (globals.ChannelState[chan].func_mode==sin_mode_on) {
- strcpy(a_string,"SHAPE:SINE");
+ menu_string = g_string_append (menu_string, "SHAPE:SINE");
} else if (globals.ChannelState[chan].func_mode==tri_mode_on) {
- strcpy(a_string,"SHAPE:TRI");
+ menu_string = g_string_append (menu_string, "SHAPE:TRI");
} else if (globals.ChannelState[chan].func_mode==squ_mode_on) {
- strcpy(a_string,"SHAPE:SQU");
+ menu_string = g_string_append (menu_string, "SHAPE:SQU");
} else if (globals.ChannelState[chan].func_mode==amp_mode_on) {
- strcpy(a_string,"SHAPE:AMP");
+ menu_string = g_string_append (menu_string, "SHAPE:AMP");
}
if (globals.Flash.ChanKey_func_mode) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+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);
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,sig_dig,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -385,17 +385,17 @@ void Show_Main_Menu(void)
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
if (globals.ChannelState[chan].double_pulse==double_off) {
- strcpy(a_string,"DLY");
+ menu_string = g_string_append (menu_string, "DLY");
} else {
- strcpy(a_string,"DBL");
+ menu_string = g_string_append (menu_string, "DBL");
}
if (globals.Flash.ChanKey_delay) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
+ menu_string = g_string_append (menu_string, ":");
- 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);
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,Show_delay+chan,sig_dig-globals.Flash.ChanKey_delay,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
@@ -419,38 +419,35 @@ void Show_Main_Menu(void)
if (globals.ChannelState[chan].ab_mode==pw_normal) {
if (globals.ChannelState[chan].hold_setting==hold_width) {
show_item=Show_pw+chan;
- strcpy(a_string,"PW");
+ menu_string = g_string_append (menu_string, "PW");
if (globals.Flash.ChanKey_pw) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
+ menu_string = g_string_append (menu_string, ":");
} else {
show_item=Show_duty_cycle+chan;
- strcpy(a_string,"DUTY");
+ menu_string = g_string_append (menu_string, "DUTY");
if (globals.Flash.ChanKey_pw) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
+ menu_string = g_string_append (menu_string, ":");
}
} else {
- strcpy(a_string,"PW");
+ menu_string = g_string_append (menu_string, "PW");
if (globals.Flash.ChanKey_pw) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string," IN=OUT");
+ menu_string = g_string_append (menu_string, " IN=OUT");
}
} else {
- strcpy(a_string,"PW");
+ menu_string = g_string_append (menu_string, "PW");
if (globals.Flash.ChanKey_pw) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,": DC");
+ menu_string = g_string_append (menu_string, ": DC");
}
- 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);
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,sig_dig-globals.Flash.ChanKey_pw,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -470,13 +467,13 @@ void Show_Main_Menu(void)
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
show_item=Show_rise_time+chan;
- strcpy(a_string,"TR");
+ menu_string = g_string_append (menu_string, "TR");
if (globals.Flash.ChanKey_rise_time) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
- 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);
+ menu_string = g_string_append (menu_string, ":");
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,sig_dig-globals.Flash.ChanKey_rise_time,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -494,28 +491,26 @@ void Show_Main_Menu(void)
if (globals.ChannelState[chan].amp_mode==amp_mode_normal) {
show_item=Show_amplitude+chan;
- strcpy(a_string,"AMP");
+ menu_string = g_string_append (menu_string, "AMP");
if (globals.Flash.ChanKey_amplitude) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
+ menu_string = g_string_append (menu_string, ":");
} else if (globals.ChannelState[chan].amp_mode==amp_mode_ea) {
- strcpy(a_string,"AMP");
+ menu_string = g_string_append (menu_string, "AMP");
if (globals.Flash.ChanKey_amplitude) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":EXT");
+ menu_string = g_string_append (menu_string, ":EXT");
} else if (globals.ChannelState[chan].amp_mode==amp_mode_amplify) {
- strcpy(a_string,"AMP");
+ menu_string = g_string_append (menu_string, "AMP");
if (globals.Flash.ChanKey_amplitude) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":AMPLFY");
+ menu_string = g_string_append (menu_string, ":AMPLFY");
}
- 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);
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,sig_dig-globals.Flash.ChanKey_amplitude,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -530,11 +525,11 @@ void Show_Main_Menu(void)
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
show_item=Show_avrq_ampl+chan;
- strcpy(a_string,"AMP");
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
- strcat(a_string,":");
- 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);
+ menu_string = g_string_append (menu_string, "AMP");
+ g_string_append_printf (menu_string, "%d", chan+1);
+ menu_string = g_string_append (menu_string, ":");
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,sig_dig-1,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -549,13 +544,13 @@ void Show_Main_Menu(void)
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
show_item=Show_soft_current_limit+chan;
- strcpy(a_string,"LIM");
+ menu_string = g_string_append (menu_string, "LIM");
if (globals.Flash.ChanKey_current_limit) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
- 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);
+ menu_string = g_string_append (menu_string, ":");
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,sig_dig-globals.Flash.ChanKey_current_limit,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -572,13 +567,13 @@ void Show_Main_Menu(void)
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
show_item=Show_slew+chan;
- strcpy(a_string,"SL");
+ menu_string = g_string_append (menu_string, "SL");
if (globals.Flash.ChanKey_slew) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
- 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);
+ menu_string = g_string_append (menu_string, ":");
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,sig_dig-globals.Flash.ChanKey_slew,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -594,13 +589,13 @@ void Show_Main_Menu(void)
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
show_item=Show_Burst_Count+chan;
- strcpy(a_string,"N");
+ menu_string = g_string_append (menu_string, "N");
if (globals.Flash.ChanKey_Burst_Count) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
- Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,0,LCD_col_width-1);
+ menu_string = g_string_append (menu_string, ":");
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,0,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -617,13 +612,13 @@ void Show_Main_Menu(void)
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
show_item=Show_Burst_Time+chan;
- strcpy(a_string,"BUR");
+ menu_string = g_string_append (menu_string, "BUR");
if (globals.Flash.ChanKey_Burst_Time) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
- 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);
+ menu_string = g_string_append (menu_string, ":");
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,sig_dig-globals.Flash.ChanKey_Burst_Time,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -643,21 +638,20 @@ void Show_Main_Menu(void)
if (globals.ChannelState[chan].os_mode==os_mode_normal) {
show_item=Show_offset+chan;
- strcpy(a_string,"OS");
+ menu_string = g_string_append (menu_string, "OS");
if (globals.Flash.ChanKey_offset) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
+ menu_string = g_string_append (menu_string, ":");
} else {
- strcpy(a_string,"OS");
+ menu_string = g_string_append (menu_string, "OS");
if (globals.Flash.ChanKey_offset) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":EXT");
+ menu_string = g_string_append (menu_string, ":EXT");
}
- 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);
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,sig_dig-globals.Flash.ChanKey_offset,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -670,13 +664,13 @@ void Show_Main_Menu(void)
LCD_row=LCD_entry % LCD_rows;
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
- strcpy(a_string,"Mon");
+ menu_string = g_string_append (menu_string, "Mon");
if (globals.Flash.ChanKey_Curr_Mon_value) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
- Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry),LCD_row,LCD_col,a_string,Show_monitor+chan,sig_dig-globals.Flash.ChanKey_Curr_Mon_value,LCD_col_width-1);
+ menu_string = g_string_append (menu_string, ":");
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry),LCD_row,LCD_col,menu_string->str,Show_monitor+chan,sig_dig-globals.Flash.ChanKey_Curr_Mon_value,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
globals.ChannelState[chan].displayed_mon_val=globals.ChannelState[chan].Curr_Mon_value;
}
}
@@ -692,24 +686,20 @@ void Show_Main_Menu(void)
LCD_row=LCD_entry % LCD_rows;
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
- strcpy(a_string,"Zout");
+ menu_string = g_string_append (menu_string, "Zout");
if (globals.Flash.ChanKey_zout) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
+ menu_string = g_string_append (menu_string, ":");
- gchar *temp = NULL;
if (globals.ChannelState[chan].zout==globals.Flash.zout_max[chan]) {
- temp = g_strdup_printf ("%d\xf4 ", globals.Flash.zout_max[chan]);
- strcat(a_string,temp);
+ g_string_append_printf (menu_string, "%d\xf4 ", globals.Flash.zout_max[chan]);
} else {
- temp = g_strdup_printf ("%d\xf4 ", globals.Flash.zout_min[chan]);
- strcat(a_string,temp);
+ g_string_append_printf (menu_string, "%d\xf4 ", globals.Flash.zout_min[chan]);
}
- g_free (temp);
- 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);
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,Show_No_Number,sig_dig-globals.Flash.ChanKey_zout,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -723,13 +713,13 @@ void Show_Main_Menu(void)
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
show_item=Show_load_type+chan;
- strcpy(a_string,"Load");
+ menu_string = g_string_append (menu_string, "Load");
if (globals.Flash.ChanKey_load_type) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
- 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);
+ menu_string = g_string_append (menu_string, ":");
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,sig_dig-globals.Flash.ChanKey_load_type,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -744,20 +734,20 @@ void Show_Main_Menu(void)
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
- strcpy(a_string,"Output");
+ menu_string = g_string_append (menu_string, "Output");
if (globals.Flash.ChanKey_output_state) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
+ menu_string = g_string_append (menu_string, ":");
if (globals.ChannelState[chan].output_state==output_on) {
- strcat(a_string,"ON");
+ menu_string = g_string_append (menu_string, "ON");
} else {
- strcat(a_string,"OFF");
+ menu_string = g_string_append (menu_string, "OFF");
}
- 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_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,Show_No_Number,sig_dig-globals.Flash.ChanKey_output_state,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
/*----- display primary routing, as appropriate -----*/
@@ -773,17 +763,17 @@ void Show_Main_Menu(void)
show_item=Show_route_primary+chan;
if (globals.Flash.routing_required[chan] == 1) {
- strcpy(a_string,"Route");
+ menu_string = g_string_append (menu_string, "Route");
} else {
- strcpy(a_string,"ANOD");
+ menu_string = g_string_append (menu_string, "ANOD");
}
if (globals.Flash.ChanKey_route) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
- Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,0,LCD_col_width-1);
+ menu_string = g_string_append (menu_string, ":");
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,0,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -800,14 +790,14 @@ void Show_Main_Menu(void)
show_item=Show_route_secondary+chan;
- strcpy(a_string,"CATH");
+ menu_string = g_string_append (menu_string, "CATH");
if (globals.Flash.ChanKey_route) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
- Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,a_string,show_item,0,LCD_col_width-1);
+ menu_string = g_string_append (menu_string, ":");
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,show_item,0,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -821,20 +811,20 @@ void Show_Main_Menu(void)
LCD_row=LCD_entry % LCD_rows;
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
- strcpy(a_string,"INVERT");
+ menu_string = g_string_append (menu_string, "INVERT");
if (globals.Flash.ChanKey_polarity) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
+ menu_string = g_string_append (menu_string, ":");
if (globals.ChannelState[chan].polarity==pol_norm) {
- strcat(a_string,"NO");
+ menu_string = g_string_append (menu_string, "NO");
} else {
- strcat(a_string,"YES");
+ menu_string = g_string_append (menu_string, "YES");
}
- 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);
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,Show_No_Number,sig_dig-globals.Flash.ChanKey_polarity,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -847,19 +837,19 @@ void Show_Main_Menu(void)
LCD_row=LCD_entry % LCD_rows;
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
- strcpy(a_string,"Logic");
+ menu_string = g_string_append (menu_string, "Logic");
if (globals.Flash.ChanKey_logic_level) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
+ menu_string = g_string_append (menu_string, ":");
if (globals.ChannelState[chan].logic_level==logic_ttl) {
- strcat(a_string,"TTL");
+ menu_string = g_string_append (menu_string, "TTL");
} else {
- strcat(a_string,"ECL");
+ menu_string = g_string_append (menu_string, "ECL");
}
- 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);
+ Display_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,Show_No_Number,sig_dig-globals.Flash.ChanKey_logic_level,LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -874,24 +864,24 @@ void Show_Main_Menu(void)
LCD_row=LCD_entry % LCD_rows;
LCD_col=((LCD_entry % LCD_max_entries_per_page) / LCD_rows) * LCD_col_width + 1;
- strcpy(a_string,"GAT");
+ menu_string = g_string_append (menu_string, "GAT");
if (globals.Flash.ChanKey_gate_type || globals.Flash.ChanKey_gate_level) {
- sprintf(b_string, "%d", chan+1);
- strcat(a_string,b_string);
+ g_string_append_printf (menu_string, "%d", chan+1);
}
- strcat(a_string,":");
+ menu_string = g_string_append (menu_string, ":");
if (globals.ChannelState[chan].gate_type==gate_sync && globals.ChannelState[chan].gate_level==gate_low) {
- strcat(a_string,"SYN,LO");
+ menu_string = g_string_append (menu_string, "SYN,LO");
} else if (globals.ChannelState[chan].gate_type==gate_sync && globals.ChannelState[chan].gate_level==gate_high) {
- strcat(a_string,"SYN,HI");
+ menu_string = g_string_append (menu_string, "SYN,HI");
} else if (globals.ChannelState[chan].gate_type==gate_async && globals.ChannelState[chan].gate_level==gate_low) {
- strcat(a_string,"ASY,LO");
+ menu_string = g_string_append (menu_string, "ASY,LO");
} else {
- strcat(a_string,"ASY,HI");
+ menu_string = g_string_append (menu_string, "ASY,HI");
}
- 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_Number_on_LCD(Menu_Is_Item_Visible(LCD_entry), LCD_row,LCD_col,menu_string->str,Show_No_Number, sig_dig-(globals.Flash.ChanKey_gate_level | globals.Flash.ChanKey_gate_type),LCD_col_width-1);
+ g_string_erase (menu_string, 0, -1);
}
}
@@ -990,6 +980,8 @@ void Show_Main_Menu(void)
LCD_write_padded_spaces(LCD_row,LCD_col,"",LCD_col_width);
}
+ g_string_free (menu_string, TRUE);
+
g_static_mutex_unlock (&mutex);
}
@@ -1045,7 +1037,6 @@ static void Menu_Move_Pointer(int move_amount)
if (new_page!=old_page) {
Show_Main_Menu();
}
-
}
@@ -1963,9 +1954,11 @@ static void Submenu_Display(int change_selection)
}
}
- /* If change_selection==NO, the submenu is being drawn from scratch. In this case, the arrow pointer points at the
- current operating mode. If change_selection=YES, the submenu is being redrawn to scroll the mode list. In this case,
- the arrow pointer points at the current selection. */
+ /* If change_selection==NO, the submenu is being drawn from scratch.
+ this case, the arrow pointer points at the current operating mode.
+ If change_selection=YES, the submenu is being redrawn to scroll
+ the mode list. In this case, the arrow pointer points at the current
+ selection. */
if (change_selection==NO && current_operating_mode<4) {
base_entry=0;
@@ -1973,9 +1966,9 @@ static void Submenu_Display(int change_selection)
} else if (change_selection==NO) {
base_entry=current_operating_mode-3;
Submenu_Selected_Item=current_operating_mode;
- } else if (change_selection=YES && Submenu_Selected_Item<4) {
+ } else if (change_selection==YES && Submenu_Selected_Item<4) {
base_entry=0;
- } else if (change_selection=YES && Submenu_Selected_Item>=4) {
+ } else if (change_selection==YES && Submenu_Selected_Item>=4) {
base_entry=Submenu_Selected_Item-3;
}