FreeCalypso > hg > fc-rfcal-tools
comparison cmu200/sercmd.c @ 11:aeffe53e110d
fc-cmu200d: freq-meas works
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 21 May 2017 19:22:11 +0000 |
parents | bd62be88259d |
children | 99f753d4ccaf |
comparison
equal
deleted
inserted
replaced
10:34a66394bea0 | 11:aeffe53e110d |
---|---|
42 pos += cc; | 42 pos += cc; |
43 if (instrument_response[pos-1] == '\n') | 43 if (instrument_response[pos-1] == '\n') |
44 break; | 44 break; |
45 } | 45 } |
46 instrument_response[pos-1] = '\0'; | 46 instrument_response[pos-1] = '\0'; |
47 if (pos >= 2 && instrument_response[pos-2] == '\r') | |
48 instrument_response[pos-2] = '\0'; | |
47 printf("Instrument response: %s\n", instrument_response); | 49 printf("Instrument response: %s\n", instrument_response); |
48 } | 50 } |
49 | 51 |
50 collect_staropc_response() | 52 collect_staropc_response() |
51 { | 53 { |
52 collect_instr_response(); | 54 collect_instr_response(); |
53 if (instrument_response[0] != '1' || | 55 if (instrument_response[0] != '1' || instrument_response[1]) { |
54 instrument_response[1] && !isspace(instrument_response[1])) { | |
55 fprintf(stderr, "error: unexpected response to *OPC?\n"); | 56 fprintf(stderr, "error: unexpected response to *OPC?\n"); |
56 exit(1); | 57 exit(1); |
57 } | 58 } |
58 } | 59 } |
60 | |
61 parse_commasep_response(argv, expect_count) | |
62 char **argv; | |
63 { | |
64 char *cp, *sp; | |
65 int i; | |
66 | |
67 cp = instrument_response; | |
68 for (i = 0; i < expect_count - 1; i++) { | |
69 argv[i] = cp; | |
70 sp = index(cp, ','); | |
71 if (!sp) | |
72 return(-1); | |
73 *sp = '\0'; | |
74 cp = sp + 1; | |
75 } | |
76 argv[i] = cp; | |
77 if (index(cp, ',')) | |
78 return(-1); | |
79 return(0); | |
80 } |