From 00efdf84f1b1c6b5b054e88a6ce1e7e439db48db Mon Sep 17 00:00:00 2001 From: hallgato Date: Fri, 21 Feb 2025 18:02:45 +0100 Subject: [PATCH] fix unit parsing (missin 'strcmp == 0') --- src/recorder/main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/recorder/main.c b/src/recorder/main.c index b3590a3..f831fe0 100644 --- a/src/recorder/main.c +++ b/src/recorder/main.c @@ -92,17 +92,17 @@ PS2000_RANGE parse_range(char* range) { } PS2000_TIME_UNITS parse_units(char* unit) { - if (strcmp(unit, "fs")) + if (strcmp(unit, "fs") == 0) return PS2000_FS; - if (strcmp(unit, "ps")) + if (strcmp(unit, "ps") == 0) return PS2000_PS; - if (strcmp(unit, "ns")) + if (strcmp(unit, "ns") == 0) return PS2000_US; - if (strcmp(unit, "us")) + if (strcmp(unit, "us") == 0) return PS2000_US; - if (strcmp(unit, "ms")) + if (strcmp(unit, "ms") == 0) return PS2000_MS; - if (strcmp(unit, "s")) + if (strcmp(unit, "s") == 0) return PS2000_S; return PS2000_MAX_TIME_UNITS; } @@ -145,8 +145,8 @@ int main(int argc, char** argv) { return -1; } - PS2000_TIME_UNITS selected_units = parse_units(*time_units); - if (selected_units == PS2000_MAX_TIME_UNITS) { + PS2000_TIME_UNITS selected_unit = parse_units(*time_units); + if (selected_unit == PS2000_MAX_TIME_UNITS) { fprintf(stderr, "invalid time unit: %s\n", *time_units); return -1; } @@ -178,7 +178,7 @@ int main(int argc, char** argv) { } // start data capture without aggregation - if (ps2000_run_streaming_ns(unit, *sample_interval, selected_units, *buffersize, false, 1, *max_buffersize) == 0) { + if (ps2000_run_streaming_ns(unit, *sample_interval, selected_unit, *buffersize, false, 1, *max_buffersize) == 0) { fprintf(stderr, "run_streaming_ns failed!\n"); cleanup(unit); return -1; @@ -194,4 +194,4 @@ int main(int argc, char** argv) { cleanup(unit); return 0; -} \ No newline at end of file +}