Description
Based on:
TaskScheduler/examples/Scheduler_example16_Multitab/Scheduler_example16_Multitab.ino
It says that Arduino IDE plays some dirty tricks on main sketch file and it rearranges #includes, blindly creates forward definitions. However, developing in PlatformIO I faced the bug that the blank .ino file workaround didn't help and one of my tasks which was defined in file didn't want to execute. After couple of hours on trying to narrow down the issue, found that if I simply rename the file where my task is to make it appear alphabetically earlier than main.cpp, then it fixes the issue.
Example:
ultrasound.cpp & ultrasound.h -> contains Task loopUltrasound which periodically invokes itself;
main.cpp -> defines Scheduler runner; setup() and loop() with runner.execute();
Workaround Fix:
- rename main.cpp to zzmain.cpp
Alternative workaround Fix:
- rename file ultrasound to aUltrasound
Not sure why it behaves such way, but I hope it helps to narrow down the issue.