Skip to content

Commit

Permalink
Pin neopixel logic to core 0
Browse files Browse the repository at this point in the history
  • Loading branch information
nmtoblum committed Jan 18, 2020
1 parent 90afc73 commit c1ae635
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ uint8_t laststate = SMODEINITIAL;
static unsigned long tsPolling = 0;
uint8_t retries = 0;

// Multicore
TaskHandle_t TaskNeopixel;



/**
* Helper
Expand Down Expand Up @@ -471,6 +475,16 @@ void statemachine() {
}


/**
* Multicore
*/
void neopixelTask(void * parameter) {
for (;;) {
ws2812fx.service();
}
}


/**
* Main functions
*/
Expand Down Expand Up @@ -518,14 +532,23 @@ void setup()
DBG_PRINTLN("SPIFFS Mount Failed");
return;
}

// Pin neopixel logic to core 0
xTaskCreatePinnedToCore(
neopixelTask,
"Neopixels",
1000,
NULL,
1,
&TaskNeopixel,
0);

}

void loop()
{
// iotWebConf - doLoop should be called as frequently as possible.
iotWebConf.doLoop();

ws2812fx.service();

statemachine();
}

0 comments on commit c1ae635

Please sign in to comment.