summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--device-functions.c25
-rw-r--r--device-functions.h2
-rw-r--r--globals.h2
-rw-r--r--instr-daemon.c3
-rw-r--r--menus.c32
-rw-r--r--parser.c12
6 files changed, 33 insertions, 43 deletions
diff --git a/device-functions.c b/device-functions.c
index 26d2a5f..0e5338a 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -4622,7 +4622,7 @@ void Main_update_shift_registers()
}
-int IO_Setup_RS232(int baud, char parity, char stopbits, char databits, char hardhand, char echo)
+int IO_Setup_RS232(int baud, char parity, char stopbits, char databits, char hardhand, char echo, gboolean update_flash)
{
// debugging
printf ("baud: %d, parity %d, stop bits %d, data bits %d, handshaking %d, echo %d\n\r",
@@ -4643,24 +4643,13 @@ int IO_Setup_RS232(int baud, char parity, char stopbits, char databits, char har
globals.Flash.hardhand = hardhand;
globals.Flash.echo = echo;
- int eprom_loc = (char *) &(globals.Flash.baud) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.baud));
-
- eprom_loc = (char *) &(globals.Flash.parity) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.parity));
-
- eprom_loc = (char *) &(globals.Flash.stopbits) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.stopbits));
-
- eprom_loc = (char *) &(globals.Flash.databits) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.databits));
-
- eprom_loc = (char *) &(globals.Flash.hardhand) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.hardhand));
-
- eprom_loc = (char *) &(globals.Flash.echo) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.echo));
+ if (update_flash) {
+ int size = sizeof(globals.Flash.baud) + sizeof(globals.Flash.parity) + sizeof(globals.Flash.stopbits) +
+ sizeof(globals.Flash.databits) + sizeof(globals.Flash.hardhand) + sizeof(globals.Flash.echo);
+ int eprom_loc = (char *) &(globals.Flash.baud) - (char *) &(globals.Flash.flash_start);
+ writeUserBlock(&globals.Flash, eprom_loc, size);
+ }
return OK;
} else {
return HardwareError;
diff --git a/device-functions.h b/device-functions.h
index 654c874..de4f1b8 100644
--- a/device-functions.h
+++ b/device-functions.h
@@ -71,6 +71,6 @@ void Set_Sav(int setting_num);
void Main_update_shift_registers();
-int IO_Setup_RS232(int baud, char parity, char stopbits, char databits, char handshake, char echo);
+int IO_Setup_RS232(int baud, char parity, char stopbits, char databits, char handshake, char echo, gboolean update_flash);
#endif
diff --git a/globals.h b/globals.h
index 51c9f7c..bed0eef 100644
--- a/globals.h
+++ b/globals.h
@@ -415,7 +415,7 @@ typedef struct {
char warn_even_if_output_off; /* 129 */
- int baud; /* 130 */
+ int baud; /* 130 */
char parity;
char stopbits;
char databits;
diff --git a/instr-daemon.c b/instr-daemon.c
index a302fb9..d749721 100644
--- a/instr-daemon.c
+++ b/instr-daemon.c
@@ -229,7 +229,8 @@ int main(int argc, char **argv)
globals.Flash.stopbits,
globals.Flash.databits,
globals.Flash.hardhand,
- globals.Flash.echo);
+ globals.Flash.echo,
+ FALSE);
/* start-up delay */
LCD_write(3,0,"Warming up, please wait... ");
diff --git a/menus.c b/menus.c
index 58d0214..b26493b 100644
--- a/menus.c
+++ b/menus.c
@@ -2766,7 +2766,7 @@ static void Nonstd_menu_default_rs232(void)
LCD_write(2,0,"hardware handshaking on, and echo on.");
LCD_write(3,0,Press_Change_Message);
- IO_Setup_RS232(1200, rs232_parity_none, 1, 8, 1, 1);
+ IO_Setup_RS232(1200, rs232_parity_none, 1, 8, 1, 1, TRUE);
Menu_Clear_Buttons();
@@ -3286,89 +3286,89 @@ static int Submenu_Implement_Changes(void)
break;
case mode_1200:
// FIXME: check that serial menus actually work
- IO_Setup_RS232(1200, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ IO_Setup_RS232(1200, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, FALSE);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_databits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_2400:
- IO_Setup_RS232(2400, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ IO_Setup_RS232(2400, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, FALSE);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_databits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_4800:
- IO_Setup_RS232(4800, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ IO_Setup_RS232(4800, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, FALSE);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_databits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_9600:
- IO_Setup_RS232(9600, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ IO_Setup_RS232(9600, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, FALSE);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_databits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_7bits:
- IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, 7, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, 7, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, FALSE);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_parity;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_8bits:
- IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, 8, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, 8, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, FALSE);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_parity;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_par_none:
- IO_Setup_RS232(globals.Flash.baud, rs232_parity_none, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ IO_Setup_RS232(globals.Flash.baud, rs232_parity_none, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, FALSE);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_par_odd:
- IO_Setup_RS232(globals.Flash.baud, rs232_parity_odd, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ IO_Setup_RS232(globals.Flash.baud, rs232_parity_odd, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, FALSE);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_par_even:
- IO_Setup_RS232(globals.Flash.baud, rs232_parity_even, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ IO_Setup_RS232(globals.Flash.baud, rs232_parity_even, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, FALSE);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_1bit:
- IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, 1, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, 1, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, FALSE);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_hardhand;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_2bits:
- IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, 2, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, 2, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, FALSE);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_hardhand;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_hand_hard:
- IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, 1, globals.Flash.echo);
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, 1, globals.Flash.echo, FALSE);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_echo;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_hand_off:
- IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, 0, globals.Flash.echo);
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, 0, globals.Flash.echo, FALSE);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_echo;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_echo_on:
- IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, 1);
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, 1, TRUE);
globals.MenuStatus.Selected_Submenu=Submenu1_setup;
break;
case mode_echo_off:
- IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, 0);
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, 0, TRUE);
globals.MenuStatus.Selected_Submenu=Submenu1_setup;
break;
}
diff --git a/parser.c b/parser.c
index 6e3c1af..32f8d53 100644
--- a/parser.c
+++ b/parser.c
@@ -2743,7 +2743,7 @@ static int Go_ser_baud_60(gchar** response, int channel, char *parameter,char *u
if (status = process_int_param (parameter, &new_baud, 4, valid_choices, NO_ON_OFF)) {
return status;
}
- return IO_Setup_RS232(new_baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ return IO_Setup_RS232(new_baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, TRUE);
break;
case query_simple:
@@ -2781,7 +2781,7 @@ static int Go_ser_par_61(gchar** response, int channel, char *parameter,char *un
return IllegalParameter;
}
- return IO_Setup_RS232(globals.Flash.baud, (char) new_parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ return IO_Setup_RS232(globals.Flash.baud, (char) new_parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, TRUE);
break;
case query_simple:
@@ -2815,7 +2815,7 @@ static int Go_ser_bits_62(gchar** response, int channel, char *parameter,char *u
return status;
}
- return IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, (char) new_databits, globals.Flash.hardhand, globals.Flash.echo);
+ return IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, (char) new_databits, globals.Flash.hardhand, globals.Flash.echo, TRUE);
break;
case query_simple:
@@ -2846,7 +2846,7 @@ static int Go_ser_sbits_63(gchar** response, int channel, char *parameter,char *
return status;
}
- return IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, (char) new_stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
+ return IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, (char) new_stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo, TRUE);
break;
case query_simple:
@@ -2884,7 +2884,7 @@ static int Go_ser_rts_64(gchar** response, int channel, char *parameter,char *un
return IllegalParameter;
}
- return IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, new_hardhand, globals.Flash.echo);
+ return IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, new_hardhand, globals.Flash.echo, TRUE);
break;
case query_simple:
@@ -2917,7 +2917,7 @@ static int Go_ser_echo_65(gchar** response, int channel, char *parameter,char *u
if (status=process_on_off (parameter, &new_echo)) {
return status;
}
- return IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, (char) new_echo);
+ return IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, (char) new_echo, TRUE);
break;
case query_simple: