File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,6 +158,23 @@ describe('MachineInfo', () => {
158158 expect ( result . MachineState ) . toBe ( MachineState . Unknown ) ; // status was not in AD5X JSON, so defaults to Unknown
159159 } ) ;
160160
161+ it ( 'should detect AD5X from material station presence even with a custom printer name' , ( ) => {
162+ const customNamedAd5xDetail : FFPrinterDetail = {
163+ ...AD5X_PRINTER_DETAIL_JSON ,
164+ name : 'E2E-AD5X' ,
165+ } ;
166+
167+ const result = machineInfoConverter . fromDetail ( customNamedAd5xDetail ) ;
168+
169+ expect ( result ) . not . toBeNull ( ) ;
170+ if ( ! result ) return ;
171+
172+ expect ( result . Name ) . toBe ( 'E2E-AD5X' ) ;
173+ expect ( result . IsAD5X ) . toBe ( true ) ;
174+ expect ( result . IsPro ) . toBe ( false ) ;
175+ expect ( result . HasMatlStation ) . toBe ( true ) ;
176+ } ) ;
177+
161178 it ( 'should correctly parse generic (non-AD5X) printer details' , ( ) => {
162179 const result = machineInfoConverter . fromDetail ( GENERIC_PRINTER_DETAIL_JSON ) ;
163180
Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ export class MachineInfo {
2929 if ( ! detail ) return null ;
3030
3131 try {
32+ const hasMaterialStation =
33+ detail . hasMatlStation === true ||
34+ ( detail . matlStationInfo ?. slotCnt ?? 0 ) > 0 ||
35+ ( detail . matlStationInfo ?. slotInfos ?. length ?? 0 ) > 0 ;
36+ const isAD5X = detail . name === 'AD5X' || hasMaterialStation ;
37+ const isPro = ( detail . name || '' ) . includes ( 'Pro' ) && ! isAD5X ;
3238 const printEta = this . formatTimeFromSeconds ( detail . estimatedTime || 0 ) ;
3339 const completionTime = new Date ( Date . now ( ) + ( detail . estimatedTime || 0 ) * 1000 ) ;
3440 const formattedRunTime = this . formatTimeFromSeconds ( detail . printDuration || 0 ) ;
@@ -93,8 +99,8 @@ export class MachineInfo {
9399 FillAmount : detail . fillAmount || 0 ,
94100 FirmwareVersion : detail . firmwareVersion || '' ,
95101 Name : detail . name || '' ,
96- IsPro : ( detail . name || '' ) . includes ( 'Pro' ) && detail . name !== 'AD5X' , // AD5X is special
97- IsAD5X : detail . name === 'AD5X' ,
102+ IsPro : isPro ,
103+ IsAD5X : isAD5X ,
98104 NozzleSize : detail . nozzleModel || '' ,
99105
100106 // Material Station Info
You can’t perform that action at this time.
0 commit comments