From c89c5e9068ecf242012532bc467046f08ada1faf Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Thu, 22 Mar 2018 10:24:55 -0600 Subject: Cleaned up data_recorder --- data_recorder.c | 41 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) (limited to 'data_recorder.c') diff --git a/data_recorder.c b/data_recorder.c index f2d89e7..eef233d 100644 --- a/data_recorder.c +++ b/data_recorder.c @@ -1,51 +1,30 @@ -// Data recorder mod with GUI showing light positions. - -#ifdef __linux__ -#include -#endif - -#include -#include -#include +/** + * Most of the data recorder functionality lives in the library now; this just enables + * stdout by default if no record file is specified. + */ #include -#include #include #include -#include - -#ifndef _MSC_VER -#include -#endif - -#include "redist/os_generic.h" - -struct SurviveContext *ctx; - int main(int argc, char **argv) { - ctx = survive_init(argc, argv); + SurviveContext *ctx = survive_init(argc, argv); if (ctx == 0) // implies -help or similiar return 0; - const char *outfile = survive_configs(ctx, "dataoutfile", SC_GET, ""); - - if (strlen(outfile) == 0) { - survive_configi(ctx, "datastdout", SC_SETCONFIG | SC_OVERRIDE, 1); + const char *dataout_file = survive_configs(ctx, "record", SC_SETCONFIG, ""); + if (strlen(dataout_file) == 0) { + survive_configi(ctx, "record-stdout", SC_SET | SC_OVERRIDE, 1); } survive_startup(ctx); if (survive_configi(ctx, "calibrate", SC_GET, 1)) { - fprintf(stderr, "Installing calibration\n"); + SV_INFO("Installing calibration"); survive_cal_install(ctx); } - if (!ctx) { - fprintf(stderr, "Fatal. Could not start\n"); - exit(1); - } - while (survive_poll(ctx) == 0) { } + survive_close(ctx); return 0; } -- cgit v1.2.3