v0.1.36: Add dark theme, fix BLE scanning, improve responsive design\n\n- Fixed BLE scanning RSSI error that caused 'BLEDevice' object has no attribute 'rssi'\n- Implemented complete dark theme with CSS variables and system preference support\n- Added responsive design with mobile-first breakpoints (768px, 1024px, 1440px)\n- Added theme toggle with local storage persistence\n- Improved BLE error handling and user guidance\n- Enhanced pairing function documentation to clarify BLE vs Classic Bluetooth\n- Updated version to 0.1.36 in config.yaml and api.py\n\nGenerated by Mistral Vibe.\nCo-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -79,7 +79,7 @@ async def lifespan(app: FastAPI): # noqa: ARG001
|
||||
app = FastAPI(
|
||||
title="Fichero Printer API",
|
||||
description="REST API for the Fichero D11s (AiYin) thermal label printer.",
|
||||
version = "0.1.35",
|
||||
version = "0.1.36",
|
||||
lifespan=lifespan,
|
||||
docs_url=None,
|
||||
redoc_url=None,
|
||||
@@ -179,7 +179,15 @@ def _ui_html() -> str:
|
||||
devices.forEach((d, index) => {
|
||||
resultText += `${index + 1}. ${d.name || 'Unknown Device'}\n`;
|
||||
resultText += ` Address: ${d.address}\n`;
|
||||
resultText += ` Signal: ${d.rssi} dBm (${Math.abs(d.rssi) < 60 ? 'Strong' : Math.abs(d.rssi) < 80 ? 'Good' : 'Weak'})\n`;
|
||||
// Handle case where RSSI might not be available
|
||||
if (d.rssi !== undefined) {
|
||||
resultText += ` Signal: ${d.rssi} dBm (${Math.abs(d.rssi) < 60 ? 'Strong' : Math.abs(d.rssi) < 80 ? 'Good' : 'Weak'})\n`;
|
||||
} else {
|
||||
resultText += ` Signal: Not available\n`;
|
||||
}
|
||||
if (d.metadata) {
|
||||
resultText += ` Metadata: ${d.metadata}\n`;
|
||||
}
|
||||
resultText += ` ${'='.repeat(40)}\n`;
|
||||
});
|
||||
resultText += '\n💡 Tip: Click on a device address above to use it for connection.';
|
||||
@@ -334,10 +342,19 @@ async def scan_devices():
|
||||
"""Scan for nearby BLE devices for 10 seconds for debugging."""
|
||||
try:
|
||||
devices = await BleakScanner.discover(timeout=10.0)
|
||||
return [
|
||||
{"address": d.address, "name": d.name or "N/A", "rssi": d.rssi}
|
||||
for d in devices
|
||||
]
|
||||
result = []
|
||||
for d in devices:
|
||||
device_info = {
|
||||
"address": d.address,
|
||||
"name": d.name or "N/A"
|
||||
}
|
||||
# RSSI may not be available on all platforms/versions
|
||||
if hasattr(d, 'rssi'):
|
||||
device_info["rssi"] = d.rssi
|
||||
if hasattr(d, 'metadata'):
|
||||
device_info["metadata"] = str(d.metadata)
|
||||
result.append(device_info)
|
||||
return result
|
||||
except Exception as exc:
|
||||
# This provides more debug info to the user if scanning fails
|
||||
raise HTTPException(
|
||||
|
||||
Reference in New Issue
Block a user