Hi Janos, Finally, I did it. Many thanks for your suggestions.
Ittipong On 11/03/2008, Ittipong Khemapech <[EMAIL PROTECTED]> wrote: > > Hi Janos, > > Thanks for your reply. I'll try it. > > Ittipong > > On 11/03/2008, Janos Sallai <[EMAIL PROTECTED]> wrote: > > > > Ittipong, > > > > > > > > You will need to refactor your code such that you catch the sendDone > > event after sending each message, and send the next one only after that. > > > > > > > > Janos > > > > > > > > *From:* [EMAIL PROTECTED] [mailto: > > [EMAIL PROTECTED] *On Behalf Of *Ittipong > > Khemapech > > *Sent:* Tuesday, March 11, 2008 11:00 AM > > *To:* tinyos-help > > *Subject:* [Tinyos-help] Automatic TX Power Setting > > > > > > > > Hi, > > > > I am working on automatic TX power setting. I have the following codes: > > > > implementation { > > message_t pkt; > > bool busy = FALSE; // Used to check if mote is still > > busy sending > > uint16_t sentpkts = 0; // Number of sent packets > > uint8_t current_tx; // Used to adapt transmission > > power, start with the minimum level > > uint8_t i; // Used to count number of > > transmissions > > > > ....... > > > > event void MetricsSendTimer.fired() { > > > > if (!busy) { > > > > MetricsMsg* metricsMsg = (MetricsMsg*)(call > > Packet.getPayload(&pkt, > > NULL)); > > // Allowable tx power levels are 3, 7, 11, 15, 19, 23, 27 and > > 31 > > for (current_tx = 3; current_tx <= 31; current_tx += 4) { > > > > // Mote sends 20 times for each tx power level > > for (i = 1; i <= 20; i++) { > > > > call CC2420Packet.setPower(&pkt, current_tx); > > current_tx = call CC2420Packet.getPower(&pkt); > > > > // Write current tx and no of sent pkts to the > > payload > > metricsMsg->txpower = current_tx; > > metricsMsg->pkt_no = sentpkts; > > metricsMsg->run_no = i; > > > > if (call AMSend.send(AM_BROADCAST_ADDR, &pkt, > > sizeof(MetricsMsg)) == SUCCESS) { > > busy = TRUE; > > > > } > > > > } > > > > } > > } > > } > > > > ....... > > } > > > > I've run Listen (with BaseStation) and got i = 1 and current_tx = 3 all > > the time. They weren't increased. > > > > I have been stuck for a day. Please help. > > > > Thanks, > > Ittipong > > > >
_______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help