init() and start() are only called once by TinyOS.

On Tue, June 5, 2007 5:21 am, Vipin Kashyap said:
> I am writing an application for High Frequency Sampling and wireless data
> transfer. The whole logic of the app works well for one pass, but at the
> end of the pass it does not iterate any further.
>
> StdControl.init() and start() are as below-
>
> command result_t StdControl.init() {
>     call Leds.init();
>       call ADCControl.init();
>       {call AllocationReq.request(MAX_SAMPLES * sizeof(sample_t));
>       dbg(DBG_USR1, "MESSAGE: Allocation Req sent\n");}
>       return SUCCESS;
>   }
>
>
>   command result_t StdControl.start() {
>       dbg(DBG_USR1, "MESSAGE: Entered StdControl.start\n");
>       return SUCCESS;
>   }
>
> At the end of the first pass I am calling StdControl.init(). But after
> this the usual  AllocationReq.requestProcessed() does not fire.
>
> Where am I going wrong.

You ought to be posting a task in start() that does your sampling that you
can either call again from a done() signal, or that calls a second task
whose job is to repost the first task.

(You shouldn't repost a task in itself, as it may fail because the task is
already posted and running, and a task can only be posted once in the
queue.)

You may also want to set up a timer that you initiate from start() and use
that to do your sampling.

Either way, I believe there is some posted code in the archives that does
high-speed sampling. Be sure to read them. Searching for "speed" as a title
keyword would be a good start.

-- 
The difference between the right word and the almost right word is really a
large matter- it's the difference between a lightning bug and the lightning.
-Twain

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

Reply via email to