summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--device-functions.c4
-rw-r--r--error_utils.c5
-rw-r--r--globals.h2
-rw-r--r--parser.c18
4 files changed, 26 insertions, 3 deletions
diff --git a/device-functions.c b/device-functions.c
index 9c641c0..271c6bc 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -4045,6 +4045,8 @@ int do_full_self_cal(CalStruct *caldata)
long start_timer, diff_timer;
int eprom_loc;
+ globals.Sys.cal_in_progress = 1;
+
Menu_Clear_Buttons();
LCD_clear(); /*0123456789012345678901234567890123456789*/
LCD_write(0,0,"Self-calibration in progress.");
@@ -4124,6 +4126,8 @@ int do_full_self_cal(CalStruct *caldata)
eprom_loc = (char *) &(globals.Flash.self_cal_typical_time_sec) - (char *) &(globals.Flash.flash_start);
writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.self_cal_typical_time_sec));
+ globals.Sys.cal_in_progress = 0;
+
if (caldata->total_errors) {
return SelfCalError;
} else {
diff --git a/error_utils.c b/error_utils.c
index 974da44..61eaeb4 100644
--- a/error_utils.c
+++ b/error_utils.c
@@ -61,6 +61,7 @@ void set_gpib_error_flags (int error_num)
case SelfCalError:
case NetworkNotFound:
case Startup_Not_Finished:
+ case Cal_In_Progress:
GPIB_Set_Device_Dependent_Error();
break;
default:
@@ -524,6 +525,10 @@ void get_error_text(gchar **response, int error_num)
format_error_text(response,-300,"Not ready for commands yet. Still booting up.");
break;
+ case Cal_In_Progress:
+ format_error_text(response,-300,"Calibration in progress. Turn off instrument to cancel.");
+ break;
+
default:
format_error_text(response,-200,"Specific problem unknown.");
}
diff --git a/globals.h b/globals.h
index 96cab87..5f28ce6 100644
--- a/globals.h
+++ b/globals.h
@@ -88,6 +88,7 @@
#define NetworkNotFound 74
#define ThisShouldntHappen 75
#define Startup_Not_Finished 76
+#define Cal_In_Progress 77
#define YES 1
#define NO 0
@@ -756,6 +757,7 @@ typedef struct {
int shutdown_started;
int flash_write_in_progress;
int startup_complete;
+ int cal_in_progress;
} SysFlagStruct;
diff --git a/parser.c b/parser.c
index 58866f8..48d4825 100644
--- a/parser.c
+++ b/parser.c
@@ -628,9 +628,6 @@ static gchar* filter_input (gchar *raw_in)
void Parser_main (char *raw_in, int interactive_terminal, void(*cbfunc)(gpointer, gchar *), gpointer user_data)
{
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
- g_static_mutex_lock (&mutex);
-
int in_pos; /* this identifies the single character of in being processed */
int command_depth; /* how many command words have been parsed */
int old_command_depth; /* save this if in case of a compound message */
@@ -648,6 +645,21 @@ void Parser_main (char *raw_in, int interactive_terminal, void(*cbfunc)(gpointer
/* the message is a compound one */
+ // Commands cause error if calibration in progress.
+ if (globals.Sys.cal_in_progress) {
+ gchar *error_msg = NULL;
+ queue_error_from_parser(&error_msg, Cal_In_Progress);
+ if (interactive_terminal) {
+ (*cbfunc)(user_data, error_msg);
+ }
+ g_free (error_msg);
+ return;
+ }
+
+
+ static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+ g_static_mutex_lock (&mutex);
+
int is_query;
int command_type; /* combination of is_query, parameter_found, and units_found */