   // Power down the periferals
   digitalWrite(PIN_PERIF_POWER, HIGH);
   
-  
   cli();
   
   // disable ADC
-  ADCSRA = 0;  
+  byte old_ADCSRA = ADCSRA;
+  ADCSRA = 0;
   
   set_sleep_mode(SLEEP_MODE_PWR_DOWN);
 


#define DARK_THRESHOLD 500 // sleep when darker than this


// The analoge value of the ldr
int ldr;
byte sleep_flag;
byte msgId;
byte awake_tx_count;
// When the last transmit was attempted.
unsigned long tx_last = 0; 
// The transmit interval.
const long tx_interval = 2000; 


/**
 * ISR for INT0

ISR(WDT_vect)
{
  // Wake up by watchdog
  if (wd_isr == 0) {
      wd_isr = WD_DO_STUFF;
  } else {
      --wd_isr; 
      // Go back to sleep.
      goToSleep(SLEEP_FLAG_IDLE);
  }
}

void setup()
