Hi, Finally, I did it by having another variable in my module. It is increased when the SendMsg.sendDone() returns SUCESS and decreased otherwise. The SendPacket() is posted if and only if this variable is greater than zero.
Many thanks for your suggestions :-) Ittipong On 23/08/07, Michael Schippling <[EMAIL PROTECTED]> wrote: > > send() returns fail when it is still working on a message > (and for reasons...), so this may indicate that you are > trying to send too fast. That's the original point of the > pending state variable, so make sure you have that logic > worked out correctly. > > MS > > > Ittipong Khemapech wrote: > > Hi Urs, > > > > Thanks for your suggestion. I tried and got the same result. Seems that > the > > > > call SendMsg.send(TOS_BCAST_ADDR, sizeof(IkTestMsg), &local_msg); > > > > returns SUCCESS only for the first time it's called. If I put the > > > > pending = FALSE; > > > > in if-statement, it'll always make the if condition in the event > > SendMsg.sendDone() return FALSE. > > > > Any further suggestions would be appreciated. > > > > Ittipong > > > > On 22/08/07, *Urs Hunkeler* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> > > wrote: > > > > 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 > > [email protected] > > > https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > -- > Platform: WinXP/Cygwin > TinyOS version: 1.x, Boomerang > Programmer: MIB510 > Device(s): Mica2, MicaZ, Tmote > Sensor board: homebrew > >
_______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
