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
Hide 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)
...
@@ -293,6 +293,7 @@ void RF24::printDetails(void)
print_byte_register
(
PSTR
(
"EN_RXADDR"
),
EN_RXADDR
);
print_byte_register
(
PSTR
(
"EN_RXADDR"
),
EN_RXADDR
);
print_byte_register
(
PSTR
(
"RF_CH"
),
RF_CH
);
print_byte_register
(
PSTR
(
"RF_CH"
),
RF_CH
);
print_byte_register
(
PSTR
(
"RF_SETUP"
),
RF_SETUP
);
print_byte_register
(
PSTR
(
"RF_SETUP"
),
RF_SETUP
);
print_byte_register
(
PSTR
(
"CONFIG"
),
CONFIG
);
print_byte_register
(
PSTR
(
"DYNPD/FEATURE"
),
DYNPD
,
2
);
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
...
@@ -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? */
int
failures_remaining
=
num_needed
;
//*< How many more failed sends until we declare failure? */
const
int
interval
=
100
;
//*< ms to wait between sends */
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
)
void
one_ok
(
void
)
{
{
// Have we received enough yet?
// Have we received enough yet?
...
@@ -134,7 +136,7 @@ void setup(void)
...
@@ -134,7 +136,7 @@ void setup(void)
printf
(
"ROLE: %s
\n\r
"
,
role_friendly_name
[
role
]);
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
// 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
// from the serial port. Then it would be possible to run the same test under
...
@@ -151,7 +153,8 @@ void setup(void)
...
@@ -151,7 +153,8 @@ void setup(void)
printf
(
"+READY press any key to start
\n\r\n\r
"
);
printf
(
"+READY press any key to start
\n\r\n\r
"
);
while
(
!
Serial
.
available
()
)
{}
while
(
!
Serial
.
available
()
)
{}
Serial
.
read
();
configuration
=
Serial
.
read
();
printf
(
"Configuration
\t
= %c
\n\r
"
,
configuration
);
//
//
// Setup and configure rf radio
// Setup and configure rf radio
...
@@ -161,19 +164,37 @@ void setup(void)
...
@@ -161,19 +164,37 @@ void setup(void)
// We will be using the Ack Payload feature, so please enable it
// We will be using the Ack Payload feature, so please enable it
radio
.
enableAckPayload
();
radio
.
enableAckPayload
();
switch
(
configuration
)
{
case
' '
:
case
'1'
:
// Optional: Increase CRC length for improved reliability
radio
.
setCRCLength
(
RF24_CRC_16
);
// Optional: Decrease data rate for improved reliability
radio
.
setDataRate
(
RF24_1MBPS
);
// 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
// enable dynamic payloads
radio
.
enableDynamicPayloads
();
radio
.
enableDynamicPayloads
();
// Optional: Increase CRC length for improved reliability
radio
.
setCRCLength
(
RF24_CRC_16
);
// Optional: Decrease data rate for improved reliability
radio
.
setDataRate
(
RF24_1MBPS
);
// Optional: Pick a high channel
radio
.
setChannel
(
90
);
//
//
// Open pipes to other nodes for communication
// Open pipes to other nodes for communication
//
//
...
...
tests/pingpair_test/runtest.py
View file @
c13db8f4
...
@@ -15,7 +15,7 @@ def read_until(token):
...
@@ -15,7 +15,7 @@ def read_until(token):
ser
=
serial
.
Serial
(
sys
.
argv
[
1
],
57600
,
timeout
=
5
,
dsrdtr
=
False
,
rtscts
=
False
)
ser
=
serial
.
Serial
(
sys
.
argv
[
1
],
57600
,
timeout
=
5
,
dsrdtr
=
False
,
rtscts
=
False
)
read_until
(
"+READY"
)
read_until
(
"+READY"
)
ser
.
write
(
" "
)
ser
.
write
(
sys
.
argv
[
2
]
)
line
=
read_until
(
"+OK"
)
line
=
read_until
(
"+OK"
)
ser
.
close
()
ser
.
close
()
...
...
tests/pingpair_test/runtests.sh
View file @
c13db8f4
...
@@ -3,7 +3,10 @@
...
@@ -3,7 +3,10 @@
# Connect p6 to receiver, p4 to sender
# Connect p6 to receiver, p4 to sender
jam p4 p6
||
exit
1
jam p4 p6
||
exit
1
./runtest.py /dev/tty.usbserial-A600eHIs &
./runtest.py /dev/tty.usbserial-A600eHIs 1 &
./runtest.py /dev/tty.usbserial-A40081RP
||
exit
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
`
kill
`
jobs
-p
`
exit
0
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