Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
cbe6db55
Commit
cbe6db55
authored
10 years ago
by
BytesGalore
Browse files
Options
Downloads
Patches
Plain Diff
examples/rpl_udp: Fix unconditional setting of a radio channel on initialization
parent
9b65000f
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
examples/rpl_udp/rpl.c
+23
-10
23 additions, 10 deletions
examples/rpl_udp/rpl.c
with
23 additions
and
10 deletions
examples/rpl_udp/rpl.c
+
23
−
10
View file @
cbe6db55
...
...
@@ -44,7 +44,7 @@ void rpl_udp_init(int argc, char **argv)
{
transceiver_command_t
tcmd
;
msg_t
m
;
u
int32_t
chan
=
RADIO_CHANNEL
;
int32_t
chan
=
0
;
if
(
argc
!=
2
)
{
printf
(
"Usage: %s (r|n|h)
\n
"
,
argv
[
0
]);
...
...
@@ -70,6 +70,28 @@ void rpl_udp_init(int argc, char **argv)
DEBUGF
(
"Setting HW address to %u
\n
"
,
id
);
net_if_set_hardware_address
(
0
,
id
);
tcmd
.
transceivers
=
TRANSCEIVER
;
tcmd
.
data
=
&
chan
;
m
.
type
=
GET_CHANNEL
;
m
.
content
.
ptr
=
(
void
*
)
&
tcmd
;
msg_send_receive
(
&
m
,
&
m
,
transceiver_pid
);
if
(
chan
==
0
)
{
DEBUGF
(
"The channel has not been set yet."
);
/* try to set the channel to 10 (RADIO_CHANNEL) */
chan
=
RADIO_CHANNEL
;
}
m
.
type
=
SET_CHANNEL
;
msg_send_receive
(
&
m
,
&
m
,
transceiver_pid
);
if
(
chan
==
0
)
{
puts
(
"ERROR: channel NOT set! Aborting initialization."
);
return
;
}
printf
(
"Channel set to %d
\n
"
,
chan
);
if
(
command
!=
'h'
)
{
DEBUGF
(
"Initializing RPL for interface 0
\n
"
);
uint8_t
state
=
rpl_init
(
0
);
...
...
@@ -124,15 +146,6 @@ void rpl_udp_init(int argc, char **argv)
ipv6_init_as_router
();
}
/* set channel to 10 */
tcmd
.
transceivers
=
TRANSCEIVER
;
tcmd
.
data
=
&
chan
;
m
.
type
=
SET_CHANNEL
;
m
.
content
.
ptr
=
(
void
*
)
&
tcmd
;
msg_send_receive
(
&
m
,
&
m
,
transceiver_pid
);
printf
(
"Channel set to %u
\n
"
,
RADIO_CHANNEL
);
puts
(
"Transport layer initialized"
);
/* start transceiver watchdog */
}
...
...
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