fix: FTP passive mode, battery UI position, SD path traversal

- Add ftpSrv.setLocalIp() for correct PASV response IP (fixes transfers)
- Move battery indicator to WiFi SSID line, right-aligned
- Fix battery label tilt: fixed width + LV_TEXT_ALIGN_RIGHT
- Fix calcDirSize: use f.path() for full path in recursive walk
This commit is contained in:
Lago
2026-04-03 21:30:05 +02:00
parent a328f5ae97
commit 5290f8b4f0
2 changed files with 38 additions and 29 deletions
+7 -3
View File
@@ -108,9 +108,10 @@ static uint64_t calcDirSize(fs::FS &fs, const char *dirname) {
File f;
while ((f = root.openNextFile())) {
if (f.isDirectory()) {
String path = f.name();
/* On ESP32 Arduino 3.x, f.path() returns the full path */
String fullPath = String(f.path());
f.close();
total += calcDirSize(fs, path.c_str());
total += calcDirSize(fs, fullPath.c_str());
} else {
total += f.size();
f.close();
@@ -442,8 +443,11 @@ static void initFtp() {
Serial.println("[FTP] Starting FTP server (user: kode, port: 21)...");
ftpSrv.setCallback(ftpCallback);
ftpSrv.setTransferCallback(ftpTransferCallback);
/* Set local IP so PASV mode sends the correct address to clients */
ftpSrv.setLocalIp(WiFi.localIP());
ftpSrv.begin("kode", "kode");
Serial.println("[FTP] FTP server ready");
Serial.printf("[FTP] FTP server ready (PASV IP: %s, data port: 50009)\n",
WiFi.localIP().toString().c_str());
ui_set_ftp("Idle");
}