fix: move FTP task to core 1 — core 0 reserved for WiFi stack
FTP task on core 0 at priority 2 starved the WiFi networking stack, preventing the FTP welcome banner from being sent. Moved to core 1 with 2ms yield to coexist with LVGL rendering.
This commit is contained in:
+9
-4
@@ -449,12 +449,16 @@ static void initNtp() {
|
||||
Serial.println("[NTP] Warning: time not yet synced (will update in background)");
|
||||
}
|
||||
|
||||
/** FTP task — runs handleFTP() in a dedicated loop on core 0 */
|
||||
/** FTP task — runs handleFTP() in a dedicated loop on core 1
|
||||
* NOTE: Must run on core 1 (not core 0) because WiFi runs on core 0
|
||||
* and handleFTP() needs WiFi sockets to work. Running on core 0 at
|
||||
* higher priority starves WiFi, preventing welcome banner from sending.
|
||||
*/
|
||||
static void ftpTask(void *param) {
|
||||
(void)param;
|
||||
for (;;) {
|
||||
ftpSrv.handleFTP();
|
||||
vTaskDelay(pdMS_TO_TICKS(1)); // yield ~1 ms between iterations
|
||||
vTaskDelay(pdMS_TO_TICKS(2)); // yield 2ms to let LVGL run
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,8 +471,9 @@ static void initFtp() {
|
||||
ftpSrv.setLocalIp(WiFi.localIP());
|
||||
ftpSrv.begin("kode", "kode");
|
||||
|
||||
/* Run FTP in its own task on core 0 so it never blocks LVGL on core 1 */
|
||||
xTaskCreatePinnedToCore(ftpTask, "ftp", 32768, NULL, 2, NULL, 0);
|
||||
/* Run FTP in its own task on core 1 (same as Arduino) — core 0 is
|
||||
reserved for WiFi/networking stack, running FTP there starves it */
|
||||
xTaskCreatePinnedToCore(ftpTask, "ftp", 32768, NULL, 2, NULL, 1);
|
||||
|
||||
Serial.printf("[FTP] FTP server ready on core 0 (PASV IP: %s, data port: 50009)\n",
|
||||
WiFi.localIP().toString().c_str());
|
||||
|
||||
Reference in New Issue
Block a user