diff --git a/backend/app/services/bambu_ftp.py b/backend/app/services/bambu_ftp.py index 0fe81a247..163655a67 100644 --- a/backend/app/services/bambu_ftp.py +++ b/backend/app/services/bambu_ftp.py @@ -241,13 +241,20 @@ class BambuFTPClient: # Try AVBL command (available space) - some FTP servers support this try: response = self._ftp.sendcmd("AVBL") + logger.debug(f"AVBL response: {response}") # Response format: "213 " if response.startswith("213"): parts = response.split() if len(parts) >= 2: result["free_bytes"] = int(parts[1]) - except Exception: - pass + except Exception as e: + logger.debug(f"AVBL command not supported: {e}") + # Try STAT command as fallback + try: + response = self._ftp.sendcmd("STAT") + logger.debug(f"STAT response: {response}") + except Exception: + pass # Calculate used space by listing root directories try: diff --git a/backend/app/services/bambu_mqtt.py b/backend/app/services/bambu_mqtt.py index b62da6814..767dd898e 100644 --- a/backend/app/services/bambu_mqtt.py +++ b/backend/app/services/bambu_mqtt.py @@ -347,6 +347,17 @@ class BambuMQTTClient: logger.info(f"[{self.serial_number}] Received system data: {system_data}") self._handle_system_response(system_data) + # Parse WiFi signal at top level (some printers send it here) + if "wifi_signal" in payload: + wifi_signal = payload["wifi_signal"] + if isinstance(wifi_signal, (int, float)): + self.state.wifi_signal = int(wifi_signal) + elif isinstance(wifi_signal, str): + try: + self.state.wifi_signal = int(wifi_signal.replace("dBm", "").strip()) + except ValueError: + pass + if "print" in payload: print_data = payload["print"] @@ -1220,8 +1231,8 @@ class BambuMQTTClient: # Parse WiFi signal strength (dBm) if "wifi_signal" in data: wifi_signal = data["wifi_signal"] + logger.info(f"[{self.serial_number}] wifi_signal received: {wifi_signal}") if isinstance(wifi_signal, (int, float)): - # Convert string dBm to int (e.g., "-52dBm" -> -52) self.state.wifi_signal = int(wifi_signal) elif isinstance(wifi_signal, str): # Handle string format like "-52dBm" diff --git a/backend/app/services/printer_manager.py b/backend/app/services/printer_manager.py index c0d344709..be03b603c 100644 --- a/backend/app/services/printer_manager.py +++ b/backend/app/services/printer_manager.py @@ -287,6 +287,8 @@ def printer_state_to_dict(state: PrinterState, printer_id: int | None = None) -> "ams_status_main": state.ams_status_main, "ams_status_sub": state.ams_status_sub, "tray_now": state.tray_now, + # WiFi signal strength + "wifi_signal": state.wifi_signal, } # Add cover URL if there's an active print and printer_id is provided if printer_id and state.state == "RUNNING" and state.gcode_file: diff --git a/frontend/src/components/FileManagerModal.tsx b/frontend/src/components/FileManagerModal.tsx index 95e6b3081..0d6c89e8e 100644 --- a/frontend/src/components/FileManagerModal.tsx +++ b/frontend/src/components/FileManagerModal.tsx @@ -155,9 +155,17 @@ export function FileManagerModal({ printerId, printerName, onClose }: FileManage
{/* Storage info */} - {storageData?.used_bytes != null && storageData.used_bytes > 0 && ( -
- Used: {formatStorageSize(storageData.used_bytes)} + {storageData && (storageData.used_bytes != null || storageData.free_bytes != null) && ( +
+ {storageData.used_bytes != null && ( + Used: {formatStorageSize(storageData.used_bytes)} + )} + {storageData.used_bytes != null && storageData.free_bytes != null && ( + | + )} + {storageData.free_bytes != null && ( + Free: {formatStorageSize(storageData.free_bytes)} + )}
)}
+ {/* Connection status badge */} + {/* WiFi signal strength indicator */} + {status?.connected && wifiSignal != null && ( + = -50 + ? 'bg-bambu-green/20 text-bambu-green' + : wifiSignal >= -60 + ? 'bg-bambu-green/20 text-bambu-green' + : wifiSignal >= -70 + ? 'bg-amber-500/20 text-amber-600' + : wifiSignal >= -80 + ? 'bg-orange-500/20 text-orange-600' + : 'bg-red-500/20 text-red-600' + }`} + title={`WiFi: ${wifiSignal} dBm - ${getWifiStrength(wifiSignal).label}`} + > + + {wifiSignal}dBm + + )} {/* HMS Status Indicator */} {status?.connected && (