Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
ethstream
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8bb6de6c
authored
Aug 12, 2019
by
Daisy Green
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
added binary output mode for nerdjack
parent
01359f47
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
nerdjack.c
nerdjack.c
View file @
8bb6de6c
...
...
@@ -429,7 +429,7 @@ nerd_data_stream(int data_fd, int numChannels, int *channel_list,
double
voltline
[
numChannels
];
u
nsigned
shor
t
dataline
[
numChannels
];
u
int16_
t
dataline
[
numChannels
];
unsigned
short
packetsready
=
0
;
unsigned
short
adcused
=
0
;
...
...
@@ -544,7 +544,7 @@ nerd_data_stream(int data_fd, int numChannels, int *channel_list,
case
CONVERT_HEX
:
case
CONVERT_DEC
:
dataline
[
i
]
=
(
u
nsigned
shor
t
)(
datapoint
-
(
u
int16_
t
)(
datapoint
-
INT16_MIN
);
break
;
}
...
...
@@ -553,12 +553,16 @@ nerd_data_stream(int data_fd, int numChannels, int *channel_list,
if
(
linesdumped
!=
0
)
{
//Now print the group
switch
(
convert
)
{
case
CONVERT_VOLTS
:
for
(
i
=
0
;
i
<
numChannels
;
i
++
)
{
if
(
printf
(
"%lf "
,
voltline
[
i
])
<
0
)
goto
bad
;
}
if
(
printf
(
"
\n
"
)
<
0
)
goto
bad
;
break
;
case
CONVERT_HEX
:
for
(
i
=
0
;
i
<
numChannels
;
i
++
)
{
...
...
@@ -566,6 +570,9 @@ nerd_data_stream(int data_fd, int numChannels, int *channel_list,
<
0
)
goto
bad
;
}
if
(
printf
(
"
\n
"
)
<
0
)
goto
bad
;
break
;
default:
case
CONVERT_DEC
:
...
...
@@ -574,10 +581,18 @@ nerd_data_stream(int data_fd, int numChannels, int *channel_list,
<
0
)
goto
bad
;
}
if
(
printf
(
"
\n
"
)
<
0
)
goto
bad
;
break
;
case
CONVERT_BINARY
:
if
(
fwrite
(
dataline
,
sizeof
(
uint16_t
),
numChannels
,
stdout
)
<
0
)
goto
bad
;
// }
break
;
}
if
(
printf
(
"
\n
"
)
<
0
)
goto
bad
;
//If we're counting lines, decrement them
if
(
lines
!=
0
)
{
...
...
@@ -694,4 +709,4 @@ int nerd_close_conn(int data_fd)
shutdown
(
data_fd
,
2
);
close
(
data_fd
);
return
0
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment