Skip to content

Conversation

@DjofPlusPlus
Copy link

I'm working with a OG v1. In my setup I was getting tracking rotation in the wrong direction. I found this to be due to pin initialization in setup() occurring after the code in the static Axis ra_axis constructor had executed, with setDirection failing. For the same reason, outputting to UART was also failing since it's initialized in setup() as well.

Moving the startTracking() call to setup resolved these issues.

print_out("Starting uart task");
}

// Start tracking axis now that pins and UART is initialized
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally i would move this init code to a new freertos task and execute the tracking before the loop.
This way its ensured that that the setup sets everything up prior executing any work. The trackingrate and direction should then also be retrievable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting to move all of the pin initialization to a task, or just startTracking(). None of that code is long running as far as I understand, so is a task needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not long running yes, but it opens doors for future feature implementation as it groups certain functions with their dedicated time slot of execution. Everyhing that should be initialized prior the scheduler takes control of the numerous work should be done in the setup(). startTracking is something that i expect the system to do when everything init related is done and can now "do the real work".

Copy link
Member

@Sylensky Sylensky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally squash the 18b1e99 and 18b1e99 into the initial commit. By doing that it keeps a clean git history of the applied changes.

// Initialize Wifi and web server
setupWireless();
// Start tracking axis now that pins and UART is initialized
setupTracking();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call the setupTracking() in the trackerTask prior the loop.
Also the setupWireless() should happen befor the tasks are created. The previous position in the code for it was better.

// Initialize Wifi and web server
setupWireless();

if (xTaskCreate(intervalometerTask, "intervalometerTask", 4096, NULL, 1, NULL))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work as it creates the same task that already exists. rename it to trackingTask with the corresponding entry function. Have a look at the other tasks on how they are added, should be fairly simple to add it.

print_out("Starting uart task");
}

// Start tracking axis now that pins and UART is initialized
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not long running yes, but it opens doors for future feature implementation as it groups certain functions with their dedicated time slot of execution. Everyhing that should be initialized prior the scheduler takes control of the numerous work should be done in the setup(). startTracking is something that i expect the system to do when everything init related is done and can now "do the real work".

@Sylensky Sylensky added the enhancement New feature or request label May 19, 2025
@Sylensky
Copy link
Member

Sylensky commented Jun 2, 2025

Any update on this PR @DjofPlusPlus? Please rebase your PR on the beta branch as changes need to be tested prior getting merged to the main branch.

@DjofPlusPlus
Copy link
Author

I'm currently abroad away from the hardware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants