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 11 additions and 9 deletions
...@@ -689,20 +689,21 @@ int data_callback(int channels, uint16_t * data, void *context) ...@@ -689,20 +689,21 @@ int data_callback(int channels, uint16_t * data, void *context)
columns_left = channels; columns_left = channels;
for (i = 0; i < channels; i++) { for (i = 0; i < channels; i++) {
switch (ci->convert) { if (ci->convert == CONVERT_VOLTS &&
case CONVERT_VOLTS: i <= UE9_MAX_ANALOG_CHANNEL) {
if (printf /* CONVERT_VOLTS */
("%lf", if (printf("%lf", ue9_binary_to_analog(
ue9_binary_to_analog(&ci->calib, UE9_BIPOLAR_GAIN1, &ci->calib, UE9_BIPOLAR_GAIN1,
12, data[i])) < 0) 12, data[i])) < 0)
goto bad; goto bad;
break; break;
case CONVERT_HEX: } else if (ci->convert == CONVERT_HEX) {
/* CONVERT_HEX */
if (printf("%04X", data[i]) < 0) if (printf("%04X", data[i]) < 0)
goto bad; goto bad;
break; break;
default: } else {
case CONVERT_DEC: /* CONVERT_DEC */
if (printf("%d", data[i]) < 0) if (printf("%d", data[i]) < 0)
goto bad; goto bad;
break; break;
......
...@@ -76,6 +76,7 @@ struct ue9ControlConfig { ...@@ -76,6 +76,7 @@ struct ue9ControlConfig {
#define UE9_MAX_CHANNEL_COUNT 128 #define UE9_MAX_CHANNEL_COUNT 128
#define UE9_MAX_CHANNEL 255 #define UE9_MAX_CHANNEL 255
#define UE9_MAX_ANALOG_CHANNEL 13
#define UE9_TIMERS 6 #define UE9_TIMERS 6
/* Fill checksums in data buffers */ /* 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