[Tinyos-devel] Sleep interval and duty cycle in CC2420

Philip Levis pal at cs.stanford.edu
Fri Jan 2 09:39:27 PST 2009


On Dec 17, 2008, at 2:50 AM, Andreas Köpke wrote:

> Hi guys,
>
> the sleep interval computation suffers from an integer overflow bug  
> at least for
> telosb. I'd like to check in the attached fix.
>
> Best, Andreas
>
> *** DefaultLplP.nc	24 Jun 2008 16:26:28 +0200	1.5
> --- DefaultLplP.nc	17 Dez 2008 11:39:23 +0100	
> ***************
> *** 230,236 ****
>        return 0;
>      }
>
> !     return (DUTY_ON_TIME * (10000 - dutyCycle)) / dutyCycle;
>    }
>
>    /**
> --- 230,236 ----
>        return 0;
>      }
>
> !     return ((uint32_t)DUTY_ON_TIME * (10000 - dutyCycle)) /  
> dutyCycle;
>    }
>
>    /**
> ***************
> *** 245,251 ****
>        return 10000;
>      }
>
> !     return getActualDutyCycle((DUTY_ON_TIME * 10000)
>          / (sleepInterval + DUTY_ON_TIME));
>    }
>
> --- 245,251 ----
>        return 10000;
>      }
>
> !     return getActualDutyCycle(((uint32_t)DUTY_ON_TIME * 10000)
>          / (sleepInterval + DUTY_ON_TIME));
>    }
>

Sorry for taking so long to reply; the winter holidays have been quite  
busy. Let's bring this up at the next core call?

Phil


More information about the Tinyos-devel mailing list