Simplify specification of test configs slightly
This commit is contained in:
parent
c13db8f42d
commit
c408c5ef90
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setup
|
||||||
|
//
|
||||||
|
|
||||||
void setup(void)
|
void setup(void)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -165,32 +169,26 @@ 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')
|
||||||
{
|
{
|
||||||
case ' ':
|
// Config 2 is special radio config
|
||||||
case '1':
|
radio.setCRCLength(RF24_CRC_8);
|
||||||
// Optional: Increase CRC length for improved reliability
|
radio.setDataRate(RF24_2MBPS);
|
||||||
radio.setCRCLength(RF24_CRC_16);
|
radio.setChannel(10);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Otherwise, default radio config
|
||||||
|
|
||||||
|
// Optional: Increase CRC length for improved reliability
|
||||||
|
radio.setCRCLength(RF24_CRC_16);
|
||||||
|
|
||||||
// Optional: Decrease data rate for improved reliability
|
// Optional: Decrease data rate for improved reliability
|
||||||
radio.setDataRate(RF24_1MBPS);
|
radio.setDataRate(RF24_1MBPS);
|
||||||
|
|
||||||
// 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
|
||||||
radio.enableDynamicPayloads();
|
radio.enableDynamicPayloads();
|
||||||
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue