Commit c13db8f4 authored by maniacbug's avatar maniacbug

Added a second test configuration

parent 1517f124
......@@ -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);
}
......
......@@ -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
//
......
......@@ -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()
......
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment