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
c13db8f4
Commit
c13db8f4
authored
Jul 13, 2011
by
maniacbug
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a second test configuration
parent
1517f124
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
15 deletions
+40
-15
RF24.cpp
RF24.cpp
+1
-0
tests/pingpair_test/pingpair_test.pde
tests/pingpair_test/pingpair_test.pde
+33
-12
tests/pingpair_test/runtest.py
tests/pingpair_test/runtest.py
+1
-1
tests/pingpair_test/runtests.sh
tests/pingpair_test/runtests.sh
+5
-2
No files found.
RF24.cpp
View file @
c13db8f4
...
...
@@ -293,6 +293,7 @@ void RF24::printDetails(void)
print_byte_register
(
PSTR
(
"EN_RXADDR"
),
EN_RXADDR
);
print_byte_register
(
PSTR
(
"RF_CH"
),
RF_CH
);
print_byte_register
(
PSTR
(
"RF_SETUP"
),
RF_SETUP
);
print_byte_register
(
PSTR
(
"CONFIG"
),
CONFIG
);
print_byte_register
(
PSTR
(
"DYNPD/FEATURE"
),
DYNPD
,
2
);
}
...
...
tests/pingpair_test/pingpair_test.pde
View file @
c13db8f4
...
...
@@ -87,6 +87,8 @@ int receives_remaining = num_needed; //*< How many ack packets until we declare
int
failures_remaining
=
num_needed
;
//*< How many more failed sends until we declare failure? */
const
int
interval
=
100
;
//*< ms to wait between sends */
char
configuration
=
' '
;
//*< Configuration key, one char sent in by the test framework to tell us how to configure, ' ' is default */
void
one_ok
(
void
)
{
// Have we received enough yet?
...
...
@@ -134,7 +136,7 @@ void setup(void)
printf
(
"ROLE: %s
\n\r
"
,
role_friendly_name
[
role
]);
//
//
TODO:
Read configuration from serial
// Read configuration from serial
//
// It would be a much better test if this program could accept configuration
// from the serial port. Then it would be possible to run the same test under
...
...
@@ -151,7 +153,8 @@ void setup(void)
printf
(
"+READY press any key to start
\n\r\n\r
"
);
while
(
!
Serial
.
available
()
)
{}
Serial
.
read
();
configuration
=
Serial
.
read
();
printf
(
"Configuration
\t
= %c
\n\r
"
,
configuration
);
//
// Setup and configure rf radio
...
...
@@ -162,9 +165,10 @@ void setup(void)
// We will be using the Ack Payload feature, so please enable it
radio
.
enableAckPayload
();
// enable dynamic payloads
radio
.
enableDynamicPayloads
();
switch
(
configuration
)
{
case
' '
:
case
'1'
:
// Optional: Increase CRC length for improved reliability
radio
.
setCRCLength
(
RF24_CRC_16
);
...
...
@@ -174,6 +178,23 @@ void setup(void)
// Optional: Pick a high channel
radio
.
setChannel
(
90
);
break
;
case
'2'
:
// Optional: Increase CRC length for improved reliability
radio
.
setCRCLength
(
RF24_CRC_8
);
radio
.
setDataRate
(
RF24_2MBPS
);
radio
.
setChannel
(
10
);
break
;
default:
printf
(
"ERROR Unknown configuration %c
\n\r
"
,
configuration
);
done
=
true
;
passed
=
false
;
break
;
}
// enable dynamic payloads
radio
.
enableDynamicPayloads
();
//
// Open pipes to other nodes for communication
//
...
...
tests/pingpair_test/runtest.py
View file @
c13db8f4
...
...
@@ -15,7 +15,7 @@ def read_until(token):
ser
=
serial
.
Serial
(
sys
.
argv
[
1
],
57600
,
timeout
=
5
,
dsrdtr
=
False
,
rtscts
=
False
)
read_until
(
"+READY"
)
ser
.
write
(
" "
)
ser
.
write
(
sys
.
argv
[
2
]
)
line
=
read_until
(
"+OK"
)
ser
.
close
()
...
...
tests/pingpair_test/runtests.sh
View file @
c13db8f4
...
...
@@ -3,7 +3,10 @@
# Connect p6 to receiver, p4 to sender
jam p4 p6
||
exit
1
./runtest.py /dev/tty.usbserial-A600eHIs &
./runtest.py /dev/tty.usbserial-A40081RP
||
exit
1
./runtest.py /dev/tty.usbserial-A600eHIs 1 &
./runtest.py /dev/tty.usbserial-A40081RP 1
||
exit
1
kill
`
jobs
-p
`
./runtest.py /dev/tty.usbserial-A600eHIs 2 &
./runtest.py /dev/tty.usbserial-A40081RP 2
||
exit
1
kill
`
jobs
-p
`
exit
0
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