Hi David, Come on, you have to decide it for your self. If your target mote is far, maybe you need to set the TX_POWER to a higher value (so the message will be heard even that far), or if the target is close then a smaller value might suffice. There is no component that can give you a value, because that value depends on what you want to achieve. Most probably a constant value is fine.
Miklos On Wed, Jul 29, 2009 at 1:22 AM, David Li<[email protected]> wrote: > Hi Miklos, > > You were right on the point: who set it for me? > > Before this I always assumed this happened somewhere. But now I need to > figure this out. So the question is where I can get the "value" parameter so > I can use it in PacketTransmitPower.set(msg, value). > > Of course I can hard code this value to be the same as in HplRF230.h. But is > there any interface that I can use to get it in the program? In other words > how would I get the TX_POWER value? > > David > > On Tue, Jul 28, 2009 at 4:07 PM, Miklos Maroti <[email protected]> > wrote: >> >> Hi David, >> >> Your code is all fine, but who is going to SET the transmitpower of >> the outgoing packet. There is no automatic component that will do it >> for you, so you have to call at some point the call >> PacketTransmitPower.set(msg, value) command and set an appropriate >> value before you call Send.send(). This is going to be the TX_POWER >> value used to transmit this outgoing message. >> >> Miklos >> >> On Tue, Jul 28, 2009 at 6:38 PM, David Li<[email protected]> wrote: >> > Hi Miklos: >> > >> > Ok, I now found out that the transmit power wasn't set on the sender. >> > This >> > brings out additional questions: >> > >> > 1. Is this function below the right function for the sender tx power to >> > be >> > set? >> > >> > event void SendTimer.fired(){ >> > >> > RssiMsg* buf = (RssiMsg*)(call RssiMsgSend.getPayload(&msg, >> > sizeof(RssiMsg))); >> > >> > if(call PacketTransmitPower.isSet(&msg)){ >> > tx_power = call PacketTransmitPower.get(&msg); /*new*/ >> > } >> > else{ >> > tx_power = 0xFE; /* if not tx power, this value is printed out >> > on >> > the base station */ >> > } >> > >> > buf->tx_power_reading = tx_power; >> > >> > call RssiMsgSend.send(AM_BROADCAST_ADDR, &msg, sizeof(RssiMsg)); >> > } >> > >> > >> > >> > 2. If not then where do you recommend to check for sender tx power? >> > >> > Thanks. >> > >> > David >> > >> > On Tue, Jul 28, 2009 at 8:44 AM, Miklos Maroti >> > <[email protected]> >> > wrote: >> >> >> >> Hi David, >> >> >> >> On Tue, Jul 28, 2009 at 4:23 PM, <[email protected]> wrote: >> >> > Hi Miklos: >> >> > >> >> > Two more questions: >> >> > >> >> > 1. In RF230PacketC.nc, I only see PacketTransmitPower.isSet(). Where >> >> > is >> >> > the >> >> > isValid function? >> >> >> >> Use the isSet function (my memory was wrong). >> >> >> >> > 2. Should I get the transmit power value on the receiver? I am >> >> > currently >> >> > getting it on the sender and putting the value in the RssiMsg for >> >> > read >> >> > on >> >> > the receiver. Is this wrong? >> >> >> >> Of course on the sender side, so what you are doing is right. >> >> >> >> Miklos >> >> > >> >> > Thanks. >> >> > >> >> > David >> >> > >> >> > On Jul 27, 2009 1:15pm, Miklos Maroti <[email protected]> >> >> > wrote: >> >> >> David, >> >> >> >> >> >> >> >> >> >> >> >> The PacketTransmitPower interface also provides a command like >> >> >> >> >> >> "isValid", so you have to call that first. If that returns FALSE >> >> >> (most >> >> >> >> >> >> probably) then you did not set the transmit power of he outgoing >> >> >> >> >> >> message before calling send(). >> >> >> >> >> >> >> >> >> >> >> >> Miklos >> >> >> >> >> >> >> >> >> >> >> >> On Mon, Jul 27, 2009 at 9:23 PM, David [email protected]> >> >> >> wrote: >> >> >> >> >> >> > Hello, >> >> >> >> >> >> > >> >> >> >> >> >> > I am modifying RssiDemo to read tx power values in addition to >> >> >> > rssi >> >> >> > values. >> >> >> >> >> >> > What I did was: >> >> >> >> >> >> > >> >> >> >> >> >> > 1. added a field in the RssiMsg: >> >> >> >> >> >> > >> >> >> >> >> >> > typedef nx_struct RssiMsg{ >> >> >> >> >> >> > nx_int16_t rssi; >> >> >> >> >> >> > nx_uint16_t tx_power_reading; //new >> >> >> >> >> >> > } RssiMsg; >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > 2. read the tx power on the SendingMote: >> >> >> >> >> >> > >> >> >> >> >> >> > event void SendTimer.fired(){ >> >> >> >> >> >> > >> >> >> >> >> >> > RssiMsg* buf = (RssiMsg*)(call RssiMsgSend.getPayload(&msg, >> >> >> >> >> >> > sizeof(RssiMsg))); >> >> >> >> >> >> > >> >> >> >> >> >> > tx_power = call PacketTransmitPower.get(&msg); /*new*/ >> >> >> >> >> >> > buf->tx_power_reading = tx_power; /*new*/ >> >> >> >> >> >> > >> >> >> >> >> >> > call RssiMsgSend.send(AM_BROADCAST_ADDR, &msg, >> >> >> > sizeof(RssiMsg)); >> >> >> >> >> >> > } >> >> >> >> >> >> > >> >> >> >> >> >> > 3. In java code (after make), print out the tx power: >> >> >> >> >> >> > >> >> >> >> >> >> > public void messageReceived(int to, Message message) { >> >> >> >> >> >> > RssiMsg msg = (RssiMsg) message; >> >> >> >> >> >> > int source = message.getSerialPacket().get_header_src(); >> >> >> >> >> >> > System.out.println("Rssi Message received from node " + source >> >> >> > + >> >> >> >> >> >> > ": Rssi = " + msg.get_rssi() + >> >> >> >> >> >> > ": Tx power = " + msg.get_tx_power_reading()); >> >> >> > /*new*/ >> >> >> >> >> >> > } >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > So everything was compiled and installed ok. But the tx power >> >> >> > output >> >> >> > is >> >> >> >> >> >> > always 0 even it's actually should be 0xF as defined by >> >> >> >> >> >> > tos/platform/iris/chips/rf230/HplRF230.h. >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > Any idea? >> >> >> >> >> >> > >> >> >> >> >> >> > David >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > _______________________________________________ >> >> >> >> >> >> > Tinyos-help mailing list >> >> >> >> >> >> > [email protected] >> >> >> >> >> >> > >> >> >> > >> >> >> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help >> >> >> >> >> >> > >> >> >> >> > >> > > > _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
