Browse Source

Optimize SpoolBuddy kiosk performance on Raspberry Pi

  Chromium: override Debian defaults via /etc/chromium.d/spoolbuddy-kiosk
  to disable GPU rasterization, enable low-end device mode, and disable
  smooth scrolling/background networking. The system default
  --enable-gpu-rasterization conflicted with per-launch flags.

  WebSocket: add React Query `select` to SpoolBuddyLayout and
  SpoolBuddyDashboard printer status queries so only `connected` is
  extracted. Temperature/fan/progress changes no longer trigger
  re-renders on every MQTT tick (~10/sec idle).

  Services: expand install script to strip pipewire, CUPS, rpcbind,
  upower, polkit, accounts-daemon, xdg-desktop-portal, mpris-proxy.
  Add user-level service masking for pipewire/portals.
maziggy 5 months ago
parent
commit
f9ae9f83cc

+ 1 - 1
CHANGELOG.md

@@ -12,7 +12,7 @@ All notable changes to Bambuddy will be documented in this file.
 - **External Folder Mounting for File Manager** ([#124](https://github.com/maziggy/bambuddy/issues/124)) — Host directories (NAS shares, USB drives, network storage) can now be mounted into the File Manager without copying files. Click "Link External" to point at a Docker bind-mounted path. Files are indexed into the database on scan but accessed directly from their original location — nothing is copied. Supports read-only mode (default, blocks uploads/moves/deletes), hidden file filtering, and automatic thumbnail extraction for 3MF, STL, gcode, and image files. External folders show a distinct icon and info bar with a rescan button. Deleting an external folder only removes the database index, never the actual files. Requested by @S1N4X.
 
 ### Improved
-- **SpoolBuddy Kiosk Performance Optimizations** — Reduced CPU load on Raspberry Pi by overriding Debian's default Chromium flags via `/etc/chromium.d/spoolbuddy-kiosk`. Disables GPU rasterization (which falls back to CPU on Pi's VideoCore VI), enables low-end device mode (caps memory/reduces background work on ≤2GB Pis), and disables smooth scrolling and background networking. The system default `--enable-gpu-rasterization` was conflicting with per-launch flags — the new config file replaces all system defaults so kiosk flags take effect cleanly. Also expanded the install script's service/package stripping to disable pipewire audio stack, CUPS printing, rpcbind, upower, polkit, accounts-daemon, xdg-desktop-portal, and mpris-proxy — none needed on a dedicated spool reader. User-level services (pipewire, portals) are now masked via `systemctl --user` since system-level disable doesn't catch them.
+- **SpoolBuddy Kiosk Performance Optimizations** — Reduced CPU load on Raspberry Pi. Chromium: overrides Debian's default flags via `/etc/chromium.d/spoolbuddy-kiosk` to disable GPU rasterization (falls back to CPU on Pi's VideoCore VI), enable low-end device mode (caps memory on ≤2GB Pis), and disable smooth scrolling and background networking. The system default `--enable-gpu-rasterization` was conflicting with per-launch flags — the new config replaces all system defaults. WebSocket: SpoolBuddy Dashboard and Layout pages now use React Query `select` to extract only `connected` status from printer queries, so temperature/fan/progress updates no longer trigger re-renders on every MQTT tick. Services: expanded install script stripping to disable pipewire audio stack, CUPS printing, rpcbind, upower, polkit, accounts-daemon, xdg-desktop-portal, and mpris-proxy. User-level services are masked via `systemctl --user`.
 - **SpoolBuddy AMS Slot Action Picker** — Clicking an AMS slot on the SpoolBuddy AMS page now shows a picker with contextual actions: Configure AMS Slot (set filament preset, K-profile, color), and either Assign Spool / Link to Spoolman (when no spool is mapped) or Unassign / Unlink (when one is). Works with both internal inventory and Spoolman. Previously the slot click went straight to the configure modal with no way to manage spool assignments.
 - **Unassign Button in Edit Spool Modal** — The edit spool modal now has an "Unassign" button next to "Delete Tag" that removes the spool's AMS slot assignment, clearing the location column in the inventory table.
 - **SpoolBuddy Settings Device Tab No Longer Scrolls** — Removed the branding card, folded Device ID into the Device Info card, placed Backend/Auth config and diagnostic buttons side by side in a 2-column layout, removed the redundant online/offline status row from Device Info, and tightened spacing throughout. The Device tab now fits on the small SpoolBuddy touchscreen without scrolling.

+ 2 - 1
frontend/src/components/spoolbuddy/SpoolBuddyLayout.tsx

@@ -6,7 +6,7 @@ import { SpoolBuddyTopBar } from './SpoolBuddyTopBar';
 import { SpoolBuddyBottomNav } from './SpoolBuddyBottomNav';
 import { SpoolBuddyStatusBar } from './SpoolBuddyStatusBar';
 import { useSpoolBuddyState } from '../../hooks/useSpoolBuddyState';
-import { api, spoolbuddyApi, type Printer } from '../../api/client';
+import { api, spoolbuddyApi, type Printer, type PrinterStatus } from '../../api/client';
 import { VirtualKeyboard } from '../VirtualKeyboard';
 
 export function SpoolBuddyLayout() {
@@ -134,6 +134,7 @@ export function SpoolBuddyLayout() {
       queryKey: ['printerStatus', printer.id],
       queryFn: () => api.getPrinterStatus(printer.id),
       refetchInterval: 10000,
+      select: (data: PrinterStatus) => ({ connected: data?.connected }),
     })),
   });
   const onlinePrinters = useMemo(() => {

+ 2 - 1
frontend/src/pages/spoolbuddy/SpoolBuddyDashboard.tsx

@@ -3,7 +3,7 @@ import { useOutletContext } from 'react-router-dom';
 import { useQuery, useQueries } from '@tanstack/react-query';
 import { useTranslation } from 'react-i18next';
 import type { SpoolBuddyOutletContext } from '../../components/spoolbuddy/SpoolBuddyLayout';
-import { api, type InventorySpool, type Printer } from '../../api/client';
+import { api, type InventorySpool, type Printer, type PrinterStatus } from '../../api/client';
 import { SpoolIcon } from '../../components/spoolbuddy/SpoolIcon';
 import { SpoolInfoCard, UnknownTagCard } from '../../components/spoolbuddy/SpoolInfoCard';
 import { AssignToAmsModal } from '../../components/spoolbuddy/AssignToAmsModal';
@@ -141,6 +141,7 @@ export function SpoolBuddyDashboard() {
       queryKey: ['printerStatus', printer.id],
       queryFn: () => api.getPrinterStatus(printer.id),
       refetchInterval: 10000,
+      select: (data: PrinterStatus) => ({ connected: data?.connected }),
     })),
   });
 

File diff suppressed because it is too large
+ 0 - 0
static/assets/index-zs_wImoT.js


+ 1 - 1
static/index.html

@@ -23,7 +23,7 @@
 
     <!-- Splash screens for iOS -->
     <link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
-    <script type="module" crossorigin src="/assets/index-Bqi5VOJF.js"></script>
+    <script type="module" crossorigin src="/assets/index-zs_wImoT.js"></script>
     <link rel="stylesheet" crossorigin href="/assets/index-DWwO6mIe.css">
   </head>
   <body>

Some files were not shown because too many files changed in this diff