summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@fedora-arm.domain.avtechpulse.com>1999-12-31 20:02:24 -0500
committerroot <root@fedora-arm.domain.avtechpulse.com>1999-12-31 20:02:24 -0500
commit22d19c0d2a9d56ad560b44cfcb65b69bf4ca278c (patch)
treef9441bbf2843b341c1f2c875f1801b0af0b65241
parent4d3d806f59d13d8965fd0488cf63fc4aca7553d9 (diff)
startup timer
-rw-r--r--flash.c2
-rw-r--r--globals.c7
-rw-r--r--globals.h4
-rw-r--r--instr-daemon.c16
4 files changed, 18 insertions, 11 deletions
diff --git a/flash.c b/flash.c
index 391d781..a2fcdc3 100644
--- a/flash.c
+++ b/flash.c
@@ -317,7 +317,7 @@ static void initFlashValues(FlashStruct *mem)
base_number=11;
mem->flash_start=1;
- mem->turn_on_dly=5
+ mem->turn_on_dly=5;
mem->logic_level_enabled=0;
mem->ChanKey_logic_level=0;
diff --git a/globals.c b/globals.c
index c1ee76b..86ea2e8 100644
--- a/globals.c
+++ b/globals.c
@@ -1,4 +1,5 @@
#include "globals.h"
+#include <time.h>
GlobalStruct globals = {
.error_queue = {0},
@@ -10,3 +11,9 @@ GlobalStruct globals = {
.ques_enable_register = 0,
.flash_writes_suspended = 0
};
+
+
+long sec_timer (void)
+{
+ return (long)time(NULL);
+}
diff --git a/globals.h b/globals.h
index 3c4ff0b..b39cf86 100644
--- a/globals.h
+++ b/globals.h
@@ -6,7 +6,6 @@
#include <stdlib.h>
#include "error_utils.h"
-
#define DEBUG_ON - uncomment this to have debug messages
#ifdef DEBUG_ON
@@ -15,7 +14,6 @@
#define g_print_debug(...) {}
#endif
-
#define error_queue_length 512
#define max_commands_in_input 12
#define max_output_length 512
@@ -128,6 +126,7 @@
#define rs232_echo_off 0x00
#define rs232_echo_on 0x20
+long sec_timer (void);
typedef struct {
int PRIMARY_ADDRESS; /* GPIB chip's GPIB primary address */
@@ -596,6 +595,7 @@ typedef struct {
int oper_enable_register; /* for stat:enable command */
int ques_enable_register; /* for stat:enable command */
int flash_writes_suspended;
+ long startup_timer_value;
} GlobalStruct;
diff --git a/instr-daemon.c b/instr-daemon.c
index 89b6548..bac7680 100644
--- a/instr-daemon.c
+++ b/instr-daemon.c
@@ -252,16 +252,16 @@ int main(int argc, char **argv)
g_free (message);
}
- /* FIXME - start-up delay here */
/* start-up delay */
LCD_write(3,0,"Warming up, please wait... ");
- // delay by globals.Flash.turn_on_dly seconds
- // while (not delayed enough) {
- // message = g_strdup_printf ("%d", remaining seconds);
- // LCD_write(3,27,message);
- // g_free (message);
- // sleep (?);
- //}
+
+ globals.startup_timer_value = sec_timer ();
+ long timer_count;
+ while ((timer_count=sec_timer()-globals.startup_timer_value) < (long)globals.Flash.turn_on_dly) {
+ message = g_strdup_printf ("%ld ", (long) globals.Flash.turn_on_dly - timer_count);
+ LCD_write(3,27,message);
+ g_free (message);
+ }
LCD_write(3,27,"OK");