Skip to content

Commit

Permalink
Fix bug where relay nodes were shutting down the radio
Browse files Browse the repository at this point in the history
  • Loading branch information
maniacbug committed Mar 27, 2012
1 parent 6bf2d2c commit 5fafdc5
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions examples/sensornet/sensornet.pde
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ void setup(void)
digitalWrite(red_led_pin,LOW);
}

// Sensors use the stable internal 1.1V voltage
analogReference(INTERNAL);

//
// Bring up the RF network
//
Expand Down Expand Up @@ -168,21 +171,24 @@ void loop(void)
else
printf_P(PSTR("%lu: APP Send failed\n\r"),millis());

// Power down the radio. Note that the radio will get powered back up
// on the next write() call.
radio.powerDown();

// Be sure to flush the serial first before sleeping, so everything
// gets printed properly
Serial.flush();

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

// Sleep the MCU. The watchdog timer will awaken in a short while, and
// continue execution here.
Sleep.go();

if ( Sleep )
{
// Power down the radio. Note that the radio will get powered back up
// on the next write() call.
radio.powerDown();

// Be sure to flush the serial first before sleeping, so everything
// gets printed properly
Serial.flush();

// Sleep the MCU. The watchdog timer will awaken in a short while, and
// continue execution here.
Sleep.go();
}
}

// Listen for a new node address
Expand Down

0 comments on commit 5fafdc5

Please sign in to comment.