Commit e6e9d32a by jim

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
parent 9cdb4ea7
Showing with 10 additions and 8 deletions
......@@ -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,
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;
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment