Skip to content

Bugs: Typical sketches that do not compile with arduino-cli (MT) #43

Closed
@aentinger

Description

@aentinger

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

Breaks_1.zip

2) Failure to register callback since all functions within the .inot` file are effectively member functions (and not free functions)

Breaks_2.zip

3) Initialisation of static variable fails (due to being a class member instead of a default global variable)

Breaks_3.zip

4) Instantiating any kind of object with constructor within the class fails (obviously)

Breaks_4.zip

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions