Skip to content

Time elapsed since the last execution of a task that has already finished its interactions. #196

Open
@georgevbsantiago

Description

@georgevbsantiago

Hello, Thank you for this awesome library.

I'm trying to understand if there is a way to get the time elapsed since the last execution of a task that has already finished its interactions.

It would be something similar/equal to the elapsed() method from the library Ticker

Ticker Elapsed Time
uint32_t Ticker::elapsed()
Returns the time passed since the last tick in ms or us depending on mode.

In my use case, I'm checking a set of conditions and one of them is the time elapsed since the last execution of a task that has already finished its interactions.

The way I found to solve my problem:

unsigned long millis_check_OFF_to_on;

void uplink_imediato_function();
Task uplink_imediato_task(50, 1, &uplink_imediato_function, &loop_Tasks_Scheduler, false);

if(status_current_previous == false &&
   ((millis() - millis_check_OFF_to_on) >= ( 1 * TASK_MINUTE))) {

   uplink_imediato_task.restart();

   millis_check_OFF_to_on = millis();

}

If there was an approach similar to elapsed() from the Ticker library, then I could use this way:

void uplink_imediato_function();
Task uplink_imediato_task(50, 1, &uplink_imediato_function, &loop_Tasks_Scheduler, false);

if(status_current_previous == false &&
  uplink_imediato_task.elapsed() >= ( 1 * TASK_MINUTE))) {

   uplink_imediato_task.restart();

}

Is there something similar to Ticker's elapsed() method in the TaskScheduler library?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions