Commit efb8ed1f authored by campenr's avatar campenr

fixed output and made it consistent with output from Ardunio version.

parent 8ea51270
......@@ -42,8 +42,10 @@ using namespace std;
//RF24 radio(RPI_V2_GPIO_P1_15, BCM2835_SPI_CS0, BCM2835_SPI_SPEED_4MHZ);
// Setup for GPIO 22 CE and CE1 CSN with SPI Speed @ 8Mhz
RF24 radio(RPI_V2_GPIO_P1_15, RPI_V2_GPIO_P1_24, BCM2835_SPI_SPEED_8MHZ);
//RF24 radio(RPI_V2_GPIO_P1_15, RPI_V2_GPIO_P1_24, BCM2835_SPI_SPEED_8MHZ);
// Generic setup
RF24 radio(22, 0);
//
// Channel info
......@@ -99,34 +101,30 @@ int main(int argc, char** argv)
// forever loop
while(1)
{
if ( reset_array == 1 )
{
// Clear measurement values
memset(values,0,sizeof(values));
printf("\n");
}
// Scan all channels num_reps times
int rep_counter = num_reps;
while(rep_counter--)
{
int i = num_channels;
while (i--)
{
// Select this channel
radio.setChannel(i);
// Listen for a little
radio.startListening();
delayMicroseconds(128);
//radio.stopListening();
radio.stopListening();
// Did we get a carrier?
if ( radio.testCarrier() )
++values[i];
if ( values[i] == 0xf )
{
reset_array = 2;
if ( radio.testCarrier() ) ++values[i];
}
radio.stopListening();
}
// Print out channel measurements, clamped to a single hex digit
......@@ -136,7 +134,6 @@ int main(int argc, char** argv)
printf("%x",min(0xf,(values[i]&0xf)));
++i;
}
printf("\n");
}
......
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