Pin Tasks to cores
This commit is contained in:
parent
f91b3c8cfb
commit
154ed66174
5
include/coreids.h
Normal file
5
include/coreids.h
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define CORE_ID_LED 1
|
||||||
|
#define CORE_ID_WEBSERVER 0
|
||||||
|
#define CORE_ID_UPDATESERVER 0
|
|
@ -6,19 +6,22 @@
|
||||||
|
|
||||||
#include "UpdateServer.h"
|
#include "UpdateServer.h"
|
||||||
|
|
||||||
|
#include "coreids.h"
|
||||||
|
|
||||||
UpdateServer::UpdateServer(const std::string &pw)
|
UpdateServer::UpdateServer(const std::string &pw)
|
||||||
: m_cr(pw)
|
: m_cr(pw)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void UpdateServer::start(void)
|
void UpdateServer::start(void)
|
||||||
{
|
{
|
||||||
xTaskCreate(
|
xTaskCreatePinnedToCore(
|
||||||
updateTask, /* Task function. */
|
updateTask, /* Task function. */
|
||||||
"Update Task", /* name of task. */
|
"Update Task", /* name of task. */
|
||||||
10000, /* Stack size of task */
|
10000, /* Stack size of task */
|
||||||
this, /* parameter of the task */
|
this, /* parameter of the task */
|
||||||
2, /* priority of the task */
|
2, /* priority of the task */
|
||||||
NULL); /* Task handle to keep track of created task */
|
NULL, /* Task handle to keep track of created task */
|
||||||
|
CORE_ID_UPDATESERVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sendMessage(WiFiClient *client, bool success, const char *message)
|
static void sendMessage(WiFiClient *client, bool success, const char *message)
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "Fader.h"
|
#include "Fader.h"
|
||||||
#include "Animation/AnimationController.h"
|
#include "Animation/AnimationController.h"
|
||||||
|
|
||||||
|
#include "coreids.h"
|
||||||
|
|
||||||
WebServer::WebServer(void)
|
WebServer::WebServer(void)
|
||||||
: m_cr(Config::instance().getCRPassword()), m_fader(NULL)
|
: m_cr(Config::instance().getCRPassword()), m_fader(NULL)
|
||||||
{
|
{
|
||||||
|
@ -274,13 +276,14 @@ void WebServer::serverTask(void *arg)
|
||||||
|
|
||||||
bool WebServer::start(void)
|
bool WebServer::start(void)
|
||||||
{
|
{
|
||||||
xTaskCreate(
|
xTaskCreatePinnedToCore(
|
||||||
WebServer::serverTask, /* Task function. */
|
WebServer::serverTask, /* Task function. */
|
||||||
"HTTP Server Task", /* name of task. */
|
"HTTP Server Task", /* name of task. */
|
||||||
6144, /* Stack size of task */
|
6144, /* Stack size of task */
|
||||||
NULL, /* parameter of the task */
|
NULL, /* parameter of the task */
|
||||||
1, /* priority of the task */
|
1, /* priority of the task */
|
||||||
NULL); /* Task handle to keep track of created task */
|
NULL, /* Task handle to keep track of created task */
|
||||||
|
CORE_ID_WEBSERVER);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,13 +221,14 @@ void setup()
|
||||||
|
|
||||||
animController.changeAnimation(std::unique_ptr<Animation>(new ConnectingAnimation(&ledFader)), false);
|
animController.changeAnimation(std::unique_ptr<Animation>(new ConnectingAnimation(&ledFader)), false);
|
||||||
|
|
||||||
xTaskCreate(
|
xTaskCreatePinnedToCore(
|
||||||
ledTask, /* Task function. */
|
ledTask, /* Task function. */
|
||||||
"LED Task", /* name of task. */
|
"LED Task", /* name of task. */
|
||||||
10000, /* Stack size of task */
|
10000, /* Stack size of task */
|
||||||
NULL, /* parameter of the task */
|
NULL, /* parameter of the task */
|
||||||
3, /* priority of the task */
|
3, /* priority of the task */
|
||||||
NULL); /* Task handle to keep track of created task */
|
NULL, /* Task handle to keep track of created task */
|
||||||
|
CORE_ID_LED);
|
||||||
|
|
||||||
// Connect the WiFi network (or start an AP if that doesn't work)
|
// Connect the WiFi network (or start an AP if that doesn't work)
|
||||||
for (auto &net : Config::instance().getWLANList())
|
for (auto &net : Config::instance().getWLANList())
|
||||||
|
|
Loading…
Reference in a new issue