set default n_scan value to 10 for insn demo, added check that it is
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 5 Mar 2003 17:01:34 +0000 (17:01 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 5 Mar 2003 17:01:34 +0000 (17:01 +0000)
not set larger than MAX_SAMPLES

demo/insn.c

index 80f1d675f7563df618aabd491c96049ba3203f23..33978bcf761e8679ca7e5e80fff2eb916a10011a 100644 (file)
@@ -48,7 +48,12 @@ int main(int argc, char *argv[])
        struct timeval t1,t2;
        lsampl_t data[MAX_SAMPLES];
 
+       n_scan = 10;    /* override default n_scan value to something more suitable */
        parse_options(argc,argv);
+       if( n_scan > MAX_SAMPLES ){
+               fprintf( stderr, "Requested too many samples, reducing to %i\n", MAX_SAMPLES );
+               n_scan = MAX_SAMPLES;
+       }
 
        device=comedi_open(filename);
        if(!device){