I suggest removing the highlighted line of code...
void system_sleep() {
ADCSRA |= (0<<ADEN); // disable ADC
sleep_enable(); // enable sleeping
sleep_mode(); // activate system sleep
// sleeping ...
// first action after leaving WDT Interrupt Vector:
if (wdt == sleepTime) { // sleep for this number times 8 seconds
sleep_disable(); // disable sleep
ADCSRA |= (1<<ADEN); // switch ADC on
wdt = 0; // reset watchdog counter
}else{
[glow]system_sleep(); // go back to sleep until it's time[/glow]
}
}
-
The call is not necessary.
-
The call results in a recursion. If the sleep time is long enough, the nested recursive calls will eat through the stack crashing your application.