Go Down

Topic: uMT Library - Problem! (Read 311 times) previous topic - next topic

Idahowalker

#15
Oct 06, 2019, 09:02 pm Last Edit: Oct 06, 2019, 09:06 pm by Idahowalker
Quote
2. Why are all the interval values not even: 60503, 45007? Does this have any fundamental significance?
I remember now, the odds of those two times having multiples of each other are rather large. Thus, the times that those two tasks may be triggered at the same time are lowered. Keep in mind that the DUE is a single core, keeping the number of tasks running at "the same time" low, improves performance per task.

DrAngelOK

Thank you for help.
I redid my Every function in WakeupAfter.

We are a little do not understand each other with nested tasks.
If you rely on your code, then I need something like this:

Code: [Select]


void setup()
{
Errno_t error;
TaskId_t fC_P;
Kernel.Tk_CreateTask(fCheck_Pressure, fC_P);
Kernel.Tk_StartTask(fC_P);
}

void fCheck_Pressure()
{
while (1)
{
Kernel.Tm_WakeupAfter(1000);   // Wake up after ... seconds

if (digitalReadDirect(MWM_PINin) == 0)
{

TaskId_t fC_TH;
Kernel.Tk_CreateTask(fCheck_TH, fC_TH);
Kernel.Tk_StartTask(fC_TH);
//... or function fCheck_TH()
Kernel.Tk_DeleteTask(fC_TH); //!!!
}
}
}

void fCheck_TH()
{
String sMsgToSend;
byte temperature = 0;
byte humidity = 0;
String sTH = "TH ";
sMsgToSend.reserve(16);
if (digitalReadDirect(MWM_PINin) == 0)
{
dht11.read(&temperature, &humidity, NULL);
sMsgToSend = sTH;
sMsgToSend.concat(String(temperature) + sSeperator + String(humidity));
Kernel.Sm_Claim(SEM_ID_01, uMT_WAIT);
sMessageToSend = sMsgToSend;
Kernel.Ev_Send(iEvtID_F, EVENT_F); // trigger fSendOut_SEMAPHORE + consume a single SEMAPHORE token
sMsgToSend = "";
}
//Or Delete task This
}


DrAngelOK

I remember now, the odds of those two times having multiples of each other are rather large. Thus, the times that those two tasks may be triggered at the same time are lowered. Keep in mind that the DUE is a single core, keeping the number of tasks running at "the same time" low, improves performance per task.
I thought that the main task of the library is precisely to solve the problem of order of tasks.

Idahowalker

Code: [Select]
Kernel.Tk_CreateTask(fCheck_TH, fC_TH);
Kernel.Tk_StartTask(fC_TH);
//... or function fCheck_TH()
Kernel.Tk_DeleteTask(fC_TH); //!!!
, sure you can do it that way.  You will experience the overhead of task creation and task resource allocation. When you can just create the task, start the task and trigger the task when you desire. Hey, programmers discretion.

Idahowalker

I thought that the main task of the library is precisely to solve the problem of order of tasks.
You ever do a thing cause you want to do the thing? That's a thing, I did cause I wanted to do the thing.  No other reason. You can do the thing your way.

DrAngelOK

#20
Oct 06, 2019, 11:57 pm Last Edit: Oct 06, 2019, 11:58 pm by DrAngelOK
Code: [Select]
Kernel.Tk_CreateTask(fCheck_TH, fC_TH);
Kernel.Tk_StartTask(fC_TH);
//... or function fCheck_TH()
Kernel.Tk_DeleteTask(fC_TH); //!!!
, sure you can do it that way.  You will experience the overhead of task creation and task resource allocation. When you can just create the task, start the task and trigger the task when you desire. Hey, programmers discretion.
That's the problem, that for some reason I can't do this. I don `t understand.

So how do you do it. But to put tasks into each other - no.

Idahowalker

#21
Oct 07, 2019, 12:35 am Last Edit: Oct 07, 2019, 01:01 am by Idahowalker
That's the problem, that for some reason I can't do this. I don `t understand.

So how do you do it. But to put tasks into each other - no.
You got my code, You should be able to see how and what I did.

DrAngelOK

Yes thank you. The WakeupAfter function works as it should. Every function didn't work for me.

Go Up