Browse Source

Don't convert non-analog channels to volts

git-svn-id: https://bucket.mit.edu/svn/nilm/acquisition/ethstream@8325 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/ethstream-1.3
jim 12 years ago
parent
commit
e6e9d32a54
2 changed files with 11 additions and 9 deletions
  1. +10
    -9
      ethstream.c
  2. +1
    -0
      ue9.h

+ 10
- 9
ethstream.c View File

@@ -689,20 +689,21 @@ int data_callback(int channels, uint16_t * data, void *context)

columns_left = channels;
for (i = 0; i < channels; i++) {
switch (ci->convert) {
case CONVERT_VOLTS:
if (printf
("%lf",
ue9_binary_to_analog(&ci->calib, UE9_BIPOLAR_GAIN1,
12, data[i])) < 0)
if (ci->convert == CONVERT_VOLTS &&
i <= UE9_MAX_ANALOG_CHANNEL) {
/* CONVERT_VOLTS */
if (printf("%lf", ue9_binary_to_analog(
&ci->calib, UE9_BIPOLAR_GAIN1,
12, data[i])) < 0)
goto bad;
break;
case CONVERT_HEX:
} else if (ci->convert == CONVERT_HEX) {
/* CONVERT_HEX */
if (printf("%04X", data[i]) < 0)
goto bad;
break;
default:
case CONVERT_DEC:
} else {
/* CONVERT_DEC */
if (printf("%d", data[i]) < 0)
goto bad;
break;


+ 1
- 0
ue9.h View File

@@ -76,6 +76,7 @@ struct ue9ControlConfig {

#define UE9_MAX_CHANNEL_COUNT 128
#define UE9_MAX_CHANNEL 255
#define UE9_MAX_ANALOG_CHANNEL 13
#define UE9_TIMERS 6

/* Fill checksums in data buffers */


Loading…
Cancel
Save