Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MicroCART
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Distributed Autonomous Networked Control Lab
MicroCART
Commits
b91afa21
Commit
b91afa21
authored
8 years ago
by
burneykb
Browse files
Options
Downloads
Patches
Plain Diff
only creates new log file when loging new data
parent
8222f023
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
groundStation/src/backend/backend.c
+12
-5
12 additions, 5 deletions
groundStation/src/backend/backend.c
with
12 additions
and
5 deletions
groundStation/src/backend/backend.c
+
12
−
5
View file @
b91afa21
...
...
@@ -114,6 +114,7 @@ fd_set rfds_master;
int
max_fd
=
0
;
static
FILE
*
quadlog_file
;
static
int
quadlog_file_open
;
static
char
user_specified_log_name
[
256
]
=
""
;
pthread_mutex_t
quadResponseMutex
,
cliInputMutex
;
...
...
@@ -211,6 +212,7 @@ int main(int argc, char **argv)
printf
(
"Creating log file '%s'...
\n
"
,
log_file
);
quadlog_file
=
fopen
(
log_file
,
"a"
);
quadlog_file_open
=
1
;
// Tell the quad we are ready to send it vrpn data
sendStartPacket
();
...
...
@@ -795,6 +797,12 @@ static void quad_recv() {
switch
(
m
.
msg_type
)
{
case
LOG_ID
:
if
(
!
quadlog_file_open
)
{
char
log_file
[
256
];
create_log_name
(
log_file
,
256
);
printf
(
"New log file created: '%s'
\n
"
,
log_file
);
quadlog_file
=
fopen
(
log_file
,
"a"
);
}
/* something like this */
printf
(
"(Quad) : Log found
\n
"
);
fwrite
((
char
*
)
data
,
sizeof
(
char
),
m
.
data_len
,
quadlog_file
);
...
...
@@ -808,11 +816,10 @@ static void quad_recv() {
handleResponse
(
&
m
,
data
);
break
;
case
LOG_END_ID
:
fclose
(
quadlog_file
);
char
log_file
[
256
];
create_log_name
(
log_file
,
256
);
printf
(
"New log file created: '%s'
\n
"
,
log_file
);
quadlog_file
=
fopen
(
log_file
,
"a"
);
if
(
quadlog_file_open
)
{
fclose
(
quadlog_file
);
quadlog_file_open
=
0
;
}
break
;
default:
printf
(
"(Backend): message type %d ignored from quad
\n
"
,
m
.
msg_type
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment