summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-29 10:55:34 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-29 10:55:34 -0400
commitfacf818bfa54d1fc553cf06a0f22012ea033ace0 (patch)
tree254143d4d025f5b2d37af59e95470b48ba9421c4
parentb127640ef5f09b10a648701c52f950f3fe569ce6 (diff)
add some menu variables as globals, to remove FIXMEs
-rw-r--r--error_utils.c5
-rw-r--r--globals.h50
-rw-r--r--instr-daemon.c2
-rw-r--r--lcd.c9
-rw-r--r--lcd.h5
-rw-r--r--monitor.c26
-rw-r--r--parser.c5
7 files changed, 77 insertions, 25 deletions
diff --git a/error_utils.c b/error_utils.c
index ec713cd..17bab15 100644
--- a/error_utils.c
+++ b/error_utils.c
@@ -13,6 +13,7 @@ END DESCRIPTION **********************************************************/
#include <string.h>
#include <glib/gprintf.h>
+#include <glib.h>
#include <math.h>
#include "globals.h"
#include "dummy_functions.h"
@@ -21,8 +22,6 @@ END DESCRIPTION **********************************************************/
/*** EndHeader */
-int Error_Screen=NO; //FIXME - should be a menu global?
-
void set_gpib_error_flags (int error_num);
void set_gpib_error_flags (int error_num)
@@ -137,7 +136,7 @@ void queue_error_and_display_on_LCD(int error_num)
{
gchar* response = NULL;
queue_error_and_get_text(&response, error_num);
- LCD_display_extended_message (response, 1);
+ LCD_display_extended_message (response, TRUE, TRUE);
}
diff --git a/globals.h b/globals.h
index 5f88108..4e5c3f0 100644
--- a/globals.h
+++ b/globals.h
@@ -4,6 +4,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <glib.h>
#define DEBUG_ON - uncomment this to have debug messages
@@ -87,7 +88,6 @@
#define NetworkNotFound 74
#define ThisShouldntHappen 75
-#define LCD_cols 32
#define YES 1
#define NO 0
@@ -231,6 +231,45 @@
#define COUNTER_BYTE_3 0x60
+// menu stuff
+#define Main_Menu_On 0
+#define Submenu_On 1
+
+#define Submenu1_freq 0
+#define Submenu1_delay 100
+#define Submenu1_pw 200
+#define Submenu1_amp 300
+#define Submenu1_offset 400
+#define Submenu1_mon 500
+#define Submenu1_zout 600
+#define Submenu1_loadtype 700
+#define Submenu1_output_state 800
+#define Submenu1_setup 900
+#define Submenu1_rem_loc 1000
+#define Submenu1_invert 1100
+#define Submenu1_gate 1200
+#define Submenu1_memory 1300
+#define Submenu2_save 1400
+#define Submenu2_load 1500
+#define Submenu2_rs232 1600
+#define Submenu2_rs232_baud 1700
+#define Submenu2_rs232_databits 1800
+#define Submenu2_rs232_parity 1900
+#define Submenu2_rs232_stopbits 2000
+#define Submenu2_rs232_hardhand 2100
+#define Submenu2_rs232_echo 2200
+#define Submenu1_logic_level 2300
+#define Submenu1_route_primary 2400
+#define Submenu1_burst_count 2500
+#define Submenu1_burst_time 2600
+#define Submenu1_func 2700
+#define Submenu1_rise_time 2800
+#define Submenu2_gpib_address 2900
+#define Submenu1_soft_current_limit 3000
+#define Submenu1_route_secondary 3200
+#define Submenu1_slew 3300
+#define Submenu1_avrq 3400
+
long sec_timer (void);
@@ -259,6 +298,14 @@ typedef struct {
typedef struct {
+ int Type_Of_Menu;
+ gboolean Error_Screen;
+ gboolean Nonstd_Display;
+ int Selected_Submenu;
+} MenuStatusStruct;
+
+
+typedef struct {
int update_freq;
int update_func;
int update_delay;
@@ -759,6 +806,7 @@ typedef struct {
FlagStruct Flags;
FlagStruct DefaultFlags;
TimeStruct Timers;
+ MenuStatusStruct MenuStatus;
} GlobalStruct;
diff --git a/instr-daemon.c b/instr-daemon.c
index 9b8b923..e1db5da 100644
--- a/instr-daemon.c
+++ b/instr-daemon.c
@@ -239,7 +239,7 @@ int main(int argc, char **argv)
initFlash (&globals.Flash, FALSE, 0);
gchar *message = g_strdup_printf ("%s, S/N %s", globals.Flash.model_num, globals.Flash.serial_num);
- LCD_display_extended_message (message, 0);
+ LCD_display_extended_message (message, FALSE, FALSE);
g_free (message);
int i;
diff --git a/lcd.c b/lcd.c
index de02525..d90bb69 100644
--- a/lcd.c
+++ b/lcd.c
@@ -1,5 +1,6 @@
#include "i2c.h"
#include "lcd.h"
+#include "globals.h"
#include <glib.h>
#include <string.h>
#include <stdlib.h>
@@ -9,8 +10,6 @@
#define LCD_CG_RAM 64 /* custom character RAM, in the LCD ICs */
#define LCD_chars_total 160
-#define LCD_cols 40
-#define LCD_rows 4 /* 4x40 LCD */
char LCD_Data[LCD_rows][LCD_cols]; /* shadow copy of LCD display in local RAM, to minimize slow I2C writes */
@@ -281,13 +280,15 @@ void LCD_initialize(void)
}
-void LCD_display_extended_message(char *response, gboolean show_change_message)
+void LCD_display_extended_message(char *response, gboolean show_change_message, gboolean is_error_screen)
{
char *row0 = NULL;
char *row1 = NULL;
char *row2 = NULL;
-// Error_Screen=1; //FIXME - implement menu system
+ if (is_error_screen) {
+ globals.MenuStatus.Error_Screen = is_error_screen;
+ }
break_up_string (response, LCD_cols, &row0, &row1, &row2);
diff --git a/lcd.h b/lcd.h
index 804b44f..4c6edfc 100644
--- a/lcd.h
+++ b/lcd.h
@@ -2,7 +2,10 @@
#include <glib.h>
-void LCD_display_extended_message(char *response, gboolean show_change_message);
+#define LCD_cols 40
+#define LCD_rows 4 /* 4x40 LCD */
+
+void LCD_display_extended_message(char *response, gboolean show_change_message, gboolean is_error_screen);
void LCD_clear();
void LCD_write(int row, int col, char *LCD_string);
void LCD_initialize(void);
diff --git a/monitor.c b/monitor.c
index 28d25e3..a6bb127 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4,6 +4,8 @@
#include "lcd.h"
#include "monitor.h"
#include "error_utils.h"
+#include "dummy_functions.h"
+
#include <glib.h>
#include <math.h>
@@ -228,21 +230,21 @@ int I2C_Check_Monitors(void)
Set_Output_State(channel,output_off);
queue_and_broadcast_sensor_alarm(Soft_Limit_Exceeded);
}
- // FIXME - menus
-// else if (Type_Of_Menu==Main_Menu_On && Error_Screen==NO && Nonstd_Display==NO
-// && globals.ChannelState[channel].Curr_Mon_value!=globals.ChannelState[channel].displayed_mon_val
-// && (seconds_since_last > 0))
-// /* only update display once a second */
-// {
-// ++update_display;
-// }
+ else if (globals.MenuStatus.Type_Of_Menu==Main_Menu_On &&
+ !globals.MenuStatus.Error_Screen &&
+ !globals.MenuStatus.Nonstd_Display &&
+ globals.ChannelState[channel].Curr_Mon_value!=globals.ChannelState[channel].displayed_mon_val &&
+ (seconds_since_last > 0))
+ /* only update display once a second */
+ {
+ ++update_display;
+ }
}
-// FIXME - menus
-// if (update_display) {
-// Menu_Update_Display();
-// }
+ if (update_display) {
+ Menu_Update_Display();
+ }
return OK;
}
diff --git a/parser.c b/parser.c
index d7cf46e..d5be649 100644
--- a/parser.c
+++ b/parser.c
@@ -16,6 +16,7 @@ END DESCRIPTION **********************************************************/
#include "version.h"
#include "dummy_functions.h"
#include "i2c.h"
+#include "lcd.h"
#include <glib/gprintf.h>
//STATICS
@@ -1086,9 +1087,7 @@ void Parser_main (char *raw_in, int interactive_terminal, void(*cbfunc)(gpointer
/* update display if it wasn't a query, and if the control menu isn't on (this gives the user
a chance to press "Go To Local" to override control */
- int Selected_Submenu=0, Submenu1_rem_loc=0, Type_Of_Menu=0, Submenu_On=0;
-
- if (!is_query && !(Selected_Submenu==Submenu1_rem_loc && Type_Of_Menu==Submenu_On)) {
+ if (!is_query && !(globals.MenuStatus.Selected_Submenu==Submenu1_rem_loc && globals.MenuStatus.Type_Of_Menu==Submenu_On)) {
Menu_Update_Display();
}