[Tinyos-help] Automatic TX Power Setting

Ittipong Khemapech ik.tinyos at googlemail.com
Tue Mar 11 12:10:39 PDT 2008


Hi Janos,

Thanks for your reply. I'll try it.

Ittipong

On 11/03/2008, Janos Sallai <sallai at isis.vanderbilt.edu> 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:* tinyos-help-bounces at millennium.berkeley.edu [mailto:
> tinyos-help-bounces at millennium.berkeley.edu] *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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20080311/797f2519/attachment.htm


More information about the Tinyos-help mailing list