diff options
author | root <root@fedora-arm.domain.avtechpulse.com> | 1999-12-31 20:02:24 -0500 |
---|---|---|
committer | root <root@fedora-arm.domain.avtechpulse.com> | 1999-12-31 20:02:24 -0500 |
commit | 22d19c0d2a9d56ad560b44cfcb65b69bf4ca278c (patch) | |
tree | f9441bbf2843b341c1f2c875f1801b0af0b65241 | |
parent | 4d3d806f59d13d8965fd0488cf63fc4aca7553d9 (diff) |
startup timer
-rw-r--r-- | flash.c | 2 | ||||
-rw-r--r-- | globals.c | 7 | ||||
-rw-r--r-- | globals.h | 4 | ||||
-rw-r--r-- | instr-daemon.c | 16 |
4 files changed, 18 insertions, 11 deletions
@@ -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; @@ -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); +} @@ -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"); |