the Radio start up via AMControl.start() is split phase. you have to wait for AMControl.startDone() to be signalled. That tells you the radio is up.
On Fri, Mar 17, 2017 at 3:03 PM, arsaraiva <[email protected]> wrote: > Hello friends, > > I'm having a hard time making a sensor wait a while before running a > function. > > event void TimerSlot.fired() { > slot=slot%numslots; > * if (padrao[slot]) *{ > call AMControl.start(); //Call to start the radio > dbg("teste","SLOT_ATIVO: No %hu no slot [%hu] com tempo=%lu.\n", > TOS_NODE_ID, slot, call Clock.get()); > * if (radio == TRUE)* { //The radio is not connected yet and does not > send the packet > dbg("teste","RADIO_JA_LIGADO: No %hu no slot [%hu] com > tempo=%lu.\n", TOS_NODE_ID, slot, call Clock.get()); > teste_msg_t* rcm = (teste_msg_t*)call Packet.getPayload(&packet, > sizeof(teste_msg_t)); > rcm->seqnum = seqnum; > rcm->slot = slot; > rcm->syncwith = syncwith; > rcm->synchops = synchops; > if (call AMSend.send(AM_BROADCAST_ADDR, &packet, > sizeof(teste_msg_t)) == SUCCESS) { > dbg("teste", "ENVIAR_PKT [seqnum=%hu], slot %hu no > tempo=%lu.\n", seqnum, slot, call Clock.get()); > seqnum++; > locked = TRUE; > } > > Note that soon after the first IF, I have a call to connect the radio (call > AMControl.start ()), but when the execution arrives in the second IF, the > radio is not effectively connected, making this condition not true in a > first moment. > I was wondering if there is a sleep function in which I set a time when I > want the radio to turn on. > Something like: > > If (slot) > Call AMControl.start (); > Dbg ("test", "SLOT_ATIVE: No% hu in slot [% hu] with time =% lu.", > TOS_NODE_ID, slot, call Clock.get ()); > > -> sleep function (x); (I.e.) > > If (radio == TRUE) { > Dbg ("test", "RADIO_JA_LIGADO: No% hu in slot [% hu] with time =% > lu.", TOS_NODE_ID, slot, call Clock.get ()); > > I thank the help of all. > > > > -- > View this message in context: http://tinyos-help.10906.n7. > nabble.com/Sleep-function-no-mote-tp25076.html > Sent from the TinyOS - Help mailing list archive at Nabble.com. > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help -- Eric B. Decker Senior (over 50 :-) Researcher
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
