Commit c408c5ef authored by maniacbug's avatar maniacbug

Simplify specification of test configs slightly

parent c13db8f4
...@@ -87,7 +87,7 @@ int receives_remaining = num_needed; //*< How many ack packets until we declare ...@@ -87,7 +87,7 @@ 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 */ char configuration = '1'; //*< Configuration key, one char sent in by the test framework to tell us how to configure, this is the default */
void one_ok(void) void one_ok(void)
{ {
...@@ -109,6 +109,10 @@ void one_failed(void) ...@@ -109,6 +109,10 @@ void one_failed(void)
} }
} }
//
// Setup
//
void setup(void) void setup(void)
{ {
// //
...@@ -165,10 +169,17 @@ void setup(void) ...@@ -165,10 +169,17 @@ 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) if (configuration=='2')
{
// Config 2 is special radio config
radio.setCRCLength(RF24_CRC_8);
radio.setDataRate(RF24_2MBPS);
radio.setChannel(10);
}
else
{ {
case ' ': //Otherwise, default radio config
case '1':
// Optional: Increase CRC length for improved reliability // Optional: Increase CRC length for improved reliability
radio.setCRCLength(RF24_CRC_16); radio.setCRCLength(RF24_CRC_16);
...@@ -177,19 +188,6 @@ void setup(void) ...@@ -177,19 +188,6 @@ void setup(void)
// Optional: Pick a high channel // Optional: Pick a high channel
radio.setChannel(90); 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
...@@ -232,6 +230,9 @@ void setup(void) ...@@ -232,6 +230,9 @@ void setup(void)
attachInterrupt(0, check_radio, FALLING); attachInterrupt(0, check_radio, FALLING);
} }
//
// Loop
//
static uint32_t message_count = 0; static uint32_t message_count = 0;
static uint32_t last_message_count = 0; static uint32_t last_message_count = 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