bambu-printer-mcp 1.1.41 → 1.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTORS.md +1 -0
- package/dist/safety/print-file.js +62 -4
- package/package.json +1 -1
- package/src/safety/print-file.ts +55 -3
package/CONTRIBUTORS.md
CHANGED
|
@@ -6,6 +6,7 @@ Thank you to everyone who builds, tests, reports problems, and shares real print
|
|
|
6
6
|
|
|
7
7
|
| Contributor | Contribution |
|
|
8
8
|
| --- | --- |
|
|
9
|
+
| [Steve Pritchard (sjpritchard)](https://github.com/sjpritchard) | Reports and diagnoses H2C per-variant first-layer temperature rejection in [#81](https://github.com/DMontgomery40/bambu-printer-mcp/issues/81), supplies the exact official preset metadata and reproduction, and identifies the upstream variant-mapping contract. Verification uses synthetic slicing and offline regressions, not physical printing. |
|
|
9
10
|
| [JackCA](https://github.com/JackCA) | Reports an X2D retaining `FAILED` with no active print/HMS error after cancellation, supplies read-only printer evidence for `fail_reason: 0300400C`, and contributes narrow canceled-task recovery, job-bound physical confirmation, a recheck of the job and error codes after connecting and before clearing hardware errors on any model, and regression coverage in [#76](https://github.com/DMontgomery40/bambu-printer-mcp/pull/76). Physical print delivery after the fix remains unverified. |
|
|
10
11
|
| [ZombieLurker](https://github.com/ZombieLurker) | Reports and diagnoses the unused-nozzle preheat rejection for OrcaSlicer 2.4.2 single-filament H2D jobs in [#73](https://github.com/DMontgomery40/bambu-printer-mcp/issues/73), supplies the exact startup commands and environment, and verifies a local inspection fix. H2D Pro coverage is independently supported by its official profile; no physical printing is claimed by this release. |
|
|
11
12
|
| [MorganFreeeman](https://github.com/MorganFreeeman) | Reports in [#67](https://github.com/DMontgomery40/bambu-printer-mcp/issues/67) that every H2D print stopped on stock HS01 nozzles. Supplies idle and mid-print firmware 01.04.00.00 nozzle reports showing a permanent `stat: 1` with `sn: "N/A"`, proposes keeping the check narrow to nozzles without an identity chip, and points out the misleading declined-confirmation advice and the missing settings-table entries. Maintainer validation uses their reports in regressions; no H2D hardware was available. |
|
|
@@ -35,6 +35,67 @@ function consistent(values, convert, field) {
|
|
|
35
35
|
return fail(`contradictory ${field} metadata`);
|
|
36
36
|
return converted[0];
|
|
37
37
|
}
|
|
38
|
+
/** Bambu Studio keeps filament options per variant in the project, but writes
|
|
39
|
+
* one selected row per filament in the plate header (Print::full_print_config).
|
|
40
|
+
* Match the declared 1-based self index and variant, never truncate the table
|
|
41
|
+
* or borrow the slicer's row-zero fallback for a missing selection.
|
|
42
|
+
*/
|
|
43
|
+
function firstLayerTemperatures(project, headers, count) {
|
|
44
|
+
const key = 'nozzle_temperature_initial_layer';
|
|
45
|
+
const field = 'first-layer nozzle temperature';
|
|
46
|
+
const temperatures = (value) => {
|
|
47
|
+
const entries = list(value);
|
|
48
|
+
return entries.length && entries.every(v => NUMBER.test(v) && Number.isFinite(Number(v))) ? entries.map(Number) : undefined;
|
|
49
|
+
};
|
|
50
|
+
const perFilament = (value) => {
|
|
51
|
+
const values = temperatures(value);
|
|
52
|
+
return values?.length === count ? values : undefined;
|
|
53
|
+
};
|
|
54
|
+
const selectedValues = metadataValues(headers, [key]);
|
|
55
|
+
if (project[key] === undefined)
|
|
56
|
+
return consistent(selectedValues, perFilament, field);
|
|
57
|
+
if (project.filament_extruder_variant === undefined && project.filament_self_index === undefined)
|
|
58
|
+
return consistent([project[key], ...selectedValues], perFilament, field);
|
|
59
|
+
const table = temperatures(project[key]);
|
|
60
|
+
const variants = list(project.filament_extruder_variant);
|
|
61
|
+
const ids = list(project.filament_self_index);
|
|
62
|
+
const validVariant = (value) => /^(Direct Drive|Bowden) (Standard|High Flow|Hybrid|TPU High Flow|E3D High Flow)$/.test(value);
|
|
63
|
+
if (!table || variants.length !== table.length || ids.length !== table.length ||
|
|
64
|
+
variants.some(v => !validVariant(v)) || ids.some(id => !/^[1-9]\d*$/.test(id) || Number(id) > count))
|
|
65
|
+
return fail(`unknown or malformed ${field} variant table`);
|
|
66
|
+
const selectedVariants = consistent(metadataValues(headers, ['filament_extruder_variant']), value => {
|
|
67
|
+
const values = list(value);
|
|
68
|
+
return values.length === count && values.every(validVariant) ? values : undefined;
|
|
69
|
+
}, 'selected filament extruder variant');
|
|
70
|
+
const selectedIds = consistent(metadataValues(headers, ['filament_self_index']), value => {
|
|
71
|
+
const values = list(value);
|
|
72
|
+
return values.length === count && values.every((id, index) => id === String(index + 1)) ? values : undefined;
|
|
73
|
+
}, 'selected filament self index');
|
|
74
|
+
// These are logical extruders: physical_extruder_map is used for spool
|
|
75
|
+
// routing, not this variant lookup. Hybrid selects the Standard variant.
|
|
76
|
+
const mappingKeys = ['filament_map', 'extruder_type', 'filament_volume_map'];
|
|
77
|
+
if (mappingKeys.every(key => metadataValues(headers, [key]).length)) {
|
|
78
|
+
const selection = (key) => consistent(metadataValues(headers, [key]), value => {
|
|
79
|
+
const entries = list(value);
|
|
80
|
+
return entries.length ? entries : undefined;
|
|
81
|
+
}, `selected ${key.replace(/_/g, ' ')}`);
|
|
82
|
+
const map = selection('filament_map');
|
|
83
|
+
const types = selection('extruder_type');
|
|
84
|
+
const volumes = selection('filament_volume_map');
|
|
85
|
+
const flows = { '0': 'Standard', '1': 'High Flow', '2': 'Standard', '3': 'TPU High Flow', '5': 'E3D High Flow' };
|
|
86
|
+
if (map.length !== count || volumes.length !== count || map.some(id => !/^[1-9]\d*$/.test(id) || Number(id) > types.length) ||
|
|
87
|
+
volumes.some(v => !Object.prototype.hasOwnProperty.call(flows, v)) || types.some(v => !['Direct Drive', 'Bowden'].includes(v)) ||
|
|
88
|
+
selectedVariants.some((variant, i) => variant !== `${types[Number(map[i]) - 1]} ${flows[volumes[i]]}`))
|
|
89
|
+
return fail('contradictory selected filament extruder variant mapping');
|
|
90
|
+
}
|
|
91
|
+
const resolved = selectedIds.map((id, index) => {
|
|
92
|
+
const rows = ids.flatMap((candidate, row) => candidate === id && variants[row] === selectedVariants[index] ? [row] : []);
|
|
93
|
+
if (rows.length !== 1)
|
|
94
|
+
return fail(`ambiguous or missing ${field} variant for filament ${id}`);
|
|
95
|
+
return table[rows[0]];
|
|
96
|
+
});
|
|
97
|
+
return consistent([resolved, ...selectedValues], perFilament, field);
|
|
98
|
+
}
|
|
38
99
|
function stripComments(line) {
|
|
39
100
|
let clean = '';
|
|
40
101
|
let depth = 0;
|
|
@@ -480,10 +541,7 @@ export async function inspectPrintFile(filePath, options) {
|
|
|
480
541
|
// editable maxima or an unchecked offset as thermal evidence.
|
|
481
542
|
if (code !== 'M104' || !h2cStartup(index) || args.size !== 2 || args.get('O') !== -80 || !Number.isNaN(args.get('A')))
|
|
482
543
|
fail('unsupported H2C startup offset parameters');
|
|
483
|
-
const targets =
|
|
484
|
-
const values = list(value);
|
|
485
|
-
return values.length === materials.length && values.every(v => NUMBER.test(v) && Number.isFinite(Number(v))) ? values.map(Number) : undefined;
|
|
486
|
-
}, 'first-layer nozzle temperature');
|
|
544
|
+
const targets = firstLayerTemperatures(project, headers, materials.length);
|
|
487
545
|
for (let position = 0; position < targets.length; position++) {
|
|
488
546
|
validateTemperature('nozzle', targets[position], model, [materials[position]]);
|
|
489
547
|
const preheat = Math.max(0, targets[position] - 80);
|
package/package.json
CHANGED
package/src/safety/print-file.ts
CHANGED
|
@@ -45,6 +45,60 @@ function consistent<T>(values: unknown[], convert: (v: unknown)=>T|undefined, fi
|
|
|
45
45
|
if (converted.some(value=>JSON.stringify(value)!==JSON.stringify(converted[0]))) return fail(`contradictory ${field} metadata`);
|
|
46
46
|
return converted[0]!;
|
|
47
47
|
}
|
|
48
|
+
/** Bambu Studio keeps filament options per variant in the project, but writes
|
|
49
|
+
* one selected row per filament in the plate header (Print::full_print_config).
|
|
50
|
+
* Match the declared 1-based self index and variant, never truncate the table
|
|
51
|
+
* or borrow the slicer's row-zero fallback for a missing selection.
|
|
52
|
+
*/
|
|
53
|
+
function firstLayerTemperatures(project:Metadata, headers:Metadata[], count:number):number[] {
|
|
54
|
+
const key='nozzle_temperature_initial_layer';
|
|
55
|
+
const field='first-layer nozzle temperature';
|
|
56
|
+
const temperatures=(value:unknown):number[]|undefined=>{
|
|
57
|
+
const entries=list(value);
|
|
58
|
+
return entries.length && entries.every(v=>NUMBER.test(v) && Number.isFinite(Number(v)))?entries.map(Number):undefined;
|
|
59
|
+
};
|
|
60
|
+
const perFilament=(value:unknown)=>{
|
|
61
|
+
const values=temperatures(value);return values?.length===count?values:undefined;
|
|
62
|
+
};
|
|
63
|
+
const selectedValues=metadataValues(headers,[key]);
|
|
64
|
+
if(project[key]===undefined) return consistent(selectedValues,perFilament,field);
|
|
65
|
+
if(project.filament_extruder_variant===undefined && project.filament_self_index===undefined)
|
|
66
|
+
return consistent([project[key],...selectedValues],perFilament,field);
|
|
67
|
+
|
|
68
|
+
const table=temperatures(project[key]);
|
|
69
|
+
const variants=list(project.filament_extruder_variant);
|
|
70
|
+
const ids=list(project.filament_self_index);
|
|
71
|
+
const validVariant=(value:string)=>/^(Direct Drive|Bowden) (Standard|High Flow|Hybrid|TPU High Flow|E3D High Flow)$/.test(value);
|
|
72
|
+
if(!table || variants.length!==table.length || ids.length!==table.length ||
|
|
73
|
+
variants.some(v=>!validVariant(v)) || ids.some(id=>!/^[1-9]\d*$/.test(id) || Number(id)>count))
|
|
74
|
+
return fail(`unknown or malformed ${field} variant table`);
|
|
75
|
+
const selectedVariants=consistent(metadataValues(headers,['filament_extruder_variant']),value=>{
|
|
76
|
+
const values=list(value);return values.length===count && values.every(validVariant)?values:undefined;
|
|
77
|
+
},'selected filament extruder variant');
|
|
78
|
+
const selectedIds=consistent(metadataValues(headers,['filament_self_index']),value=>{
|
|
79
|
+
const values=list(value);return values.length===count && values.every((id,index)=>id===String(index+1))?values:undefined;
|
|
80
|
+
},'selected filament self index');
|
|
81
|
+
// These are logical extruders: physical_extruder_map is used for spool
|
|
82
|
+
// routing, not this variant lookup. Hybrid selects the Standard variant.
|
|
83
|
+
const mappingKeys=['filament_map','extruder_type','filament_volume_map'];
|
|
84
|
+
if(mappingKeys.every(key=>metadataValues(headers,[key]).length)) {
|
|
85
|
+
const selection=(key:string)=>consistent(metadataValues(headers,[key]),value=>{
|
|
86
|
+
const entries=list(value);return entries.length?entries:undefined;
|
|
87
|
+
},`selected ${key.replace(/_/g,' ')}`);
|
|
88
|
+
const map=selection('filament_map');const types=selection('extruder_type');const volumes=selection('filament_volume_map');
|
|
89
|
+
const flows:Record<string,string>={'0':'Standard','1':'High Flow','2':'Standard','3':'TPU High Flow','5':'E3D High Flow'};
|
|
90
|
+
if(map.length!==count || volumes.length!==count || map.some(id=>!/^[1-9]\d*$/.test(id) || Number(id)>types.length) ||
|
|
91
|
+
volumes.some(v=>!Object.prototype.hasOwnProperty.call(flows,v)) || types.some(v=>!['Direct Drive','Bowden'].includes(v)) ||
|
|
92
|
+
selectedVariants.some((variant,i)=>variant!==`${types[Number(map[i])-1]} ${flows[volumes[i]]}`))
|
|
93
|
+
return fail('contradictory selected filament extruder variant mapping');
|
|
94
|
+
}
|
|
95
|
+
const resolved=selectedIds.map((id,index)=>{
|
|
96
|
+
const rows=ids.flatMap((candidate,row)=>candidate===id && variants[row]===selectedVariants[index]?[row]:[]);
|
|
97
|
+
if(rows.length!==1) return fail(`ambiguous or missing ${field} variant for filament ${id}`);
|
|
98
|
+
return table[rows[0]];
|
|
99
|
+
});
|
|
100
|
+
return consistent([resolved,...selectedValues],perFilament,field);
|
|
101
|
+
}
|
|
48
102
|
function stripComments(line: string): string {
|
|
49
103
|
let clean=''; let depth=0;
|
|
50
104
|
for(const char of line) {
|
|
@@ -360,9 +414,7 @@ export async function inspectPrintFile(filePath: string, options: {model:string;
|
|
|
360
414
|
// first-layer targets. Check every base and derived target, never use
|
|
361
415
|
// editable maxima or an unchecked offset as thermal evidence.
|
|
362
416
|
if(code!=='M104' || !h2cStartup(index) || args.size!==2 || args.get('O')!==-80 || !Number.isNaN(args.get('A')!)) fail('unsupported H2C startup offset parameters');
|
|
363
|
-
const targets=
|
|
364
|
-
const values=list(value);return values.length===materials.length && values.every(v=>NUMBER.test(v) && Number.isFinite(Number(v)))?values.map(Number):undefined;
|
|
365
|
-
},'first-layer nozzle temperature');
|
|
417
|
+
const targets=firstLayerTemperatures(project,headers,materials.length);
|
|
366
418
|
for(let position=0;position<targets.length;position++) {
|
|
367
419
|
validateTemperature('nozzle',targets[position],model,[materials[position]]);
|
|
368
420
|
const preheat=Math.max(0,targets[position]-80);
|