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
6e70e527
Commit
6e70e527
authored
8 years ago
by
dawehr
Browse files
Options
Downloads
Patches
Plain Diff
Fixed compile errors.
parent
0008bdfc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
quad/src/quad_app/log_data.c
+10
-10
10 additions, 10 deletions
quad/src/quad_app/log_data.c
quad/src/quad_app/log_data.h
+2
-2
2 additions, 2 deletions
quad/src/quad_app/log_data.h
with
12 additions
and
12 deletions
quad/src/quad_app/log_data.c
+
10
−
10
View file @
6e70e527
...
@@ -29,7 +29,7 @@ struct graph_tuple { // Tuple for
...
@@ -29,7 +29,7 @@ struct graph_tuple { // Tuple for
struct
str
{
struct
str
{
char
*
str
;
char
*
str
;
in
t
size
;
size_
t
size
;
size_t
capacity
;
size_t
capacity
;
};
};
...
@@ -43,34 +43,34 @@ int row_size;
...
@@ -43,34 +43,34 @@ int row_size;
static
char
units_output_str
[
512
]
=
{};
static
char
units_output_str
[
512
]
=
{};
static
char
units_param_str
[
512
]
=
{};
static
char
units_param_str
[
512
]
=
{};
static
struct
str
units_output
{
.
str
=
units_output_str
,
.
size
=
0
,
.
capacity
=
sizeof
(
units_output_str
)};
static
struct
str
units_output
=
{
.
str
=
units_output_str
,
.
size
=
0
,
.
capacity
=
sizeof
(
units_output_str
)};
static
struct
str
units_param
{
.
str
=
units_param_str
,
.
size
=
0
.
capacity
=
sizeof
(
units_output_str
)};
static
struct
str
units_param
=
{
.
str
=
units_param_str
,
.
size
=
0
,
.
capacity
=
sizeof
(
units_output_str
)};
void
safe_strcat
(
struct
str
,
char
*
to_add
)
{
void
safe_strcat
(
struct
str
str
,
char
*
to_add
)
{
size_t
add_len
=
strlen
(
to_add
);
size_t
add_len
=
strlen
(
to_add
);
if
(
add_len
+
str
.
size
<=
str
.
capacity
)
{
if
(
add_len
+
str
.
size
<=
str
.
capacity
)
{
strcpy
(
&
(
str
.
str
[
str
.
size
]),
to_add
);
strcpy
(
&
(
str
.
str
[
str
.
size
]),
to_add
);
str
.
size
+=
to_
add
;
str
.
size
+=
add
_len
;
}
}
}
}
void
addOutputToLog
(
log_t
*
log_struct
,
int
controller_id
,
int
output_id
,
char
*
units
)
{
void
addOutputToLog
(
log_t
*
log_struct
,
int
controller_id
,
int
output_id
,
char
*
units
)
{
static
units_buf
[
64
];
static
char
units_buf
[
64
];
if
(
n_outputs
<
MAX_LOG_NUM
)
{
if
(
n_outputs
<
MAX_LOG_NUM
)
{
log_outputs
[
n_outputs
].
block_id
=
controller_id
;
log_outputs
[
n_outputs
].
block_id
=
controller_id
;
log_outputs
[
n_outputs
].
sub_id
=
output_id
;
log_outputs
[
n_outputs
].
sub_id
=
output_id
;
n_outputs
++
;
n_outputs
++
;
snprintf
(
units_buf
,
sizeof
(
units_buf
)
"
\t
%s"
,
units
);
snprintf
(
units_buf
,
sizeof
(
units_buf
)
,
"
\t
%s"
,
units
);
safe_strcat
(
units_output
,
units_buf
);
safe_strcat
(
units_output
,
units_buf
);
}
}
}
}
void
addParamToLog
(
log_t
*
log_struct
,
int
controller_id
,
int
param_id
,
char
*
units
)
{
void
addParamToLog
(
log_t
*
log_struct
,
int
controller_id
,
int
param_id
,
char
*
units
)
{
static
units_buf
[
64
];
static
char
units_buf
[
64
];
if
(
n_params
<
MAX_LOG_NUM
)
{
if
(
n_params
<
MAX_LOG_NUM
)
{
log_params
[
n_params
].
block_id
=
controller_id
;
log_params
[
n_params
].
block_id
=
controller_id
;
log_params
[
n_params
].
sub_id
=
param_id
;
log_params
[
n_params
].
sub_id
=
param_id
;
n_params
++
;
n_params
++
;
snprintf
(
units_buf
,
sizeof
(
units_buf
)
"
\t
%s"
,
units
);
snprintf
(
units_buf
,
sizeof
(
units_buf
)
,
"
\t
%s"
,
units
);
safe_strcat
(
units_param
,
units_buf
);
safe_strcat
(
units_param
,
units_buf
);
}
}
}
}
...
@@ -167,7 +167,7 @@ void printLogging(hardware_t *hardware_struct, log_t* log_struct, parameter_t* p
...
@@ -167,7 +167,7 @@ void printLogging(hardware_t *hardware_struct, log_t* log_struct, parameter_t* p
// Let user know that allocation failed
// Let user know that allocation failed
if
(
arraySize
!=
LOG_STARTING_SIZE
)
{
if
(
arraySize
!=
LOG_STARTING_SIZE
)
{
size_t
send_len
=
sprintf
(
header1
,
"Failed to allocate enough log memory
\n
"
);
size_t
send_len
=
sprintf
(
header1
,
"Failed to allocate enough log memory
\n
"
);
send_data
(
hardware_struct
,
LOG_ID
,
0
,
header1
,
send_len
);
send_data
(
&
hardware_struct
->
uart
,
LOG_ID
,
0
,
header1
,
send_len
);
return
;
return
;
}
}
...
...
This diff is collapsed.
Click to expand it.
quad/src/quad_app/log_data.h
+
2
−
2
View file @
6e70e527
...
@@ -18,12 +18,12 @@ void initialize_logging(log_t* log_struct, parameter_t* ps);
...
@@ -18,12 +18,12 @@ void initialize_logging(log_t* log_struct, parameter_t* ps);
/**
/**
* Adds the given block output to the data to be logged
* Adds the given block output to the data to be logged
*/
*/
void
addOutputToLog
(
log_t
*
log_struct
,
int
controller_id
,
int
output_id
);
void
addOutputToLog
(
log_t
*
log_struct
,
int
controller_id
,
int
output_id
,
char
*
units
);
/**
/**
* Adds the given block parameter to the data to be logged
* Adds the given block parameter to the data to be logged
*/
*/
void
addParamToLog
(
log_t
*
log_struct
,
int
controller_id
,
int
param_id
);
void
addParamToLog
(
log_t
*
log_struct
,
int
controller_id
,
int
param_id
,
char
*
units
);
/**
/**
...
...
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