Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
72d22c42
Commit
72d22c42
authored
7 years ago
by
Beat Küng
Committed by
Roman Bapst
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
cleanup uavcan_main: replace warnx with PX4_{INFO,ERR,DEBUG}
parent
f21ab05f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/modules/uavcan/uavcan_main.cpp
+24
-34
24 additions, 34 deletions
src/modules/uavcan/uavcan_main.cpp
with
24 additions
and
34 deletions
src/modules/uavcan/uavcan_main.cpp
+
24
−
34
View file @
72d22c42
...
...
@@ -526,7 +526,7 @@ int UavcanNode::fw_server(eServerAction action)
int
UavcanNode
::
start
(
uavcan
::
NodeID
node_id
,
uint32_t
bitrate
)
{
if
(
_instance
!=
nullptr
)
{
warnx
(
"Already started"
);
PX4_WARN
(
"Already started"
);
return
-
1
;
}
...
...
@@ -560,14 +560,14 @@ int UavcanNode::start(uavcan::NodeID node_id, uint32_t bitrate)
can
=
new
CanInitHelper
();
if
(
can
==
nullptr
)
{
// We don't have exceptions so bad_alloc cannot be thrown
warnx
(
"Out of memory"
);
PX4_ERR
(
"Out of memory"
);
return
-
1
;
}
const
int
can_init_res
=
can
->
init
(
bitrate
);
if
(
can_init_res
<
0
)
{
warnx
(
"CAN driver init failed %i"
,
can_init_res
);
PX4_ERR
(
"CAN driver init failed %i"
,
can_init_res
);
return
can_init_res
;
}
}
...
...
@@ -578,12 +578,7 @@ int UavcanNode::start(uavcan::NodeID node_id, uint32_t bitrate)
_instance
=
new
UavcanNode
(
can
->
driver
,
uavcan_stm32
::
SystemClock
::
instance
());
if
(
_instance
==
nullptr
)
{
warnx
(
"Out of memory"
);
return
-
1
;
}
if
(
_instance
==
nullptr
)
{
warnx
(
"Out of memory"
);
PX4_ERR
(
"Out of memory"
);
return
-
1
;
}
...
...
@@ -592,7 +587,7 @@ int UavcanNode::start(uavcan::NodeID node_id, uint32_t bitrate)
if
(
node_init_res
<
0
)
{
delete
_instance
;
_instance
=
nullptr
;
warnx
(
"Node init failed %i"
,
node_init_res
);
PX4_ERR
(
"Node init failed %i"
,
node_init_res
);
return
node_init_res
;
}
...
...
@@ -604,7 +599,7 @@ int UavcanNode::start(uavcan::NodeID node_id, uint32_t bitrate)
static_cast
<
main_t
>
(
run_trampoline
),
nullptr
);
if
(
_instance
->
_task
<
0
)
{
warnx
(
"start failed: %d"
,
errno
);
PX4_ERR
(
"start failed: %d"
,
errno
);
return
-
errno
;
}
...
...
@@ -624,7 +619,7 @@ void UavcanNode::fill_node_info()
swver
.
optional_field_flags
|=
swver
.
OPTIONAL_FIELD_FLAG_VCS_COMMIT
;
// Too verbose for normal operation
//
warnx
("SW version vcs_commit: 0x%08x", unsigned(swver.vcs_commit));
//
PX4_INFO
("SW version vcs_commit: 0x%08x", unsigned(swver.vcs_commit));
_node
.
setSoftwareVersion
(
swver
);
...
...
@@ -678,11 +673,11 @@ int UavcanNode::init(uavcan::NodeID node_id)
ret
=
br
->
init
();
if
(
ret
<
0
)
{
warnx
(
"cannot init sensor bridge '%s' (%d)"
,
br
->
get_name
(),
ret
);
PX4_ERR
(
"cannot init sensor bridge '%s' (%d)"
,
br
->
get_name
(),
ret
);
return
ret
;
}
warnx
(
"sensor bridge '%s' init ok"
,
br
->
get_name
());
PX4_INFO
(
"sensor bridge '%s' init ok"
,
br
->
get_name
());
br
=
br
->
getSibling
();
}
...
...
@@ -697,7 +692,7 @@ void UavcanNode::node_spin_once()
const
int
spin_res
=
_node
.
spinOnce
();
if
(
spin_res
<
0
)
{
warnx
(
"node spin error %i"
,
spin_res
);
PX4_ERR
(
"node spin error %i"
,
spin_res
);
}
...
...
@@ -788,7 +783,7 @@ int UavcanNode::run()
const
int
slave_init_res
=
_time_sync_slave
.
start
();
if
(
slave_init_res
<
0
)
{
warnx
(
"Failed to start time_sync_slave"
);
PX4_ERR
(
"Failed to start time_sync_slave"
);
_task_should_exit
=
true
;
}
...
...
@@ -806,7 +801,7 @@ int UavcanNode::run()
const
int
busevent_fd
=
::
open
(
uavcan_stm32
::
BusEvent
::
DevName
,
0
);
if
(
busevent_fd
<
0
)
{
warnx
(
"Failed to open %s"
,
uavcan_stm32
::
BusEvent
::
DevName
);
PX4_ERR
(
"Failed to open %s"
,
uavcan_stm32
::
BusEvent
::
DevName
);
_task_should_exit
=
true
;
}
...
...
@@ -999,7 +994,6 @@ int UavcanNode::run()
(
void
)
::
close
(
busevent_fd
);
teardown
();
warnx
(
"exiting."
);
exit
(
0
);
}
...
...
@@ -1046,12 +1040,12 @@ UavcanNode::subscribe()
// the first fd used by CAN
for
(
unsigned
i
=
0
;
i
<
actuator_controls_s
::
NUM_ACTUATOR_CONTROL_GROUPS
;
i
++
)
{
if
(
sub_groups
&
(
1
<<
i
))
{
warnx
(
"subscribe to actuator_controls_%d"
,
i
);
PX4_DEBUG
(
"subscribe to actuator_controls_%d"
,
i
);
_control_subs
[
i
]
=
orb_subscribe
(
_control_topics
[
i
]);
}
if
(
unsub_groups
&
(
1
<<
i
))
{
warnx
(
"unsubscribe from actuator_controls_%d"
,
i
);
PX4_DEBUG
(
"unsubscribe from actuator_controls_%d"
,
i
);
orb_unsubscribe
(
_control_subs
[
i
]);
_control_subs
[
i
]
=
-
1
;
}
...
...
@@ -1114,7 +1108,7 @@ UavcanNode::ioctl(file *filp, int cmd, unsigned long arg)
ret
=
_mixers
->
load_from_buf
(
buf
,
buflen
);
if
(
ret
!=
0
)
{
warnx
(
"mixer load failed with %d"
,
ret
);
PX4_ERR
(
"mixer load failed with %d"
,
ret
);
delete
_mixers
;
_mixers
=
nullptr
;
_groups_required
=
0
;
...
...
@@ -1172,10 +1166,6 @@ UavcanNode::ioctl(file *filp, int cmd, unsigned long arg)
void
UavcanNode
::
print_info
()
{
if
(
!
_instance
)
{
warnx
(
"not running, start first"
);
}
(
void
)
pthread_mutex_lock
(
&
_node_mutex
);
// Memory status
...
...
@@ -1288,10 +1278,10 @@ void UavcanNode::hardpoint_controller_set(uint8_t hardpoint_id, uint16_t command
*/
static
void
print_usage
()
{
warnx
(
"usage:
\n
"
"
\t
uavcan {start [fw]|status|stop [all|fw]|shrink|arm|disarm|update fw|
\n
"
"
\t
param [set|get|list|save] <node-id> <name> <value>|reset <node-id>|
\n
"
"
\t
hardpoint set <id> <command>}"
);
PX4_INFO
(
"usage:
\n
"
"
\t
uavcan {start [fw]|status|stop [all|fw]|shrink|arm|disarm|update fw|
\n
"
"
\t
param [set|get|list|save] <node-id> <name> <value>|reset <node-id>|
\n
"
"
\t
hardpoint set <id> <command>}"
);
}
extern
"C"
__EXPORT
int
uavcan_main
(
int
argc
,
char
*
argv
[]);
...
...
@@ -1311,7 +1301,7 @@ int uavcan_main(int argc, char *argv[])
int
rv
=
UavcanNode
::
instance
()
->
fw_server
(
UavcanNode
::
Start
);
if
(
rv
<
0
)
{
warnx
(
"Firmware Server Failed to Start %d"
,
rv
);
PX4_ERR
(
"Firmware Server Failed to Start %d"
,
rv
);
::
exit
(
rv
);
}
...
...
@@ -1319,7 +1309,7 @@ int uavcan_main(int argc, char *argv[])
}
// Already running, no error
warnx
(
"already started"
);
PX4_INFO
(
"already started"
);
::
exit
(
0
);
}
...
...
@@ -1328,7 +1318,7 @@ int uavcan_main(int argc, char *argv[])
(
void
)
param_get
(
param_find
(
"UAVCAN_NODE_ID"
),
&
node_id
);
if
(
node_id
<
0
||
node_id
>
uavcan
::
NodeID
::
Max
||
!
uavcan
::
NodeID
(
node_id
).
isUnicast
())
{
warnx
(
"Invalid Node ID %i"
,
node_id
);
PX4_ERR
(
"Invalid Node ID %i"
,
node_id
);
::
exit
(
1
);
}
...
...
@@ -1337,7 +1327,7 @@ int uavcan_main(int argc, char *argv[])
(
void
)
param_get
(
param_find
(
"UAVCAN_BITRATE"
),
&
bitrate
);
// Start
warnx
(
"Node ID %u, bitrate %u"
,
node_id
,
bitrate
);
PX4_INFO
(
"Node ID %u, bitrate %u"
,
node_id
,
bitrate
);
return
UavcanNode
::
start
(
node_id
,
bitrate
);
}
...
...
@@ -1467,7 +1457,7 @@ int uavcan_main(int argc, char *argv[])
inst
->
shrink
();
if
(
rv
<
0
)
{
warnx
(
"Firmware Server Failed to Stop %d"
,
rv
);
PX4_ERR
(
"Firmware Server Failed to Stop %d"
,
rv
);
::
exit
(
rv
);
}
...
...
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