mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-22 03:49:18 +02:00
fix(inventory): PA-Profil picker fetches K-profiles across all installed nozzles (#2618)
The Edit Spool "PA-Profil" tab and the SpoolBuddy write-tag page fetched a
printer's calibrations with getKProfiles(printer.id), which defaults the nozzle
filter to 0.4. The printer/MQTT layer filters strictly by that diameter, so on
a multi-nozzle printer a same-filament 0.6mm K-profile was never retrieved and
the picker showed only the 0.4mm entry ("1 match"). (The AMS-Slot config dialog
was already fixed in #1899; these two pickers were not.)
Add installedNozzleDiameters(status) and a shared fetchPrinterCalibrations()
that queries every reported nozzle diameter and merges the results, falling
back to 0.4 when the printer hasn't reported nozzle hardware. Each profile row
now shows a nozzle-diameter badge so identically-named profiles are distinct.
This commit is contained in:
@@ -8,7 +8,7 @@ import { Button } from './Button';
|
||||
import { useToast } from '../contexts/ToastContext';
|
||||
import type { SpoolFormData, PrinterWithCalibrations, ColorPreset } from './spool-form/types';
|
||||
import { defaultFormData, validateForm, SPOOLMAN_LINKED_FIELDS } from './spool-form/types';
|
||||
import { buildFilamentOptions, extractBrandsFromPresets, findPresetOption, loadRecentColors, parsePresetName, saveRecentColor } from './spool-form/utils';
|
||||
import { buildFilamentOptions, extractBrandsFromPresets, fetchPrinterCalibrations, findPresetOption, loadRecentColors, parsePresetName, saveRecentColor } from './spool-form/utils';
|
||||
import { MATERIALS } from './spool-form/constants';
|
||||
import { FilamentSection } from './spool-form/FilamentSection';
|
||||
import { ColorSection } from './spool-form/ColorSection';
|
||||
@@ -201,21 +201,9 @@ export function SpoolFormModal({
|
||||
const connected = status?.connected ?? false;
|
||||
let calibrations: PrinterWithCalibrations['calibrations'] = [];
|
||||
if (connected) {
|
||||
try {
|
||||
const kRes = await api.getKProfiles(printer.id);
|
||||
calibrations = kRes.profiles.map(p => ({
|
||||
cali_idx: p.slot_id,
|
||||
filament_id: p.filament_id,
|
||||
setting_id: p.setting_id || '',
|
||||
name: p.name,
|
||||
k_value: parseFloat(p.k_value) || 0,
|
||||
n_coef: parseFloat(p.n_coef) || 0,
|
||||
extruder_id: p.extruder_id,
|
||||
nozzle_diameter: p.nozzle_diameter,
|
||||
}));
|
||||
} catch {
|
||||
// Printer may not support K-profiles
|
||||
}
|
||||
// Fetch across every installed nozzle so dual-nozzle printers
|
||||
// surface both the 0.4mm and 0.6mm K-profiles, not just 0.4 (#2618).
|
||||
calibrations = await fetchPrinterCalibrations(printer.id, status);
|
||||
}
|
||||
results.push({ printer: { ...printer, connected }, calibrations });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user