Closed
Description
This issue contains a list of sketches which contain typical programming paradigms which break when compiling with the current version of the multi-threading supporting arduino-cli
, due to the relatively simple wrapping of the whole file within a class.
1) .inot
contains both function definition and declaration
2) Failure to register callback since all functions within the .inot` file are effectively member functions (and not free functions)
3) Initialisation of static variable fails (due to being a class member instead of a default global variable)
4) Instantiating any kind of object with constructor within the class fails (obviously)
One possible fix for all those issues would be to directly instantiate the threading class within the start of the inot
file, then only prefix setup/loop with class name, i.e.
+class Thread_1 : public Arduino_Threads
+{
+public:
+ Thread_1 { _tabname = "Thread_1" }
+};
-void setup() {
+void Thread_1::setup() {
-void loop() {
+void Thread_1::loop() {
+Thread_1 thread_1;
@facchinm What do you think? Can you rework the arduino-cli branch to support this?
CC @pnndra