|
|
@@ -19,7 +19,7 @@ from backend.app.schemas.printer import DiagnosticCheck, PrinterDiagnosticResult
|
|
|
from backend.app.services.camera import get_camera_port
|
|
|
from backend.app.services.discovery import is_running_in_docker
|
|
|
from backend.app.services.printer_manager import printer_manager
|
|
|
-from backend.app.utils.printer_models import has_external_storage
|
|
|
+from backend.app.utils.printer_models import has_external_storage, has_remote_storage_toggle
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@@ -204,13 +204,33 @@ async def run_connection_diagnostic(
|
|
|
# and A1 Mini). They never set home_flag bit 11, so a naive read of
|
|
|
# `store_to_sdcard` would fall through to a false `fail` for every
|
|
|
# A1-series user (#1703).
|
|
|
+ #
|
|
|
+ # Some models (P1-series) DO have a slot but no reachable control to turn
|
|
|
+ # the option on: the Bambu Studio toggle only appears when the printer
|
|
|
+ # publishes `support_save_remote_print_file_to_storage`, which current
|
|
|
+ # P1 firmware never does, and the P1S/P1P have no screen. For those,
|
|
|
+ # `store_to_sdcard` is stuck False with no way to fix it — report `skip`
|
|
|
+ # (with a reason the UI explains) instead of a permanently-red `fail`
|
|
|
+ # (#2524).
|
|
|
state = printer_manager.get_status(printer.id) if printer else None
|
|
|
- model_has_slot = has_external_storage(getattr(printer, "model", None)) if printer else True
|
|
|
+ model = getattr(printer, "model", None) if printer else None
|
|
|
+ model_has_slot = has_external_storage(model) if printer else True
|
|
|
+ store_to_sdcard = getattr(state, "store_to_sdcard", None) if state else None
|
|
|
if not model_has_slot or state is None or not state.connected:
|
|
|
checks.append(DiagnosticCheck(id="external_storage", status="skip"))
|
|
|
- elif getattr(state, "store_to_sdcard", None) is True:
|
|
|
+ elif store_to_sdcard is True:
|
|
|
checks.append(DiagnosticCheck(id="external_storage", status="pass"))
|
|
|
- elif getattr(state, "store_to_sdcard", None) is False:
|
|
|
+ elif store_to_sdcard is False and not has_remote_storage_toggle(model):
|
|
|
+ # Slot present but no way to enable it on this firmware — don't nag
|
|
|
+ # with an unresolvable fail; explain why via the reason param.
|
|
|
+ checks.append(
|
|
|
+ DiagnosticCheck(
|
|
|
+ id="external_storage",
|
|
|
+ status="skip",
|
|
|
+ params={"reason": "unsupported_model"},
|
|
|
+ )
|
|
|
+ )
|
|
|
+ elif store_to_sdcard is False:
|
|
|
checks.append(DiagnosticCheck(id="external_storage", status="fail"))
|
|
|
else:
|
|
|
# State exists but the field was never populated — skip rather than
|