X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=ao_flight_test.c;h=e9c6a5304d8be85e22402e4a128cfd64698887cf;hb=d3dbd8949e1102220ad5fd0863f493c819b96e46;hp=dea7b31ce05043ded361cde6f5991651b146dc7d;hpb=de7814c738488c2c16c6216c93fa78128895e5d5;p=fw%2Faltos 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;