]>
Commit | Line | Data |
---|---|---|
e93cdf42 | 1 | /* |
50985c20 | 2 | * This file is part of the libsigrok project. |
e93cdf42 BV |
3 | * |
4 | * Copyright (C) 2012 Bert Vermeulen <bert@biot.com> | |
5 | * | |
6 | * This program is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | */ | |
19 | ||
6ec6c43b | 20 | #include <config.h> |
e93cdf42 | 21 | #include <glib.h> |
e93cdf42 | 22 | #include <stdlib.h> |
d822726d | 23 | #include <stdarg.h> |
e93cdf42 | 24 | #include <string.h> |
b907d62f | 25 | #include <limits.h> |
e93cdf42 | 26 | #include <math.h> |
c1aae900 | 27 | #include <libsigrok/libsigrok.h> |
515ab088 | 28 | #include "libsigrok-internal.h" |
6cf1a87b | 29 | #include "protocol.h" |
e93cdf42 | 30 | |
b907d62f AJ |
31 | #define JOB_TIMEOUT 300 |
32 | ||
33 | #define INFINITE_INTERVAL INT_MAX | |
34 | #define SAMPLERATE_INTERVAL -1 | |
35 | ||
36 | static const struct agdmm_job *job_current(const struct dev_context *devc) | |
37 | { | |
38 | return &devc->profile->jobs[devc->current_job]; | |
39 | } | |
40 | ||
41 | static void job_done(struct dev_context *devc) | |
42 | { | |
43 | devc->job_running = FALSE; | |
44 | } | |
45 | ||
46 | static void job_again(struct dev_context *devc) | |
47 | { | |
48 | devc->job_again = TRUE; | |
49 | } | |
50 | ||
51 | static gboolean job_is_running(const struct dev_context *devc) | |
52 | { | |
53 | return devc->job_running; | |
54 | } | |
55 | ||
56 | static gboolean job_in_interval(const struct dev_context *devc) | |
57 | { | |
58 | int64_t job_start = devc->jobs_start[devc->current_job]; | |
59 | int64_t now = g_get_monotonic_time() / 1000; | |
60 | int interval = job_current(devc)->interval; | |
61 | if (interval == SAMPLERATE_INTERVAL) | |
62 | interval = 1000 / devc->cur_samplerate; | |
63 | return (now - job_start) < interval || interval == INFINITE_INTERVAL; | |
64 | } | |
65 | ||
66 | static gboolean job_has_timeout(const struct dev_context *devc) | |
67 | { | |
68 | int64_t job_start = devc->jobs_start[devc->current_job]; | |
69 | int64_t now = g_get_monotonic_time() / 1000; | |
70 | return job_is_running(devc) && (now - job_start) > JOB_TIMEOUT; | |
71 | } | |
72 | ||
73 | static const struct agdmm_job *job_next(struct dev_context *devc) | |
74 | { | |
75 | int current_job = devc->current_job; | |
76 | do { | |
77 | devc->current_job++; | |
78 | if (!job_current(devc)->send) | |
79 | devc->current_job = 0; | |
80 | } while(job_in_interval(devc) && devc->current_job != current_job); | |
81 | return job_current(devc); | |
82 | } | |
83 | ||
84 | static void job_run_again(const struct sr_dev_inst *sdi) | |
85 | { | |
86 | struct dev_context *devc = sdi->priv; | |
87 | devc->job_again = FALSE; | |
88 | devc->job_running = TRUE; | |
89 | if (job_current(devc)->send(sdi) == SR_ERR_NA) | |
90 | job_done(devc); | |
91 | } | |
92 | ||
93 | static void job_run(const struct sr_dev_inst *sdi) | |
94 | { | |
95 | struct dev_context *devc = sdi->priv; | |
96 | int64_t now = g_get_monotonic_time() / 1000; | |
97 | devc->jobs_start[devc->current_job] = now; | |
98 | job_run_again(sdi); | |
99 | } | |
100 | ||
e93cdf42 BV |
101 | static void dispatch(const struct sr_dev_inst *sdi) |
102 | { | |
b907d62f | 103 | struct dev_context *devc = sdi->priv; |
e93cdf42 | 104 | |
b907d62f AJ |
105 | if (devc->job_again) { |
106 | job_run_again(sdi); | |
107 | return; | |
e93cdf42 | 108 | } |
b907d62f AJ |
109 | |
110 | if (!job_is_running(devc)) | |
111 | job_next(devc); | |
112 | else if (job_has_timeout(devc)) | |
113 | job_done(devc); | |
114 | ||
115 | if (!job_is_running(devc) && !job_in_interval(devc)) | |
116 | job_run(sdi); | |
e93cdf42 BV |
117 | } |
118 | ||
119 | static void receive_line(const struct sr_dev_inst *sdi) | |
120 | { | |
121 | struct dev_context *devc; | |
122 | const struct agdmm_recv *recvs, *recv; | |
123 | GRegex *reg; | |
124 | GMatchInfo *match; | |
125 | int i; | |
126 | ||
127 | devc = sdi->priv; | |
128 | ||
129 | /* Strip CRLF */ | |
130 | while (devc->buflen) { | |
131 | if (*(devc->buf + devc->buflen - 1) == '\r' | |
132 | || *(devc->buf + devc->buflen - 1) == '\n') | |
133 | *(devc->buf + --devc->buflen) = '\0'; | |
134 | else | |
135 | break; | |
136 | } | |
38d326e8 | 137 | sr_spew("Received '%s'.", devc->buf); |
e93cdf42 BV |
138 | |
139 | recv = NULL; | |
140 | recvs = devc->profile->recvs; | |
141 | for (i = 0; (&recvs[i])->recv_regex; i++) { | |
142 | reg = g_regex_new((&recvs[i])->recv_regex, 0, 0, NULL); | |
143 | if (g_regex_match(reg, (char *)devc->buf, 0, &match)) { | |
144 | recv = &recvs[i]; | |
145 | break; | |
146 | } | |
147 | g_match_info_unref(match); | |
148 | g_regex_unref(reg); | |
149 | } | |
150 | if (recv) { | |
b907d62f AJ |
151 | enum job_type type = recv->recv(sdi, match); |
152 | if (type == job_current(devc)->type) | |
153 | job_done(devc); | |
154 | else if (type == JOB_AGAIN) | |
155 | job_again(devc); | |
e93cdf42 BV |
156 | g_match_info_unref(match); |
157 | g_regex_unref(reg); | |
f2e86bbf | 158 | } else |
38d326e8 | 159 | sr_dbg("Unknown line '%s'.", devc->buf); |
e93cdf42 BV |
160 | |
161 | /* Done with this. */ | |
162 | devc->buflen = 0; | |
e93cdf42 BV |
163 | } |
164 | ||
165 | SR_PRIV int agdmm_receive_data(int fd, int revents, void *cb_data) | |
166 | { | |
642e9d62 | 167 | struct sr_dev_inst *sdi; |
e93cdf42 | 168 | struct dev_context *devc; |
fb3a1505 | 169 | struct sr_serial_dev_inst *serial; |
e93cdf42 BV |
170 | int len; |
171 | ||
109a3ba4 BV |
172 | (void)fd; |
173 | ||
e93cdf42 BV |
174 | if (!(sdi = cb_data)) |
175 | return TRUE; | |
176 | ||
177 | if (!(devc = sdi->priv)) | |
178 | return TRUE; | |
179 | ||
fb3a1505 | 180 | serial = sdi->conn; |
e93cdf42 BV |
181 | if (revents == G_IO_IN) { |
182 | /* Serial data arrived. */ | |
0c5f2abc | 183 | while (AGDMM_BUFSIZE - devc->buflen - 1 > 0) { |
e0b781a4 | 184 | len = serial_read_nonblocking(serial, devc->buf + devc->buflen, 1); |
f2e86bbf BV |
185 | if (len < 1) |
186 | break; | |
187 | devc->buflen += len; | |
188 | *(devc->buf + devc->buflen) = '\0'; | |
189 | if (*(devc->buf + devc->buflen - 1) == '\n') { | |
190 | /* End of line */ | |
191 | receive_line(sdi); | |
192 | break; | |
e93cdf42 BV |
193 | } |
194 | } | |
195 | } | |
196 | ||
197 | dispatch(sdi); | |
198 | ||
5b6829ea | 199 | if (sr_sw_limits_check(&devc->limits)) |
695dc859 | 200 | sdi->driver->dev_acquisition_stop(sdi); |
e93cdf42 BV |
201 | |
202 | return TRUE; | |
203 | } | |
204 | ||
d822726d | 205 | static int agdmm_send(const struct sr_dev_inst *sdi, const char *cmd, ...) |
e93cdf42 | 206 | { |
fb3a1505 | 207 | struct sr_serial_dev_inst *serial; |
d822726d | 208 | va_list args; |
e93cdf42 BV |
209 | char buf[32]; |
210 | ||
fb3a1505 BV |
211 | serial = sdi->conn; |
212 | ||
d822726d | 213 | va_start(args, cmd); |
7ab126ca | 214 | vsnprintf(buf, sizeof(buf) - 3, cmd, args); |
d822726d AJ |
215 | va_end(args); |
216 | sr_spew("Sending '%s'.", buf); | |
e93cdf42 | 217 | if (!strncmp(buf, "*IDN?", 5)) |
90486ba8 | 218 | strcat(buf, "\r\n"); |
e93cdf42 | 219 | else |
90486ba8 | 220 | strcat(buf, "\n\r\n"); |
95779b43 | 221 | if (serial_write_blocking(serial, buf, strlen(buf), SERIAL_WRITE_TIMEOUT_MS) < (int)strlen(buf)) { |
081c214e | 222 | sr_err("Failed to send."); |
e93cdf42 BV |
223 | return SR_ERR; |
224 | } | |
ce4d26dd | 225 | |
e93cdf42 BV |
226 | return SR_OK; |
227 | } | |
228 | ||
a4394fb3 | 229 | static int send_stat(const struct sr_dev_inst *sdi) |
e93cdf42 | 230 | { |
e93cdf42 BV |
231 | return agdmm_send(sdi, "STAT?"); |
232 | } | |
233 | ||
8c0152f2 | 234 | static int recv_stat_u123x(const struct sr_dev_inst *sdi, GMatchInfo *match) |
e93cdf42 | 235 | { |
e6b021f3 BV |
236 | struct dev_context *devc; |
237 | char *s; | |
238 | ||
239 | devc = sdi->priv; | |
240 | s = g_match_info_fetch(match, 1); | |
38d326e8 | 241 | sr_spew("STAT response '%s'.", s); |
e6b021f3 BV |
242 | |
243 | /* Max, Min or Avg mode -- no way to tell which, so we'll | |
244 | * set both flags to denote it's not a normal measurement. */ | |
245 | if (s[0] == '1') | |
d822726d | 246 | devc->cur_mqflags[0] |= SR_MQFLAG_MAX | SR_MQFLAG_MIN; |
e6b021f3 | 247 | else |
d822726d | 248 | devc->cur_mqflags[0] &= ~(SR_MQFLAG_MAX | SR_MQFLAG_MIN); |
e93cdf42 | 249 | |
e6b021f3 | 250 | if (s[1] == '1') |
d822726d | 251 | devc->cur_mqflags[0] |= SR_MQFLAG_RELATIVE; |
e6b021f3 | 252 | else |
d822726d | 253 | devc->cur_mqflags[0] &= ~SR_MQFLAG_RELATIVE; |
e6b021f3 BV |
254 | |
255 | /* Triggered or auto hold modes. */ | |
256 | if (s[2] == '1' || s[3] == '1') | |
d822726d | 257 | devc->cur_mqflags[0] |= SR_MQFLAG_HOLD; |
e6b021f3 | 258 | else |
d822726d | 259 | devc->cur_mqflags[0] &= ~SR_MQFLAG_HOLD; |
e6b021f3 BV |
260 | |
261 | /* Temp/aux mode. */ | |
262 | if (s[7] == '1') | |
263 | devc->mode_tempaux = TRUE; | |
264 | else | |
265 | devc->mode_tempaux = FALSE; | |
266 | ||
38d326e8 | 267 | /* Continuity mode. */ |
e6b021f3 BV |
268 | if (s[16] == '1') |
269 | devc->mode_continuity = TRUE; | |
270 | else | |
271 | devc->mode_continuity = FALSE; | |
272 | ||
273 | g_free(s); | |
e93cdf42 | 274 | |
b907d62f | 275 | return JOB_STAT; |
e93cdf42 BV |
276 | } |
277 | ||
173378f0 BV |
278 | static int recv_stat_u124x(const struct sr_dev_inst *sdi, GMatchInfo *match) |
279 | { | |
280 | struct dev_context *devc; | |
281 | char *s; | |
282 | ||
283 | devc = sdi->priv; | |
284 | s = g_match_info_fetch(match, 1); | |
285 | sr_spew("STAT response '%s'.", s); | |
286 | ||
287 | /* Max, Min or Avg mode -- no way to tell which, so we'll | |
288 | * set both flags to denote it's not a normal measurement. */ | |
289 | if (s[0] == '1') | |
d822726d | 290 | devc->cur_mqflags[0] |= SR_MQFLAG_MAX | SR_MQFLAG_MIN; |
173378f0 | 291 | else |
d822726d | 292 | devc->cur_mqflags[0] &= ~(SR_MQFLAG_MAX | SR_MQFLAG_MIN); |
173378f0 BV |
293 | |
294 | if (s[1] == '1') | |
d822726d | 295 | devc->cur_mqflags[0] |= SR_MQFLAG_RELATIVE; |
173378f0 | 296 | else |
d822726d | 297 | devc->cur_mqflags[0] &= ~SR_MQFLAG_RELATIVE; |
173378f0 BV |
298 | |
299 | /* Hold mode. */ | |
300 | if (s[7] == '1') | |
d822726d | 301 | devc->cur_mqflags[0] |= SR_MQFLAG_HOLD; |
173378f0 | 302 | else |
d822726d | 303 | devc->cur_mqflags[0] &= ~SR_MQFLAG_HOLD; |
173378f0 BV |
304 | |
305 | g_free(s); | |
306 | ||
b907d62f | 307 | return JOB_STAT; |
173378f0 BV |
308 | } |
309 | ||
8c0152f2 BV |
310 | static int recv_stat_u125x(const struct sr_dev_inst *sdi, GMatchInfo *match) |
311 | { | |
312 | struct dev_context *devc; | |
313 | char *s; | |
314 | ||
315 | devc = sdi->priv; | |
316 | s = g_match_info_fetch(match, 1); | |
38d326e8 | 317 | sr_spew("STAT response '%s'.", s); |
8c0152f2 | 318 | |
8f68f36b AJ |
319 | /* dBm/dBV modes. */ |
320 | if ((s[2] & ~0x20) == 'M') | |
321 | devc->mode_dbm_dbv = devc->cur_unit[0] = SR_UNIT_DECIBEL_MW; | |
322 | else if ((s[2] & ~0x20) == 'V') | |
323 | devc->mode_dbm_dbv = devc->cur_unit[0] = SR_UNIT_DECIBEL_VOLT; | |
324 | else | |
325 | devc->mode_dbm_dbv = 0; | |
326 | ||
8c0152f2 BV |
327 | /* Peak hold mode. */ |
328 | if (s[4] == '1') | |
d822726d | 329 | devc->cur_mqflags[0] |= SR_MQFLAG_MAX; |
8c0152f2 | 330 | else |
d822726d | 331 | devc->cur_mqflags[0] &= ~SR_MQFLAG_MAX; |
8c0152f2 BV |
332 | |
333 | /* Triggered hold mode. */ | |
334 | if (s[7] == '1') | |
d822726d | 335 | devc->cur_mqflags[0] |= SR_MQFLAG_HOLD; |
8c0152f2 | 336 | else |
d822726d | 337 | devc->cur_mqflags[0] &= ~SR_MQFLAG_HOLD; |
8c0152f2 BV |
338 | |
339 | g_free(s); | |
340 | ||
b907d62f | 341 | return JOB_STAT; |
8c0152f2 BV |
342 | } |
343 | ||
43185ed3 AJ |
344 | static int recv_stat_u128x(const struct sr_dev_inst *sdi, GMatchInfo *match) |
345 | { | |
346 | struct dev_context *devc; | |
347 | char *s; | |
348 | ||
349 | devc = sdi->priv; | |
350 | s = g_match_info_fetch(match, 1); | |
351 | sr_spew("STAT response '%s'.", s); | |
352 | ||
353 | /* Max, Min or Avg mode -- no way to tell which, so we'll | |
354 | * set both flags to denote it's not a normal measurement. */ | |
355 | if (s[0] == '1') | |
d822726d | 356 | devc->cur_mqflags[0] |= SR_MQFLAG_MAX | SR_MQFLAG_MIN | SR_MQFLAG_AVG; |
43185ed3 | 357 | else |
d822726d | 358 | devc->cur_mqflags[0] &= ~(SR_MQFLAG_MAX | SR_MQFLAG_MIN | SR_MQFLAG_AVG); |
43185ed3 | 359 | |
8f68f36b AJ |
360 | /* dBm/dBV modes. */ |
361 | if ((s[2] & ~0x20) == 'M') | |
362 | devc->mode_dbm_dbv = devc->cur_unit[0] = SR_UNIT_DECIBEL_MW; | |
363 | else if ((s[2] & ~0x20) == 'V') | |
364 | devc->mode_dbm_dbv = devc->cur_unit[0] = SR_UNIT_DECIBEL_VOLT; | |
365 | else | |
366 | devc->mode_dbm_dbv = 0; | |
367 | ||
43185ed3 AJ |
368 | /* Peak hold mode. */ |
369 | if (s[4] == '4') | |
d822726d | 370 | devc->cur_mqflags[0] |= SR_MQFLAG_MAX; |
43185ed3 | 371 | else |
d822726d | 372 | devc->cur_mqflags[0] &= ~SR_MQFLAG_MAX; |
43185ed3 AJ |
373 | |
374 | /* Null function. */ | |
375 | if (s[1] == '1') | |
d822726d | 376 | devc->cur_mqflags[0] |= SR_MQFLAG_RELATIVE; |
43185ed3 | 377 | else |
d822726d | 378 | devc->cur_mqflags[0] &= ~SR_MQFLAG_RELATIVE; |
43185ed3 AJ |
379 | |
380 | /* Triggered or auto hold modes. */ | |
381 | if (s[7] == '1' || s[11] == '1') | |
d822726d | 382 | devc->cur_mqflags[0] |= SR_MQFLAG_HOLD; |
43185ed3 | 383 | else |
d822726d | 384 | devc->cur_mqflags[0] &= ~SR_MQFLAG_HOLD; |
43185ed3 AJ |
385 | |
386 | g_free(s); | |
387 | ||
b907d62f | 388 | return JOB_STAT; |
43185ed3 AJ |
389 | } |
390 | ||
a4394fb3 | 391 | static int send_fetc(const struct sr_dev_inst *sdi) |
e93cdf42 | 392 | { |
b907d62f AJ |
393 | struct dev_context *devc = sdi->priv; |
394 | ||
43185ed3 | 395 | if (devc->mode_squarewave) |
b907d62f AJ |
396 | return SR_ERR_NA; |
397 | ||
d822726d AJ |
398 | if (devc->cur_channel->index > 0) |
399 | return agdmm_send(sdi, "FETC? @%d", devc->cur_channel->index + 1); | |
400 | else | |
401 | return agdmm_send(sdi, "FETC?"); | |
e93cdf42 BV |
402 | } |
403 | ||
a4394fb3 | 404 | static int recv_fetc(const struct sr_dev_inst *sdi, GMatchInfo *match) |
e93cdf42 BV |
405 | { |
406 | struct dev_context *devc; | |
407 | struct sr_datafeed_packet packet; | |
16aef676 UH |
408 | struct sr_datafeed_analog analog; |
409 | struct sr_analog_encoding encoding; | |
410 | struct sr_analog_meaning meaning; | |
411 | struct sr_analog_spec spec; | |
e93cdf42 | 412 | float fvalue; |
f216eb86 | 413 | const char *s; |
fe9d5abe | 414 | char *mstr; |
8f68f36b | 415 | int i, exp; |
e93cdf42 | 416 | |
38d326e8 | 417 | sr_spew("FETC reply '%s'.", g_match_info_get_string(match)); |
e93cdf42 | 418 | devc = sdi->priv; |
d822726d | 419 | i = devc->cur_channel->index; |
e93cdf42 | 420 | |
d822726d | 421 | if (devc->cur_mq[i] == -1) |
b907d62f AJ |
422 | /* This detects when channel P2 is reporting TEMP as an identical |
423 | * copy of channel P3. In this case, we just skip P2. */ | |
424 | goto skip_value; | |
e93cdf42 | 425 | |
f216eb86 BV |
426 | s = g_match_info_get_string(match); |
427 | if (!strcmp(s, "-9.90000000E+37") || !strcmp(s, "+9.90000000E+37")) { | |
74ac7d7f | 428 | /* An invalid measurement shows up on the display as "O.L", but |
e93cdf42 BV |
429 | * comes through like this. Since comparing 38-digit floats |
430 | * is rather problematic, we'll cut through this here. */ | |
431 | fvalue = NAN; | |
432 | } else { | |
433 | mstr = g_match_info_fetch(match, 1); | |
7c03b564 | 434 | if (sr_atof_ascii(mstr, &fvalue) != SR_OK) { |
fe9d5abe | 435 | g_free(mstr); |
51b92b7d | 436 | sr_dbg("Invalid float."); |
e93cdf42 BV |
437 | return SR_ERR; |
438 | } | |
fe9d5abe | 439 | g_free(mstr); |
d822726d AJ |
440 | if (devc->cur_exponent[i] != 0) |
441 | fvalue *= powf(10, devc->cur_exponent[i]); | |
e93cdf42 BV |
442 | } |
443 | ||
8f68f36b AJ |
444 | if (devc->cur_unit[i] == SR_UNIT_DECIBEL_MW || |
445 | devc->cur_unit[i] == SR_UNIT_DECIBEL_VOLT || | |
446 | devc->cur_unit[i] == SR_UNIT_PERCENTAGE) { | |
447 | mstr = g_match_info_fetch(match, 2); | |
448 | if (mstr && sr_atoi(mstr, &exp) == SR_OK) { | |
449 | devc->cur_digits[i] = MIN(4 - exp, devc->cur_digits[i]); | |
450 | devc->cur_encoding[i] = MIN(5 - exp, devc->cur_encoding[i]); | |
451 | } | |
452 | g_free(mstr); | |
453 | } | |
454 | ||
4435966e | 455 | sr_analog_init(&analog, &encoding, &meaning, &spec, |
d822726d AJ |
456 | devc->cur_digits[i] - devc->cur_exponent[i]); |
457 | analog.meaning->mq = devc->cur_mq[i]; | |
458 | analog.meaning->unit = devc->cur_unit[i]; | |
459 | analog.meaning->mqflags = devc->cur_mqflags[i]; | |
460 | analog.meaning->channels = g_slist_append(NULL, devc->cur_channel); | |
e93cdf42 BV |
461 | analog.num_samples = 1; |
462 | analog.data = &fvalue; | |
d822726d | 463 | encoding.digits = devc->cur_encoding[i] - devc->cur_exponent[i]; |
16aef676 | 464 | packet.type = SR_DF_ANALOG; |
e93cdf42 | 465 | packet.payload = &analog; |
695dc859 | 466 | sr_session_send(sdi, &packet); |
d822726d | 467 | g_slist_free(analog.meaning->channels); |
e93cdf42 | 468 | |
5b6829ea | 469 | sr_sw_limits_update_samples_read(&devc->limits, 1); |
e93cdf42 | 470 | |
b907d62f AJ |
471 | skip_value:; |
472 | struct sr_channel *prev_chan = devc->cur_channel; | |
473 | devc->cur_channel = sr_next_enabled_channel(sdi, devc->cur_channel); | |
474 | if (devc->cur_channel->index > prev_chan->index) | |
475 | return JOB_AGAIN; | |
476 | else | |
477 | return JOB_FETC; | |
e93cdf42 BV |
478 | } |
479 | ||
a4394fb3 | 480 | static int send_conf(const struct sr_dev_inst *sdi) |
e93cdf42 | 481 | { |
d822726d AJ |
482 | struct dev_context *devc = sdi->priv; |
483 | ||
d822726d | 484 | /* Do not try to send CONF? for internal temperature channel. */ |
d822726d AJ |
485 | if (devc->cur_conf->index == MAX(devc->profile->nb_channels - 1, 1)) |
486 | return SR_ERR_NA; | |
487 | ||
488 | if (devc->cur_conf->index > 0) | |
489 | return agdmm_send(sdi, "CONF? @%d", devc->cur_conf->index + 1); | |
490 | else | |
491 | return agdmm_send(sdi, "CONF?"); | |
e93cdf42 BV |
492 | } |
493 | ||
a4394fb3 | 494 | static int recv_conf_u123x(const struct sr_dev_inst *sdi, GMatchInfo *match) |
e93cdf42 BV |
495 | { |
496 | struct dev_context *devc; | |
4435966e | 497 | char *mstr, *rstr; |
d822726d | 498 | int i, resolution; |
e93cdf42 | 499 | |
38d326e8 | 500 | sr_spew("CONF? response '%s'.", g_match_info_get_string(match)); |
e93cdf42 | 501 | devc = sdi->priv; |
d822726d | 502 | i = devc->cur_conf->index; |
4435966e AJ |
503 | |
504 | rstr = g_match_info_fetch(match, 2); | |
505 | if (rstr) | |
506 | sr_atoi(rstr, &resolution); | |
507 | g_free(rstr); | |
508 | ||
e93cdf42 BV |
509 | mstr = g_match_info_fetch(match, 1); |
510 | if (!strcmp(mstr, "V")) { | |
d822726d AJ |
511 | devc->cur_mq[i] = SR_MQ_VOLTAGE; |
512 | devc->cur_unit[i] = SR_UNIT_VOLT; | |
513 | devc->cur_mqflags[i] = 0; | |
514 | devc->cur_exponent[i] = 0; | |
515 | devc->cur_digits[i] = 4 - resolution; | |
0c5f2abc | 516 | } else if (!strcmp(mstr, "MV")) { |
e6b021f3 | 517 | if (devc->mode_tempaux) { |
d822726d | 518 | devc->cur_mq[i] = SR_MQ_TEMPERATURE; |
f3f19d11 UH |
519 | /* No way to detect whether Fahrenheit or Celsius |
520 | * is used, so we'll just default to Celsius. */ | |
d822726d AJ |
521 | devc->cur_unit[i] = SR_UNIT_CELSIUS; |
522 | devc->cur_mqflags[i] = 0; | |
523 | devc->cur_exponent[i] = 0; | |
524 | devc->cur_digits[i] = 1; | |
e6b021f3 | 525 | } else { |
d822726d AJ |
526 | devc->cur_mq[i] = SR_MQ_VOLTAGE; |
527 | devc->cur_unit[i] = SR_UNIT_VOLT; | |
528 | devc->cur_mqflags[i] = 0; | |
529 | devc->cur_exponent[i] = -3; | |
530 | devc->cur_digits[i] = 5 - resolution; | |
e6b021f3 | 531 | } |
0c5f2abc | 532 | } else if (!strcmp(mstr, "A")) { |
d822726d AJ |
533 | devc->cur_mq[i] = SR_MQ_CURRENT; |
534 | devc->cur_unit[i] = SR_UNIT_AMPERE; | |
535 | devc->cur_mqflags[i] = 0; | |
536 | devc->cur_exponent[i] = 0; | |
537 | devc->cur_digits[i] = 3 - resolution; | |
0c5f2abc | 538 | } else if (!strcmp(mstr, "UA")) { |
d822726d AJ |
539 | devc->cur_mq[i] = SR_MQ_CURRENT; |
540 | devc->cur_unit[i] = SR_UNIT_AMPERE; | |
541 | devc->cur_mqflags[i] = 0; | |
542 | devc->cur_exponent[i] = -6; | |
543 | devc->cur_digits[i] = 8 - resolution; | |
0c5f2abc | 544 | } else if (!strcmp(mstr, "FREQ")) { |
d822726d AJ |
545 | devc->cur_mq[i] = SR_MQ_FREQUENCY; |
546 | devc->cur_unit[i] = SR_UNIT_HERTZ; | |
547 | devc->cur_mqflags[i] = 0; | |
548 | devc->cur_exponent[i] = 0; | |
549 | devc->cur_digits[i] = 2 - resolution; | |
0c5f2abc | 550 | } else if (!strcmp(mstr, "RES")) { |
e6b021f3 | 551 | if (devc->mode_continuity) { |
d822726d AJ |
552 | devc->cur_mq[i] = SR_MQ_CONTINUITY; |
553 | devc->cur_unit[i] = SR_UNIT_BOOLEAN; | |
e6b021f3 | 554 | } else { |
d822726d AJ |
555 | devc->cur_mq[i] = SR_MQ_RESISTANCE; |
556 | devc->cur_unit[i] = SR_UNIT_OHM; | |
e6b021f3 | 557 | } |
d822726d AJ |
558 | devc->cur_mqflags[i] = 0; |
559 | devc->cur_exponent[i] = 0; | |
560 | devc->cur_digits[i] = 1 - resolution; | |
873c0d11 | 561 | } else if (!strcmp(mstr, "DIOD")) { |
d822726d AJ |
562 | devc->cur_mq[i] = SR_MQ_VOLTAGE; |
563 | devc->cur_unit[i] = SR_UNIT_VOLT; | |
564 | devc->cur_mqflags[i] = SR_MQFLAG_DIODE; | |
565 | devc->cur_exponent[i] = 0; | |
566 | devc->cur_digits[i] = 3; | |
0c5f2abc | 567 | } else if (!strcmp(mstr, "CAP")) { |
d822726d AJ |
568 | devc->cur_mq[i] = SR_MQ_CAPACITANCE; |
569 | devc->cur_unit[i] = SR_UNIT_FARAD; | |
570 | devc->cur_mqflags[i] = 0; | |
571 | devc->cur_exponent[i] = 0; | |
572 | devc->cur_digits[i] = 9 - resolution; | |
e93cdf42 | 573 | } else |
38d326e8 | 574 | sr_dbg("Unknown first argument."); |
e93cdf42 BV |
575 | g_free(mstr); |
576 | ||
4435966e | 577 | /* This is based on guess, supposing similarity with other models. */ |
d822726d | 578 | devc->cur_encoding[i] = devc->cur_digits[i] + 1; |
4435966e | 579 | |
e066c32a BV |
580 | if (g_match_info_get_match_count(match) == 4) { |
581 | mstr = g_match_info_fetch(match, 3); | |
e93cdf42 | 582 | /* Third value, if present, is always AC or DC. */ |
51b92b7d | 583 | if (!strcmp(mstr, "AC")) { |
d822726d AJ |
584 | devc->cur_mqflags[i] |= SR_MQFLAG_AC; |
585 | if (devc->cur_mq[i] == SR_MQ_VOLTAGE) | |
586 | devc->cur_mqflags[i] |= SR_MQFLAG_RMS; | |
51b92b7d | 587 | } else if (!strcmp(mstr, "DC")) { |
d822726d | 588 | devc->cur_mqflags[i] |= SR_MQFLAG_DC; |
51b92b7d | 589 | } else { |
a965748a | 590 | sr_dbg("Unknown first argument '%s'.", mstr); |
51b92b7d | 591 | } |
e93cdf42 | 592 | g_free(mstr); |
e6b021f3 | 593 | } else |
d822726d | 594 | devc->cur_mqflags[i] &= ~(SR_MQFLAG_AC | SR_MQFLAG_DC); |
e93cdf42 | 595 | |
b907d62f | 596 | return JOB_CONF; |
e93cdf42 BV |
597 | } |
598 | ||
173378f0 | 599 | static int recv_conf_u124x_5x(const struct sr_dev_inst *sdi, GMatchInfo *match) |
8c0152f2 BV |
600 | { |
601 | struct dev_context *devc; | |
4435966e | 602 | char *mstr, *rstr, *m2; |
d822726d | 603 | int i, resolution; |
8c0152f2 | 604 | |
38d326e8 | 605 | sr_spew("CONF? response '%s'.", g_match_info_get_string(match)); |
8c0152f2 | 606 | devc = sdi->priv; |
d822726d | 607 | i = devc->cur_conf->index; |
4435966e | 608 | |
43185ed3 AJ |
609 | devc->mode_squarewave = 0; |
610 | ||
d9251a2c | 611 | rstr = g_match_info_fetch(match, 4); |
4435966e | 612 | if (rstr && sr_atoi(rstr, &resolution) == SR_OK) { |
d822726d AJ |
613 | devc->cur_digits[i] = -resolution; |
614 | devc->cur_encoding[i] = -resolution + 1; | |
4435966e AJ |
615 | } |
616 | g_free(rstr); | |
617 | ||
d9251a2c | 618 | mstr = g_match_info_fetch(match, 1); |
8c0152f2 | 619 | if (!strncmp(mstr, "VOLT", 4)) { |
d822726d AJ |
620 | devc->cur_mq[i] = SR_MQ_VOLTAGE; |
621 | devc->cur_unit[i] = SR_UNIT_VOLT; | |
622 | devc->cur_mqflags[i] = 0; | |
623 | devc->cur_exponent[i] = 0; | |
8f68f36b AJ |
624 | if (i == 0 && devc->mode_dbm_dbv) { |
625 | devc->cur_unit[i] = devc->mode_dbm_dbv; | |
626 | devc->cur_digits[i] = 3; | |
627 | devc->cur_encoding[i] = 4; | |
628 | } | |
8c0152f2 | 629 | if (mstr[4] == ':') { |
96ed8625 AJ |
630 | if (!strncmp(mstr + 5, "ACDC", 4)) { |
631 | /* AC + DC offset */ | |
d822726d | 632 | devc->cur_mqflags[i] |= SR_MQFLAG_AC | SR_MQFLAG_DC | SR_MQFLAG_RMS; |
96ed8625 | 633 | } else if (!strncmp(mstr + 5, "AC", 2)) { |
d822726d | 634 | devc->cur_mqflags[i] |= SR_MQFLAG_AC | SR_MQFLAG_RMS; |
ee2bcdfc | 635 | } else if (!strncmp(mstr + 5, "DC", 2)) { |
d822726d | 636 | devc->cur_mqflags[i] |= SR_MQFLAG_DC; |
51b92b7d | 637 | } |
8c0152f2 | 638 | } else |
d822726d | 639 | devc->cur_mqflags[i] |= SR_MQFLAG_DC; |
0fe18626 | 640 | } else if (!strncmp(mstr, "CURR", 4)) { |
d822726d AJ |
641 | devc->cur_mq[i] = SR_MQ_CURRENT; |
642 | devc->cur_unit[i] = SR_UNIT_AMPERE; | |
643 | devc->cur_mqflags[i] = 0; | |
644 | devc->cur_exponent[i] = 0; | |
0fe18626 AJ |
645 | if (mstr[4] == ':') { |
646 | if (!strncmp(mstr + 5, "ACDC", 4)) { | |
647 | /* AC + DC offset */ | |
d822726d | 648 | devc->cur_mqflags[i] |= SR_MQFLAG_AC | SR_MQFLAG_DC | SR_MQFLAG_RMS; |
0fe18626 | 649 | } else if (!strncmp(mstr + 5, "AC", 2)) { |
d822726d | 650 | devc->cur_mqflags[i] |= SR_MQFLAG_AC | SR_MQFLAG_RMS; |
0fe18626 | 651 | } else if (!strncmp(mstr + 5, "DC", 2)) { |
d822726d | 652 | devc->cur_mqflags[i] |= SR_MQFLAG_DC; |
0fe18626 AJ |
653 | } |
654 | } else | |
d822726d | 655 | devc->cur_mqflags[i] |= SR_MQFLAG_DC; |
0c5f2abc | 656 | } else if (!strcmp(mstr, "RES")) { |
d822726d AJ |
657 | devc->cur_mq[i] = SR_MQ_RESISTANCE; |
658 | devc->cur_unit[i] = SR_UNIT_OHM; | |
659 | devc->cur_mqflags[i] = 0; | |
660 | devc->cur_exponent[i] = 0; | |
43185ed3 | 661 | } else if (!strcmp(mstr, "COND")) { |
d822726d AJ |
662 | devc->cur_mq[i] = SR_MQ_CONDUCTANCE; |
663 | devc->cur_unit[i] = SR_UNIT_SIEMENS; | |
664 | devc->cur_mqflags[i] = 0; | |
665 | devc->cur_exponent[i] = 0; | |
0c5f2abc | 666 | } else if (!strcmp(mstr, "CAP")) { |
d822726d AJ |
667 | devc->cur_mq[i] = SR_MQ_CAPACITANCE; |
668 | devc->cur_unit[i] = SR_UNIT_FARAD; | |
669 | devc->cur_mqflags[i] = 0; | |
670 | devc->cur_exponent[i] = 0; | |
43185ed3 | 671 | } else if (!strncmp(mstr, "FREQ", 4) || !strncmp(mstr, "FC1", 3)) { |
d822726d AJ |
672 | devc->cur_mq[i] = SR_MQ_FREQUENCY; |
673 | devc->cur_unit[i] = SR_UNIT_HERTZ; | |
674 | devc->cur_mqflags[i] = 0; | |
675 | devc->cur_exponent[i] = 0; | |
7ab126ca AJ |
676 | } else if (!strncmp(mstr, "PULS:PWID", 9)) { |
677 | devc->cur_mq[i] = SR_MQ_PULSE_WIDTH; | |
678 | devc->cur_unit[i] = SR_UNIT_SECOND; | |
679 | devc->cur_mqflags[i] = 0; | |
680 | devc->cur_exponent[i] = 0; | |
681 | devc->cur_encoding[i] = MIN(devc->cur_encoding[i], 6); | |
682 | } else if (!strncmp(mstr, "PULS:PDUT", 9)) { | |
683 | devc->cur_mq[i] = SR_MQ_DUTY_CYCLE; | |
684 | devc->cur_unit[i] = SR_UNIT_PERCENTAGE; | |
685 | devc->cur_mqflags[i] = 0; | |
686 | devc->cur_exponent[i] = 0; | |
687 | devc->cur_digits[i] = 3; | |
688 | devc->cur_encoding[i] = 4; | |
0c5f2abc | 689 | } else if (!strcmp(mstr, "CONT")) { |
d822726d | 690 | devc->cur_mq[i] = SR_MQ_CONTINUITY; |
d2f6abf6 | 691 | devc->cur_unit[i] = SR_UNIT_OHM; |
d822726d AJ |
692 | devc->cur_mqflags[i] = 0; |
693 | devc->cur_exponent[i] = 0; | |
873c0d11 | 694 | } else if (!strcmp(mstr, "DIOD")) { |
d822726d AJ |
695 | devc->cur_mq[i] = SR_MQ_VOLTAGE; |
696 | devc->cur_unit[i] = SR_UNIT_VOLT; | |
697 | devc->cur_mqflags[i] = SR_MQFLAG_DIODE; | |
698 | devc->cur_exponent[i] = 0; | |
699 | devc->cur_digits[i] = 4; | |
700 | devc->cur_encoding[i] = 5; | |
43185ed3 | 701 | } else if (!strncmp(mstr, "T1", 2) || !strncmp(mstr, "T2", 2) || |
d9251a2c | 702 | !strncmp(mstr, "TEMP", 2)) { |
d822726d | 703 | devc->cur_mq[i] = SR_MQ_TEMPERATURE; |
a965748a | 704 | m2 = g_match_info_fetch(match, 2); |
d822726d AJ |
705 | if (!m2) |
706 | /* | |
707 | * TEMP without param is for secondary display (channel P2) | |
708 | * and is identical to channel P3, so discard it. | |
709 | */ | |
710 | devc->cur_mq[i] = -1; | |
711 | else if (!strcmp(m2, "FAR")) | |
712 | devc->cur_unit[i] = SR_UNIT_FAHRENHEIT; | |
a965748a | 713 | else |
d822726d | 714 | devc->cur_unit[i] = SR_UNIT_CELSIUS; |
a965748a | 715 | g_free(m2); |
d822726d AJ |
716 | devc->cur_mqflags[i] = 0; |
717 | devc->cur_exponent[i] = 0; | |
718 | devc->cur_digits[i] = 1; | |
719 | devc->cur_encoding[i] = 2; | |
0c5f2abc | 720 | } else if (!strcmp(mstr, "SCOU")) { |
a965748a BV |
721 | /* |
722 | * Switch counter, not supported. Not sure what values | |
723 | * come from FETC in this mode, or how they would map | |
724 | * into libsigrok. | |
725 | */ | |
0c5f2abc | 726 | } else if (!strncmp(mstr, "CPER:", 5)) { |
d822726d AJ |
727 | devc->cur_mq[i] = SR_MQ_CURRENT; |
728 | devc->cur_unit[i] = SR_UNIT_PERCENTAGE; | |
729 | devc->cur_mqflags[i] = 0; | |
730 | devc->cur_exponent[i] = 0; | |
731 | devc->cur_digits[i] = 2; | |
732 | devc->cur_encoding[i] = 3; | |
43185ed3 AJ |
733 | } else if (!strcmp(mstr, "SQU")) { |
734 | /* | |
735 | * Square wave output, not supported. FETC just return | |
736 | * an error in this mode, so don't even call it. | |
737 | */ | |
738 | devc->mode_squarewave = 1; | |
51b92b7d | 739 | } else { |
a965748a | 740 | sr_dbg("Unknown first argument '%s'.", mstr); |
51b92b7d | 741 | } |
8c0152f2 BV |
742 | g_free(mstr); |
743 | ||
b907d62f AJ |
744 | struct sr_channel *prev_conf = devc->cur_conf; |
745 | devc->cur_conf = sr_next_enabled_channel(sdi, devc->cur_conf); | |
746 | if (devc->cur_conf->index == MAX(devc->profile->nb_channels - 1, 1)) | |
747 | devc->cur_conf = sr_next_enabled_channel(sdi, devc->cur_conf); | |
748 | if (devc->cur_conf->index > prev_conf->index) | |
749 | return JOB_AGAIN; | |
750 | else | |
751 | return JOB_CONF; | |
8c0152f2 BV |
752 | } |
753 | ||
81599cc5 BV |
754 | /* This comes in whenever the rotary switch is changed to a new position. |
755 | * We could use it to determine the major measurement mode, but we already | |
756 | * have the output of CONF? for that, which is more detailed. However | |
757 | * we do need to catch this here, or it'll show up in some other output. */ | |
a4394fb3 | 758 | static int recv_switch(const struct sr_dev_inst *sdi, GMatchInfo *match) |
e93cdf42 | 759 | { |
b907d62f | 760 | struct dev_context *devc = sdi->priv; |
e93cdf42 | 761 | |
38d326e8 | 762 | sr_spew("Switch '%s'.", g_match_info_get_string(match)); |
e93cdf42 | 763 | |
b907d62f AJ |
764 | devc->current_job = 0; |
765 | devc->job_running = FALSE; | |
766 | memset(devc->jobs_start, 0, sizeof(devc->jobs_start)); | |
767 | devc->cur_mq[0] = -1; | |
768 | if (devc->profile->nb_channels > 2) | |
769 | devc->cur_mq[1] = -1; | |
770 | ||
e93cdf42 BV |
771 | return SR_OK; |
772 | } | |
773 | ||
b907d62f | 774 | /* Poll CONF/STAT at 1Hz and values at samplerate. */ |
f857bd92 | 775 | SR_PRIV const struct agdmm_job agdmm_jobs_u12xx[] = { |
b907d62f AJ |
776 | { JOB_FETC, SAMPLERATE_INTERVAL, send_fetc }, |
777 | { JOB_CONF, 1000, send_conf }, | |
778 | { JOB_STAT, 1000, send_stat }, | |
9e9dba7b | 779 | ALL_ZERO |
e93cdf42 BV |
780 | }; |
781 | ||
8c0152f2 BV |
782 | SR_PRIV const struct agdmm_recv agdmm_recvs_u123x[] = { |
783 | { "^\"(\\d\\d.{18}\\d)\"$", recv_stat_u123x }, | |
a4394fb3 BV |
784 | { "^\\*([0-9])$", recv_switch }, |
785 | { "^([-+][0-9]\\.[0-9]{8}E[-+][0-9]{2})$", recv_fetc }, | |
786 | { "^\"(V|MV|A|UA|FREQ),(\\d),(AC|DC)\"$", recv_conf_u123x }, | |
787 | { "^\"(RES|CAP),(\\d)\"$", recv_conf_u123x}, | |
873c0d11 | 788 | { "^\"(DIOD)\"$", recv_conf_u123x }, |
9e9dba7b | 789 | ALL_ZERO |
e93cdf42 BV |
790 | }; |
791 | ||
173378f0 BV |
792 | SR_PRIV const struct agdmm_recv agdmm_recvs_u124x[] = { |
793 | { "^\"(\\d\\d.{18}\\d)\"$", recv_stat_u124x }, | |
794 | { "^\\*([0-9])$", recv_switch }, | |
795 | { "^([-+][0-9]\\.[0-9]{8}E[-+][0-9]{2})$", recv_fetc }, | |
4435966e AJ |
796 | { "^\"(VOLT|CURR|RES|CAP|FREQ) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, |
797 | { "^\"(VOLT:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, | |
0fe18626 | 798 | { "^\"(CURR:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, |
4435966e | 799 | { "^\"(CPER:[40]-20mA) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, |
a965748a | 800 | { "^\"(T[0-9]:[A-Z]+) ([A-Z]+)\"$", recv_conf_u124x_5x }, |
873c0d11 | 801 | { "^\"(DIOD)\"$", recv_conf_u124x_5x }, |
9e9dba7b | 802 | ALL_ZERO |
173378f0 BV |
803 | }; |
804 | ||
8c0152f2 BV |
805 | SR_PRIV const struct agdmm_recv agdmm_recvs_u125x[] = { |
806 | { "^\"(\\d\\d.{18}\\d)\"$", recv_stat_u125x }, | |
807 | { "^\\*([0-9])$", recv_switch }, | |
808 | { "^([-+][0-9]\\.[0-9]{8}E[-+][0-9]{2})$", recv_fetc }, | |
4435966e AJ |
809 | { "^\"(VOLT|CURR|RES|CAP|FREQ) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, |
810 | { "^\"(VOLT:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, | |
0fe18626 | 811 | { "^\"(CURR:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, |
4435966e | 812 | { "^\"(CPER:[40]-20mA) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, |
c7f5219e | 813 | { "^\"(T[0-9]:[A-Z]+) ([A-Z]+)\"$", recv_conf_u124x_5x }, |
873c0d11 | 814 | { "^\"(DIOD)\"$", recv_conf_u124x_5x }, |
9e9dba7b | 815 | ALL_ZERO |
8c0152f2 | 816 | }; |
43185ed3 AJ |
817 | |
818 | SR_PRIV const struct agdmm_recv agdmm_recvs_u128x[] = { | |
819 | { "^\"(\\d\\d.{18}\\d)\"$", recv_stat_u128x }, | |
820 | { "^\\*([0-9])$", recv_switch }, | |
821 | { "^([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))$", recv_fetc }, | |
d2f6abf6 | 822 | { "^\"(VOLT|CURR|RES|CONT|COND|CAP|FREQ|FC1|FC100) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, |
43185ed3 AJ |
823 | { "^\"(VOLT:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, |
824 | { "^\"(CURR:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, | |
825 | { "^\"(FREQ:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, | |
826 | { "^\"(CPER:[40]-20mA) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, | |
7ab126ca | 827 | { "^\"(PULS:PWID|PULS:PWID:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, |
43185ed3 | 828 | { "^\"(TEMP:[A-Z]+) ([A-Z]+)\"$", recv_conf_u124x_5x }, |
7ab126ca | 829 | { "^\"(DIOD|SQU|PULS:PDUT|TEMP)\"$", recv_conf_u124x_5x }, |
43185ed3 AJ |
830 | ALL_ZERO |
831 | }; |