Skip to content

Commit

Permalink
Added extra LED indicators in test mode
Browse files Browse the repository at this point in the history
  • Loading branch information
maniacbug committed Jun 11, 2012
1 parent 5999a2c commit 5954338
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/sensornet/duinode3.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jam F_CPU=8000000 "CCFLAGS=-include DuinodeV3.h" -dx UPLOAD_SPEED=57600 u1 && screen /dev/ttyUSB1 57600
jam F_CPU=8000000 "CCFLAGS=-include DuinodeV3.h" -dx UPLOAD_SPEED=57600 u0 && screen /dev/ttyUSB0 57600
34 changes: 23 additions & 11 deletions examples/sensornet/sensornet.pde
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const wdt_prescalar_e wdt_prescalar = wdt_4s;
const int sleep_cycles_per_transmission = 1;

// Non-sleeping nodes need a timer to regulate their sending interval
Timer send_timer(4000);
Timer send_timer(2000);

// Button controls functionality of the unit
Button ButtonA(button_a);
Expand Down Expand Up @@ -211,8 +211,15 @@ void loop(void)
if ( this_node > 0 && ( Sleep || send_timer.wasFired() ) )
{
// Transmission beginning, TX LED ON
if ( led_red )
digitalWrite(led_red,HIGH);
if ( led_yellow )
digitalWrite(led_yellow,HIGH);
if ( test_mode )
{
if ( led_green )
digitalWrite(led_green,LOW);
if ( led_red )
digitalWrite(led_red,LOW);
}

int i;
S_message message;
Expand Down Expand Up @@ -245,15 +252,23 @@ void loop(void)
RF24NetworkHeader header(/*to node*/ 0, /*type*/ 'S');
bool ok = network.write(header,&message,sizeof(message));
if (ok)
{
if ( test_mode && led_green )
digitalWrite(led_green,HIGH);
printf_P(PSTR("%lu: APP Send ok\n\r"),millis());
}
else
{
if ( test_mode && led_red )
digitalWrite(led_red,HIGH);
printf_P(PSTR("%lu: APP Send failed\n\r"),millis());

}

// Transmission complete, TX LED OFF
if ( led_red )
digitalWrite(led_red,LOW);
if ( led_yellow )
digitalWrite(led_yellow,LOW);

if ( Sleep )
if ( Sleep && ! test_mode )
{
// Power down the radio. Note that the radio will get powered back up
// on the next write() call.
Expand All @@ -276,11 +291,8 @@ void loop(void)
if ( startup )
test_mode = true;
}
if ( test_mode )
if ( led_yellow )
digitalWrite(led_yellow,HIGH);

//
// Continue the startup sequence
startup.update();

// Listen for a new node address
Expand Down

0 comments on commit 5954338

Please sign in to comment.