Hello,

Could you tell why the Timer1 stops running in this code?

=============== CODE ===============================
...
call Timer1.startPeriodic(x);
...
if(condtion){
    call Timer1.stop();
    print("Timer1.stop() at %llu",sim_time());

    call Timer2.startPeriodic(y);
}
...

event void Timer1.fired(){
    print("Timer1.fired() at %llu",sim_time());
}

event void Timer2.fired(){
    call Timer1.startPeriodic(x);

    if(call Timer1.isRunning()){
        printf("Timer2.fired() Running at %llu \n",sim_time());
    }
    else{
        printf("Timer2.fired() Not Running at %llu \n",sim_time());
    }

    call Timer2.stop();
}
...
...
if(Message is Received){
    if(call Timer1.isRunning()){
        printf("Msg received Running at %llu \n",sim_time());
    }
    else{
        printf("Msg received Not Running at %llu \n",sim_time());
    }
}
...

============== END OF CODE ==========================

OUTPUT of CODE:
...
Timer1.stop() at 1153903829995
...
Timer2.fired() Running at 1233896498275
Msg received Not Running at 125..........   // After this Timer1 never
starts???
Msg received Not Running at 127..........
...
Msg received Not Running at 4924382498378
...


Thank you!
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to