Giter Site home page Giter Site logo

makuna / task Goto Github PK

View Code? Open in Web Editor NEW
115.0 115.0 34.0 86 KB

Arduino Nonpreemptive multitasking library. Please refer to the Wiki for more details. Please use the GitHub Discussions to ask questions as the GitHub Issues feature is used for bug tracking.

License: GNU Lesser General Public License v3.0

C++ 100.00%

task's People

Contributors

berrak avatar ivankravets avatar kuthullu avatar makuna avatar rudacs avatar schlammbad avatar siruli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

task's Issues

Handling asyncronous callbacks

Hi,

first a big THANK YOU for this library - absolutely awesome!

I worked through the examples and also have a couple things running on this library and i was wondering how i best would handle asyncronous callbacks. What do i mean with that?

So for example i am getting the data from a light sensor and want to forward it to MQTT. At the same time i want to ensure that a display constantly being updated every 1000ms.

So i wrote a custom Task (like the ButtonTask.h) to run the Sensor Update and finally call a callback. The Callback basically just fires off the following handler:

void taskHandleGetTSL2561()
{
  taskManager.StartTask(&taskMqttTSL2561);
}

In the taskMqttTSL2561 the Task is being stopped again at the end (taskManager.StopTask(&taskMqttTSL2561);). This way i am not blocking the display update if this would come in between the sensor reading & MQTT hand-off. The MQTT is fired off 500ms after the task has been started which at least from the idea would allow this to be run properly.

My question is: Is this how this is intended? Or is there a better way to fire off "one time" tasks?

Thanks in advance!

Best Regards,
Uli

Off by one in MessageTask queue

We pop garbage on the first call to MessageTask::PopMessage, and are always one behind when we pop.

To explain by example:

  • a newly created queue has _indexFront=0 and _indexBack=0.
  • the first call to MessageTask::SendAsyncMessage writes to offset 1 in the queue buffer (_indexBack + 1).
  • the first call to MessageTask::PopMessage reads from _indexFront, which points to offset 0 in the queue buffer.

Task frequency

Is there a way to change a task frequency during runtime?

esp8266 WDT reboot caused by TaskManager c-tor

a really simple sketch to reproduce the problem.

#include <Task.h>

TaskManager Tasks;

void setup() {
  Serial.begin(74880);
  Serial.setDebugOutput(true);
  Serial.println();
  Serial.println(ESP.getResetReason());
  Serial.println(ESP.getResetInfo());

  while (true) {
    Serial.print('.');
    if ((i % 80) == 0)
      Serial.println();
    //wdt_reset();
    delay(500);
  }
}

void loop() {
}

normally we don't want to mess around with WDT unless it's really absolutely necessary, the user might make other use with it.

Tasktime

Hi I use this library in am repository. It makes my live easy using tasks.
Now I want to change the Tasktime of a special task by loading a config file. but it seems that this is not possible.
What do I do wrong?
Is there a way to change the Tasktime of an individual task?

Sleep and delay()

I'm using this excellent library to run tasks, but I want the ESP to sleep otherwise. I have implemented light sleep, but that only runs on a delay() call. If my fastest task is 50ms and I don't care about accuracy (I'm fine being 20ms over), can I add a 20ms delay() call in the loop? The only other thing that runs is the Task scheduler.

Would it be possible to have Task optionally call delay() in its downtime, so I don't have to do it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.