summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flash.c13
-rw-r--r--globals.h5
-rw-r--r--lcd.c56
-rw-r--r--menus.c22
-rw-r--r--parser.c2
-rw-r--r--version.h2
6 files changed, 65 insertions, 35 deletions
diff --git a/flash.c b/flash.c
index 23a7823..ee3b036 100644
--- a/flash.c
+++ b/flash.c
@@ -414,7 +414,7 @@ static void initFlashValues(FlashStruct *mem)
mem->logic_level_enabled=0;
mem->ChanKey_logic_level=0;
- strcpy(mem->model_num,"unprogrammed");
+ strcpy(mem->model_num,"AV-unprogrammed");
strcpy(mem->serial_num,"00000");
mem->fully_programmed=Being_Programmed;
@@ -936,6 +936,14 @@ void fixFlash(FlashStruct *mem)
int i, fix_initial_constants;
+ fix_initial_constants = 0;
+
+ // handle change in model number location
+ if ((mem->model_num[0] != 'A') && (mem->model_num[1] != 'V')) {
+ strcpy(mem->model_num, mem->model_num_old);
+ ++fix_initial_constants;
+ }
+
for (i=0; i<max_channels; i++) {
globals.Constraints.composite_min_burst_time[i]=mem->min_burst_gap[i];
@@ -1008,6 +1016,9 @@ void fixFlash(FlashStruct *mem)
eprom_loc = (char *) &(mem->rcl_amplitude) - (char *) &(mem->flash_start);
writeUserBlock(&globals.Flash, eprom_loc, sizeof(mem->rcl_amplitude));
+
+ eprom_loc = (char *) &(mem->model_num) - (char *) &(mem->flash_start);
+ writeUserBlock(&globals.Flash, eprom_loc, sizeof(mem->model_num));
}
}
diff --git a/globals.h b/globals.h
index 3617762..9c52ee4 100644
--- a/globals.h
+++ b/globals.h
@@ -366,7 +366,7 @@ typedef struct {
char logic_level_enabled; /* 2 */
char ChanKey_logic_level; /* 3 */
- char model_num[32]; /* 4 */
+ char model_num_old[32]; /* 4 */
char serial_num[16]; /* 36 */
short fully_programmed; /* 52 */
@@ -378,8 +378,7 @@ typedef struct {
short spare2; /* 59 */
char ChanKey_route; /* 61 */
char on_off_used; /* 62 */
- char password[32]; /* 63 - no longer used */
- char username[32]; /* 95 - no longer used */
+ char model_num[64]; /* 63 */
char pcb116c_mon; /* 127 */
diff --git a/lcd.c b/lcd.c
index 526cf8e..2eb7f98 100644
--- a/lcd.c
+++ b/lcd.c
@@ -18,12 +18,15 @@ char LCD_Data[LCD_rows][LCD_cols]; /* shadow copy of LCD display in local RAM, t
static void break_up_string (char *in_string, int N, char **str1, char **str2, char **str3)
{
+ int i;
+
gchar** words = g_strsplit(in_string, " ", -1);
GString* rows[3];
- rows[0] = g_string_new(NULL);
- rows[1] = g_string_new(NULL);
- rows[2] = g_string_new(NULL);
+
+ for (i = 0; i<3; i++) {
+ rows[i] = g_string_new(NULL);
+ }
int row = 0;
int col = 0;
@@ -32,22 +35,49 @@ static void break_up_string (char *in_string, int N, char **str1, char **str2, c
for (word = words; *word != NULL; word++) {
int wordlen = strlen(*word);
- if (col + wordlen > N) {
- col = 0;
- row++;
- }
+ if (wordlen > N) {
+ // model numbers can be up to 64 chars
+
+ int remainder = col + wordlen - N;
+ if (row < 3) {
+ g_string_append(rows[row], *word);
+ col = 0;
+ row++;
+ }
+
+ if (row < 3) {
+ g_string_append(rows[row], *word + (wordlen - remainder));
+ col += remainder;
+ }
- if (row < 3) {
- g_string_append(rows[row], *word);
+ } else {
- col += wordlen;
+ if (col + wordlen > N) {
+ col = 0;
+ row++;
+ }
- if (col != 0 && (col + 1) < N) {
- g_string_append(rows[row], " ");
- col++;
+ if (row < 3) {
+ g_string_append(rows[row], *word);
+ col += wordlen;
}
}
+
+ if ((row < 3) && (col != 0) && (col < N)) {
+ g_string_append(rows[row], " ");
+ col++;
+ }
+
+ if (col >= N) {
+ col = 0;
+ row++;
+ }
+ }
+
+ for (i = 0; i<3; i++) {
+ g_string_truncate (rows[i], N);
}
+
*str1 = g_string_free(rows[0], FALSE);
*str2 = g_string_free(rows[1], FALSE);
*str3 = g_string_free(rows[2], FALSE);
diff --git a/menus.c b/menus.c
index 651d13a..46fab58 100644
--- a/menus.c
+++ b/menus.c
@@ -2729,22 +2729,12 @@ static void Nonstd_menu_default_rs232(void)
static void Nonstd_menu_model_info(void)
{
- gchar *response;
-
- LCD_clear();
-
- /*0123456789012345678901234567890123456789*/
- LCD_write(0,0,"Avtech Electrosystems Ltd. - since 1975");
- LCD_write(1,0,"Visit us at www.avtechpulse.com!");
-
- LCD_write(2,0,"Model: ");
- LCD_write(2,7,globals.Flash.model_num);
-
- response = g_strdup_printf ("SN:%s,v%s", globals.Flash.serial_num, FW_VERSION);
- LCD_write(3,0,response);
- g_free (response);
-
- LCD_write(3,27,"Press CHANGE.");
+ gchar *message = g_strdup_printf ("Avtech Electrosystems Ltd., since 1975. Model %s, S/N %s, FW v%s.",
+ globals.Flash.model_num,
+ globals.Flash.serial_num,
+ FW_VERSION);
+ LCD_display_extended_message (message, TRUE, FALSE);
+ g_free (message);
globals.MenuStatus.Nonstd_Display=YES;
}
diff --git a/parser.c b/parser.c
index 831e0aa..434fca6 100644
--- a/parser.c
+++ b/parser.c
@@ -1181,7 +1181,7 @@ static int Go_Str_eprom_47(gchar** response, int channel, char *loc_string,char
switch (command_type) {
case command_param_units:
- if ( (strlen(store_string) < LCD_cols) && (eprom_loc >= 0)) {
+ if ( (strlen(store_string) < sizeof(globals.Flash.model_num)) && (eprom_loc >= 0)) {
int i;
for (i=0; i<strlen(store_string); ++i) {
/* convert ~ to spaces */
diff --git a/version.h b/version.h
index ed8f2f2..7f6d65b 100644
--- a/version.h
+++ b/version.h
@@ -1,2 +1,2 @@
-#define FW_VERSION "6.0.9"
+#define FW_VERSION "6.0.10"
#define SCPI_version "1996.0"