Commit b9130788 by nilm

Fixed annoying bug with NerdJack header


git-svn-id: https://bucket.mit.edu/svn/nilm/acquisition/ethstream@7419 ddd99763-3ecb-0310-9145-efcb8ce7c51f
parent ed150ead
Showing with 12 additions and 2 deletions
...@@ -34,6 +34,8 @@ typedef struct ...@@ -34,6 +34,8 @@ typedef struct
int *destlist; int *destlist;
} deststruct; } deststruct;
#define NERD_HEADER_SIZE 8
typedef struct __attribute__ ((__packed__)) typedef struct __attribute__ ((__packed__))
{ {
unsigned char headerone; unsigned char headerone;
...@@ -371,7 +373,7 @@ nerd_data_stream (int data_fd, int numChannels, int *channel_list, ...@@ -371,7 +373,7 @@ nerd_data_stream (int data_fd, int numChannels, int *channel_list,
*currentcount = *currentcount + 1; *currentcount = *currentcount + 1;
//Process the rest of the header and update the index value to be pointing after it //Process the rest of the header and update the index value to be pointing after it
charsprocessed = 12; charsprocessed = NERD_HEADER_SIZE;
//memused = ntohl (buf.lwipmemoryused); //memused = ntohl (buf.lwipmemoryused);
adcused = ntohs (buf.adcused); adcused = ntohs (buf.adcused);
packetsready = ntohs (buf.packetsready); packetsready = ntohs (buf.packetsready);
...@@ -570,12 +572,20 @@ nerd_generate_command (getPacket * command, int *channel_list, ...@@ -570,12 +572,20 @@ nerd_generate_command (getPacket * command, int *channel_list,
short channelbit = 0; short channelbit = 0;
int i; int i;
int highestchannel = 0;
for (i = 0; i < channel_count; i++) for (i = 0; i < channel_count; i++)
{ {
channelbit = channelbit | (0x1 << channel_list[i]); if (channel_list[i] > highestchannel) {
highestchannel = channel_list[i];
}
//channelbit = channelbit | (0x1 << channel_list[i]);
} }
for( i = 0; i <= highestchannel; i++) {
channelbit = channelbit | (0x01 << i);
}
command->word[0] = 'G'; command->word[0] = 'G';
command->word[1] = 'E'; command->word[1] = 'E';
command->word[2] = 'T'; command->word[2] = 'T';
......
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