mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-18 21:47:39 +02:00
● Add prefer lowest remaining filament in auto-matching (#805)
When multiple AMS spools match the same type/color criteria, an optional setting now prefers the spool with the lowest remaining filament. This helps consume partial spools before starting new ones. Sorting applies to all matching paths: queue scheduler, print modal, and multi-printer mapping. Unknown remain values (-1) sort to end.
This commit is contained in:
@@ -107,7 +107,8 @@ function InlineMappingEditor({
|
||||
isManual = true;
|
||||
} else {
|
||||
const usedTrayIds = new Set<number>(Object.values(printerResult.config.manualMappings));
|
||||
loaded = autoMatchFilament(req, printerResult.loadedFilaments, usedTrayIds) as LoadedFilament | undefined;
|
||||
const cachedSettings = queryClient.getQueryData<{ prefer_lowest_filament?: boolean }>(['settings']);
|
||||
loaded = autoMatchFilament(req, printerResult.loadedFilaments, usedTrayIds, cachedSettings?.prefer_lowest_filament) as LoadedFilament | undefined;
|
||||
}
|
||||
|
||||
// Determine status
|
||||
|
||||
@@ -324,7 +324,7 @@ export function PrintModal({
|
||||
});
|
||||
|
||||
// Get AMS mapping from hook (only when single printer selected)
|
||||
const { amsMapping } = useFilamentMapping(effectiveFilamentReqs, printerStatus, manualMappings);
|
||||
const { amsMapping } = useFilamentMapping(effectiveFilamentReqs, printerStatus, manualMappings, settings?.prefer_lowest_filament);
|
||||
|
||||
// Multi-printer filament mapping (for per-printer configuration)
|
||||
const multiPrinterMapping = useMultiPrinterFilamentMapping(
|
||||
@@ -333,7 +333,8 @@ export function PrintModal({
|
||||
effectiveFilamentReqs,
|
||||
manualMappings,
|
||||
perPrinterConfigs,
|
||||
setPerPrinterConfigs
|
||||
setPerPrinterConfigs,
|
||||
settings?.prefer_lowest_filament,
|
||||
);
|
||||
|
||||
// Auto-select first plate when plates load (single or multi-plate)
|
||||
|
||||
Reference in New Issue
Block a user