diff options
author | Keith Packard <keithp@keithp.com> | 2009-05-10 23:11:06 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-05-10 23:12:08 -0700 |
commit | 497c89a7d08920630894b2605c3b6a0bdc4c229b (patch) | |
tree | f57b9b6823bd957495a1dbabc6adabf83b9f5ba4 /ao_flight_test.c | |
parent | ba3c53636e485450f48093d0a88a6629775f7c3a (diff) |
Use recorded accelerometer baseline data in ao_flight_test
With the flight computer recording a long-term average value for the
accelerometer in the flight record, use that to prime the flight test code
when running a log file through the simulator.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao_flight_test.c')
-rw-r--r-- | ao_flight_test.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ao_flight_test.c b/ao_flight_test.c index dea7b31c..e9c6a530 100644 --- a/ao_flight_test.c +++ b/ao_flight_test.c @@ -163,6 +163,8 @@ ao_insert(void) } static int ao_records_read = 0; +static int ao_eof_read = 0; +static int ao_flight_ground_accel; void ao_sleep(void *wchan) @@ -177,20 +179,26 @@ ao_sleep(void *wchan) for (;;) { if (ao_records_read > 20 && ao_flight_state == ao_flight_startup) { + ao_adc_static.accel = ao_flight_ground_accel; ao_insert(); return; } ret = fscanf(emulator_in, "%c %hx %hx %hx\n", &type, &tick, &a, &b); if (ret == EOF) { - printf ("no more data, exiting simulation\n"); - exit(0); + if (++ao_eof_read >= 1000) { + printf ("no more data, exiting simulation\n"); + exit(0); + } + ao_adc_static.tick += 10; + ao_insert(); return; } if (ret != 4) continue; switch (type) { case 'F': + ao_flight_ground_accel = a; break; case 'S': break; |