Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RF24
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
RF24
Commits
4f6c4c90
Commit
4f6c4c90
authored
May 12, 2011
by
maniacbug
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a full constructor for payload_t
parent
98686423
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
examples/starping_relay/starping_relay.pde
examples/starping_relay/starping_relay.pde
+5
-9
No files found.
examples/starping_relay/starping_relay.pde
View file @
4f6c4c90
...
...
@@ -109,6 +109,8 @@ struct payload_t
uint8_t
from_node
;
uint8_t
to_node
;
unsigned
long
time
;
payload_t
(
void
)
{}
payload_t
(
uint8_t
_from
,
uint8_t
_to
,
const
unsigned
long
&
_time
)
:
from_node
(
_from
),
to_node
(
_to
),
time
(
_time
)
{}
};
void
payload_printf
(
const
char
*
name
,
const
payload_t
&
pl
)
...
...
@@ -247,11 +249,8 @@ void loop(void)
// First, stop listening so we can talk.
radio
.
stopListening
();
// Take the time, and send it. This will block until complete
payload_t
ping
;
ping
.
time
=
millis
();
ping
.
from_node
=
node_address
;
ping
.
to_node
=
0
;
// All pings go to the base
// Take the time, and send it to the base. This will block until complete
payload_t
ping
(
node_address
,
0
,
millis
());
payload_printf
(
"PING"
,
ping
);
radio
.
write
(
&
ping
,
sizeof
(
payload_t
)
);
...
...
@@ -312,10 +311,7 @@ void loop(void)
radio
.
stopListening
();
// Construct the return payload (pong)
payload_t
pong
;
pong
.
time
=
ping
.
time
;
pong
.
from_node
=
node_address
;
pong
.
to_node
=
ping
.
from_node
;
payload_t
pong
(
node_address
,
ping
.
from_node
,
ping
.
time
);
// Open the correct pipe for writing
radio
.
openWritingPipe
(
topology
[
pong
.
to_node
].
listening_pipe
);
...
...
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