From def59ab3540887315dfdbb30dd36aca3c92e5cc1 Mon Sep 17 00:00:00 2001 From: Scott White Date: Wed, 16 Mar 2011 09:45:35 -0700 Subject: [PATCH] added a clear flag for the pedometer --- examples/omron_720IT_test/omron_720IT_csv_dump.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/omron_720IT_test/omron_720IT_csv_dump.c b/examples/omron_720IT_test/omron_720IT_csv_dump.c index 6d9b397..d624e1a 100644 --- a/examples/omron_720IT_test/omron_720IT_csv_dump.c +++ b/examples/omron_720IT_test/omron_720IT_csv_dump.c @@ -2,6 +2,7 @@ #include #include /* atoi */ #include +#include /* getopt */ #define SECONDS_PER_DAY 86400 @@ -20,9 +21,15 @@ int main(int argc, char** argv) char time_str[20]; struct tm *timeptr; time_t today_secs, other_secs; + int ch, clear_flag = 0; - if (argc > 1) - bank = atoi(argv[1]); + while((ch = getopt(argc, argv, "d")) != -1) { + switch (ch) { + case 'd': + clear_flag = 1; + break; + } + } if(test == NULL) { @@ -102,6 +109,9 @@ int main(int argc, char** argv) free(h); } } + if(clear_flag) { + ret = omron_clear_pd_memory(test); + } ret = omron_close(test); if(ret < 0) {