Giter Club home page Giter Club logo

arduino-tasker's People

Contributors

ivankravets avatar joysfera avatar lupalby avatar per1234 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

Watchers

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

arduino-tasker's Issues

Tasks Priority

Wondering if its possible to add tasks with priority?

Example i add a timeout during running code and i want to make sure its at the top of priority?

I imagine this would work by each task has a priority number and tasker executes tasks in ascending order. Tasks with the same priority execute in order of added ?

This allows you to add tasks with different priority levels, if not stated priority default of 255 (0 is Highest) and since their all the same then they execute in order of added, thus this can work the same way currently.

Tell me your thoughts.
Tim.

Can't call function defined as (void)

Any function defined as (void) can not be called by tasker.
Error while compiling:

error: invalid conversion from 'void ()()' to 'TaskCallback {aka void ()(int)}' [-fpermissive]
tasker.setInterval(nrfReceive, 5000)

Tasker.h: 53:6: error: initializing argument 1 of 'bool Tasker::setInterval(TaskCallback, long unsigned int, int, byte)' [-fpermissive]
bool Tasker*: setInterval(TaskCallback func, unsigned long interval, int param, byte prio)
Error compiling project sources

Seems that it is not BUG in Tasker itself, but some restrictions in C/C++

Long intevals seems not work

I tried to make 3 minutes (3x60x1000) intervals, but it never triggered the task, while it worked for 30 second intervals. I assume it has something to do with types. Maybe mention in instruction the longest interval. Otherwise nice and easy to use.

Include #ifndef TASKER

Small change to include
#ifndef TASKER
#define TASKER
{code}
#endif

so that the lib cant be refined if referenced twice (#include <Tasker.h>)

Tim.

Using Tasker in a multi-file project

Hi,

First off, let me state that I am a C++ newbie and most likely am not doing this correctly.

I am having a problem on a multi-file project (using one .ino file and multiple .h and .cpp files).

I am trying to define a global Tasker instance that void loop() updates but that I can access from other files.

If I define my tasker inside the .ino file and use it there, it runs great but when I define it on my global file and import it, then all hell breaks loose.

In my global.h file I have extern Tasker tasker;

#ifndef GLOBAL_H
#define GLOBAL_H
#include <Tasker.h>
extern Tasker tasker;
#endif

and then in my global.cpp I have Tasker tasker;

#ifndef GLOBAL_SOURCE
#define GLOBAL_SOURCE
#include <Tasker.h>
Tasker tasker;
#endif

then I import global.h from my .ino file and I get the following:

[Starting] Upload sketch - airsoft_fcu.ino
Please see the build logs in Output path: c:\Users\silent\Documents\Projects\airsoft_fcu\.vscode\build
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
Build options changed, rebuilding all
sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::Tasker(bool)'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::Tasker(bool)'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::findTask(void (*)(int), int)'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::scheduledIn(void (*)(int), int)'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::scheduledIn(void (*)())'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::findTask(void (*)())'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::removeTask(int)'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::cancel(void (*)())'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::cancel(void (*)(int), int)'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::loop()'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::addTask(void (*)(int), unsigned long, unsigned int, int, unsigned char)'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::setRepeated(void (*)(), unsigned long, unsigned int, unsigned char)'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::setTimeout(void (*)(), unsigned long, unsigned char)'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::setInterval(void (*)(), unsigned long, unsigned char)'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::setRepeated(void (*)(int), unsigned long, unsigned int, int, unsigned char)'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::setTimeout(void (*)(int), unsigned long, int, unsigned char)'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `Tasker::setInterval(void (*)(int), unsigned long, int, unsigned char)'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

sketch\src\global.cpp.o (symbol from plugin): In function `Tasker::Tasker(bool)':

(.text+0x0): multiple definition of `tasker'

sketch\airsoft_fcu.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
[Error] Exit with code=1

What am I doing wrong?

PS: awesome lib btw

How do I call a class member function using Tasker

I am trying to use Tasker in an instance class. The method has to be a member so that it can access class variables for that instance. Norml functions work but I need to bind to the call to an instance. I have dine it with other callbacks using the same syntax. I have tried to add int as parameter and changed member from private to public but no change.

`
void ChannelStateService::begin() {
_deviceTime.setInterval(std::bind(&ChannelStateService::updateStateTime, this), 10000);
}

void ChannelStateService::updateStateTime(){
update([&](ChannelState& channelState) {
return StateUpdateResult::CHANGED;
}, _state.channel.name);
}
`
I get the following error:

src/automation/ChannelStateService.cpp: In member function 'void ChannelStateService::begin()':
src/automation/ChannelStateService.cpp:187:90: error: no matching function for call to 'Tasker::setInterval(std::_Bind_helper<false, void (ChannelStateService::)(), ChannelStateService const>::type, int)'
_deviceTime.setInterval(std::bind(&ChannelStateService::updateStateTime, this), 10000);
^
src/automation/ChannelStateService.cpp:187:90: note: candidates are:
In file included from src/automation/ChannelStateService.h:18:0,
from src/automation/ChannelStateService.cpp:2:
.pio/libdeps/esp12e/Tasker/Tasker.h:92:6: note: bool Tasker::setInterval(TaskCallback0, long unsigned int, byte)
bool Tasker::setInterval(TaskCallback0 func, unsigned long interval, byte prio)
^
.pio/libdeps/esp12e/Tasker/Tasker.h:92:6: note: no known conversion for argument 1 from 'std::_Bind_helper<false, void (ChannelStateService::)(), ChannelStateService const>::type {aka std::_Bind<std::_Mem_fn<void (ChannelStateService::)()>(ChannelStateService)>}' to 'TaskCallback0 {aka void (*)()}'
.pio/libdeps/esp12e/Tasker/Tasker.h:87:6: note: bool Tasker::setInterval(TaskCallback1, long unsigned int, int, byte)
bool Tasker::setInterval(TaskCallback1 func, unsigned long interval, int param, byte prio)

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.