1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-25 05:31:24 +01:00

make task startup nicer

This commit is contained in:
Harald Barth 2021-11-06 02:59:57 +01:00
parent 4901f12fcd
commit 877db433a4

View File

@ -143,19 +143,27 @@ bool WifiESP::setup(const char *SSid,
} }
server = new WiFiServer(port); // start listening on tcp port server = new WiFiServer(port); // start listening on tcp port
server->begin(); server->begin();
DIAG(F("Server up port %d"),port); // server started here
xTaskCreatePinnedToCore(wifiLoop, /* Task function. */ //start loop task
if (pdPASS != xTaskCreatePinnedToCore(
wifiLoop, /* Task function. */
"wifiLoop",/* name of task. */ "wifiLoop",/* name of task. */
10000, /* Stack size of task */ 10000, /* 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 */
0); /* pin task to core 0 */ 0)) { /* pin task to core 0 */
return true; DIAG(F("Could not create wifiLoop task"));
return false; return false;
} }
// report server started after wifiLoop creation
// when everything looks good
DIAG(F("Server up port %d"),port);
return true;
}
void WifiESP::loop() { void WifiESP::loop() {
int clientId; //tmp loop var int clientId; //tmp loop var