diff --git a/src/main.cpp b/src/main.cpp index 78cfe1e..1e1c4e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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());