Hi,

In the task SendPacket() you always set pending to FALSE. Try to set it
only to false if there was an error:

  task void SendPacket() {
    IkTestMsg *message = (IkTestMsg *)local_msg.data;
    if (!pending)
    {
      pending = TRUE;
      message->addr = TOS_BCAST_ADDR;
      message->cnt = counter;
      atomic {
        message->src = TOS_LOCAL_ADDRESS;
      }
      if (call SendMsg.send(TOS_BCAST_ADDR, sizeof(IkTestMsg), &local_msg))
      {
        dbg(DBG_USR1, "Sending Message\n");
        dbg(DBG_USR1, "Source address = %d\n", message->src);
        dbg(DBG_USR1, "Value = %d\n", counter);
        pending = FALSE;
      }
    }
    dbg(DBG_USR1, "Pending message in buffer!\n");
  }

Cheers,
Urs


Ittipong Khemapech schrieb:
> Hi,
> 
> I have some problems with the SendMsg.sendDone() as it's not signaled. My
> files/modules are as follows:
> 
> [..]
>   task void SendPacket() {
>     IkTestMsg *message = (IkTestMsg *)local_msg.data;
>     if (!pending)
>     {
>       pending = TRUE;
>       message->addr = TOS_BCAST_ADDR;
>       message->cnt = counter;
>       atomic {
>         message->src = TOS_LOCAL_ADDRESS;
>       }
>       if (call SendMsg.send(TOS_BCAST_ADDR, sizeof(IkTestMsg), &local_msg))
>       {
>         dbg(DBG_USR1, "Sending Message\n");
>         dbg(DBG_USR1, "Source address = %d\n", message->src);
>         dbg(DBG_USR1, "Value = %d\n", counter);
>       }
>       pending = FALSE;
>     }
>     dbg(DBG_USR1, "Pending message in buffer!\n");
>   }
> [..]
>
> 
> I am running my modules in TOSSIM (TinyOS 1.x) and Cygwin. Seems to me that
> after the first sending, there is a message pending in the buffer.
> 
> Any suggestions would be appreciated.
> 
> Many thanks,
> Ittipong
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to