[Tinyos-help] Is this a bug in Moteiv Boomerang MultiHop?

Joe Polastre joe at polastre.com
Thu Jun 1 21:27:08 PDT 2006


You are correct, thank you for pointing it out.

-Joe

On 6/1/06, Adam <shiyuan69 at gmail.com> wrote:
> In selectParent() function of MultihopLQIM.nc, is the following line a bug?
>         if (parents[i].cost + parents[i].estimate < newparent) {
>
> Should "newparent" be "parentestimate" ??
> =======================
>
>  void selectParent() {
>     int i;
>     int newparent = m_parent;
>     uint16_t parentestimate = parents[m_parent].cost +
> parents[m_parent].estimate;
>
>     // if our parent is invalid, pick the best parent
>     if (parents[m_parent].addr == MHOP_INVALID_PARENT) {
>       for (i = 0; i < MHOP_PARENT_SIZE; i++) {
>         if (parents[i].cost + parents[i].estimate < newparent) {
>           newparent = i;
>           parentestimate = parents[i].cost + parents[i].estimate;
>         }
>       }
>     }
>     // if we have a parent, don't switch unless they're worthwhile
>     else {
>       for (i = 0; i < MHOP_PARENT_SIZE; i++) {
>         if (((uint32_t) parents[i].cost + (uint32_t) parents[i].estimate)
>             <
>             ((uint32_t) parentestimate) -
>             (((uint32_t) parentestimate) >> 2)) {
>           newparent = i;
>           parentestimate = parents[i].cost + parents[i].estimate;
>         }
>       }
>     }
>     m_parent = newparent;
>   }
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at Millennium.Berkeley.EDU
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>


More information about the Tinyos-help mailing list