arkhipenko / TaskScheduler

Cooperative multitasking for Arduino, ESPx, STM32, nRF and other microcontrollers
http://playground.arduino.cc/Code/TaskScheduler
BSD 3-Clause "New" or "Revised" License
1.33k stars 243 forks source link

strange compiling errors #88

Closed ilovesushi closed 4 years ago

ilovesushi commented 4 years ago

fresh vscode+platformio+stm32 arduino project blink example cant be compilled library added via platformio didnt compile at all if were copied to lib(folder) what can it be

`#define _TASK_SLEEP_ON_IDLE_RUN

include

//#define LEDPIN 13 int static LEDPIN=PC13; Scheduler ts;

void WrapperCallback();

void BlinkOnEnable(); void BlinkOnDisable(); void LEDOn(); void LEDOff();

Task tWrapper(30000, TASK_FOREVER, &WrapperCallback, &ts, true); Task tBlink(5000, TASK_ONCE, NULL, &ts, false, &BlinkOnEnable, &BlinkOnDisable); Task tLED(TASK_IMMEDIATE, TASK_FOREVER, NULL, &ts, false, NULL, &LEDOff);

void WrapperCallback() { Serial.println("In WrapperCallback"); tBlink.restartDelayed(); // LED blinking is initiated //every 30 seconds for 5 seconds }

Found 9 compatible libraries Scanning dependencies... Dependency Graph |-- 3.1.3 Building in release mode Compiling .pio\build\blackpill_f103c8\src\main.cpp.o src\main.cpp:18:48: error: invalid conversion from 'void ()()' to 'TaskOnEnable {aka bool ()()}' [-fpermissive] Task tBlink(5000, TASK_ONCE, NULL, &ts, false, &BlinkOnEnable, &BlinkOnDisable); ^~~~~~ In file included from src\main.cpp:4:0: C:\Users\dan.platformio\lib\TaskScheduler_ID721\src/TaskScheduler.h:247:1: note: initializing argument 6 of 'Task::Task(long unsigned int, long int, TaskCallback, Scheduler, bool, TaskOnEnable, TaskOnDisable)' Task::Task( unsigned long aInterval, long aIterations, TaskCallback aCallback, Scheduler aScheduler, bool aEnable, TaskOnEnable aOnEnable, TaskOnDisable aOnDisable ) { ^~~~ src\main.cpp: In function 'bool BlinkOnEnable()': src\main.cpp:33:6: error: ambiguating new declaration of 'bool BlinkOnEnable()' bool BlinkOnEnable(){ ^~~~~ src\main.cpp:12:6: note: old declaration 'void BlinkOnEnable()' void BlinkOnEnable(); ^~~~~ *** [.pio\build\blackpill_f103c8\src\main.cpp.o] Error 1`

ilovesushi commented 4 years ago

Solved probably a typo, testing all examples

wiki section and examples dont match

arkhipenko commented 4 years ago

Documentation was developed before the Arduino IDE started to require forward function definition. So Wiki Blink example would not even compile in 1.8.10 - forward definitions need to be added. The on enable functions must be bool, not void - which you have already figured out. I wish I have the time to go back and review all the documentation, but I don't - sorry - when I figure out the way to monetize TS and live off of it, I promise, the documentation will be stellar!

ilovesushi commented 4 years ago

I think you need more to do to get living from it:) By the way do you know any useful resources to help me out to rewrite i2c spi rs232 asynchronously with Tasks schedule r