From 8010b7e24f17789c859abc507282bc8a726c3006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BENEDEK=20L=C3=A1szl=C3=B3?= Date: Fri, 21 Feb 2025 12:09:36 +0100 Subject: [PATCH] dc mode flag --- src/recorder/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/recorder/main.c b/src/recorder/main.c index 0a72318..b3590a3 100644 --- a/src/recorder/main.c +++ b/src/recorder/main.c @@ -10,6 +10,7 @@ const char* DEFAULT_TYPE = "float"; const char* DEFAULT_RANGE = "10V"; const uint8_t DEFAULT_CHANNEL = 0; +const bool DEFAULT_DC_MODE = false; const uint32_t DEFAULT_BUFFERSIZE = 10000; const uint32_t DEFAULT_MAX_BUFFERSIZE = DEFAULT_BUFFERSIZE * 5; const uint32_t DEFAULT_SAMPLE_INTERVAL = 1000; @@ -19,6 +20,7 @@ bool stop = false; uint8_t* channel; uint32_t* max_buffersize; +// ctrl+c -> stop void capture_stop(int signal) { (void)signal; stop = true; @@ -118,6 +120,7 @@ int main(int argc, char** argv) { char** type = c_flag_string("type", "t", "type for output", DEFAULT_TYPE); char** range = c_flag_string("range", "r", "voltage range", DEFAULT_RANGE); channel = c_flag_uint8("channel", "c", "channel", DEFAULT_CHANNEL); + bool* dc = c_flag_bool("dc", "dc", "dc mode", DEFAULT_DC_MODE); uint32_t* buffersize = c_flag_uint32("buffersize", "b", "buffersize", DEFAULT_BUFFERSIZE); max_buffersize = c_flag_uint32("max_buffersize", "mb", "max buffersize the driver stores", DEFAULT_MAX_BUFFERSIZE); uint32_t* sample_interval = c_flag_uint32("sample_interval", "s", "sample interval", DEFAULT_SAMPLE_INTERVAL); @@ -161,7 +164,7 @@ int main(int argc, char** argv) { // configure picoscope int16_t unit = ps2000_open_unit(); - if (ps2000_set_channel(unit, PS2000_CHANNEL_A + *channel, true, false, selected_range) == 0) { + if (ps2000_set_channel(unit, PS2000_CHANNEL_A + *channel, true, *dc, selected_range) == 0) { fprintf(stderr, "set_channel failed!\n"); cleanup(unit); return -1;