Skip to content
Snippets Groups Projects
Commit 063a109d authored by Cyril Danilevski's avatar Cyril Danilevski :scooter:
Browse files

Run web server on separate core

parent 8b8c0e5b
No related branches found
No related tags found
No related merge requests found
Pipeline #166419 passed
......@@ -7,6 +7,9 @@ unsigned long start;
extern bool eth_connected;
extern SNMP::Manager snmp;
TaskHandle_t restServerTask;
TaskHandle_t powerProcedureTask;
void setup() {
Serial.begin(115200);
......@@ -22,6 +25,11 @@ void setup() {
PINS.ramping = false;
start = millis();
xTaskCreatePinnedToCore(webInterfaceLoop, "Web Interface", 10000, NULL, 1, &restServerTask, 0);
xTaskCreatePinnedToCore(mainLoop, "PowerProcedure Task", 10000, NULL, 1, &powerProcedureTask,
1);
}
enum {
......@@ -37,13 +45,26 @@ void serialLoop() {
}
}
void loop() {
isr_check_loop();
snmp.loop();
restServer.handleClient();
toggle_status_led();
serialLoop();
if (eth_connected) { // We may be triggered, but disconnected from the network.
powerOffCheckLoop();
void webInterfaceLoop(void* pvParameters) {
Serial.print("Web loop running on core ");
Serial.println(xPortGetCoreID());
while (true) {
restServer.handleClient();
}
}
void mainLoop(void* pvParameters) {
Serial.print("main loop running on core ");
Serial.println(xPortGetCoreID());
while (true) {
isr_check_loop();
snmp.loop();
toggle_status_led();
serialLoop();
if (eth_connected) { // We may be triggered, but disconnected from the network.
powerOffCheckLoop();
}
}
}
void loop() {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment