Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions esp32_wireless_control/firmware/axis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ Axis::Axis(uint8_t axis, uint8_t dirPinforAxis, bool invertDirPin) : stepTimer(4
stepTimer.attachInterupt(&stepTimerDEC_ISR);
break;
}

if (DEFAULT_ENABLE_TRACKING == 1 && axisNumber == 1)
{
startTracking(trackingRate, trackingDirection);
}
}

void Axis::startTracking(trackingRateS rate, bool directionArg)
Expand Down
20 changes: 17 additions & 3 deletions esp32_wireless_control/firmware/firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,15 @@ void setupWireless()
dnsServer.start(DNS_PORT, WEBSITE_NAME, WiFi.softAPIP());
}

void setupTracking()
{
#if defined(DEFAULT_ENABLE_TRACKING) && (DEFAULT_ENABLE_TRACKING == 1)
print_out(c_DIRECTION ? "Tracking with c_DIRECTION: HIGH (North)"
: "Tracking with c_DIRECTION: LOW (South)");
ra_axis.startTracking(ra_axis.trackingRate, ra_axis.trackingDirection);
#endif // DEFAULT_ENABLE_TRACKING
}

void setup()
{
// Start the debug serial connection
Expand All @@ -448,20 +457,25 @@ void setup()
digitalWrite(EN12_n, LOW);
// handleExposureSettings();

// Initialize Wifi and web server
setupWireless();

if (xTaskCreate(uartTask, "UartTask", 4096, NULL, 1, NULL))
{
print_out("\033c");
print_out("Starting uart task");
}

if (xTaskCreate(intervalometerTask, "intervalometerTask", 4096, NULL, 1, NULL))
Copy link
Copy Markdown
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 intervalometer task");
if (xTaskCreate(intervalometerTask, "intervalometerTask", 4096, NULL, 1, NULL))
print_out("Starting intervalometer task");
if (xTaskCreatePinnedToCore(webserverTask, "webserverTask", 4096, NULL, 1, NULL, 0))
print_out("Starting webserver task");
if (xTaskCreate(dnsserverTask, "dnsserverTask", 2048, NULL, 1, NULL))
print_out("Starting dnsserver task");

// Initialize Wifi and web server
setupWireless();
// Start tracking axis now that pins and UART is initialized
setupTracking();
Copy link
Copy Markdown
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.

}

void loop()
Expand Down