On Mon, May 30, 2011 at 2:45 PM, Xavi Colomer <[email protected]> wrote:
> Hi!
> I have a problem with a value I will modify during my alghoritm. I
> initialize the value at first of implementation like this: uint16_t
> ibit_mask=0xFFFF;
>
> Then, I receive a packet with a new value of ibit_mask and I take that with
> this interface:
> event TOS_MsgPtr ReceiveIbit.receive(TOS_MsgPtr msg){
> YDataMsg *payload;
>
> payload = (YDataMsg*)(msg->data);
> atomic ibit_mask = payload->yData.datap2.ibit;
>
> return msg;
> }
>
> I have a Timer of X seconds (is not important) that takes light data on
> each timer repetition and send AND with data to ibit_mask, I do that like
> this:
> async event result_t Light.dataReady(uint16_t data) {
> atomic llum=data;
> if (ibit_mask==0){
> atomic pack->xData.datap1.light = llum;
> }
> else{
> atomic pack->xData.datap1.light = llum&ibit_mask;
> }
> post SendData();
> return SUCCESS;
> }
>
> But when I recieve a new ibit_mask, the value not refresh itself. What can
> I do?
>
Based on the snippet of code you sent the following is true.
If ibit_mask changes => a packet was received && the packet data !=
ibit_mask
Do you really know that you are receiving a packet?
You might want to invest in a JTAG device so you can actually debug this
kind of thing.
Debugging this stuff by inspection is a royale pain.
>
> Thanks in advance,
>
> regards!
>
> Xavi
>
> _______________________________________________
> 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