@@ -358,14 +358,14 @@ class G2coreAPI extends EventEmitter {
358
358
// See https://github.com/synthetos/TinyG/wiki/TinyG-Status-Codes#status-report-enumerations
359
359
// for more into about stat codes.
360
360
361
- // 3 program stop or no more blocks (M0, M1, M60)
362
- // 4 program end via M2, M30
361
+ // 3 program stop or no more blocks (M0, M1, M60)
362
+ // 4 program end via M2, M30
363
363
if ( sr . stat == 3 || sr . stat == 4 ) {
364
364
// if (this.doneSending) {
365
365
// this.emit('doneSending');
366
366
// }
367
367
368
- // 2 machine is in alarm state (shut down)
368
+ // 2 machine is in alarm state (shut down)
369
369
} else if ( sr . stat == 2 ) {
370
370
// Fatal error! Shut down!
371
371
// this.emit('doneSending', sr);
@@ -611,15 +611,15 @@ class G2coreAPI extends EventEmitter {
611
611
this . ignoredResponses ++ ;
612
612
}
613
613
this . _write ( value ) ;
614
-
615
- // handle flush command
616
- if ( typeof value === 'string' && value . match ( / % + / ) ) {
617
- this . _resetLinesRequested ( ) ;
618
- this . linesSent = 0 ;
619
- this . ignoredResponses = 0 ;
620
- this . lineBuffer . length = 0 ;
621
- }
622
-
614
+
615
+ // handle flush command
616
+ if ( typeof value === 'string' && value . match ( / % + / ) ) {
617
+ this . _resetLinesRequested ( ) ;
618
+ this . linesSent = 0 ;
619
+ this . ignoredResponses = 0 ;
620
+ this . lineBuffer . length = 0 ;
621
+ }
622
+
623
623
return ;
624
624
}
625
625
@@ -902,8 +902,8 @@ class G2coreAPI extends EventEmitter {
902
902
if ( sr . stat ) {
903
903
// console.log("sr.stat: " + this.lineCountToSend)
904
904
905
- // 3 program stop or no more blocks (M0, M1, M60)
906
- // 4 program end via M2, M30
905
+ // 3 program stop or no more blocks (M0, M1, M60)
906
+ // 4 program end via M2, M30
907
907
if ( sr . stat == 3 || sr . stat == 4 ) {
908
908
if ( sr . stat == 4 ) {
909
909
if ( fileEnded && doneSending ) {
@@ -912,7 +912,7 @@ class G2coreAPI extends EventEmitter {
912
912
stopOrEndStat = true ;
913
913
}
914
914
915
- // 2 machine is in alarm state (shut down)
915
+ // 2 machine is in alarm state (shut down)
916
916
} else if ( sr . stat == 2 ) {
917
917
// If the machine is in error, we're done no matter what
918
918
if ( ! this . timedSendsOnly ) {
@@ -1206,20 +1206,27 @@ class G2coreAPI extends EventEmitter {
1206
1206
1207
1207
for ( let i = 0 ; i < results . length ; i ++ ) {
1208
1208
let item = results [ i ] ;
1209
+ let x ;
1209
1210
1210
1211
if ( process . platform === 'win32' ) {
1211
1212
// Windows:
1212
1213
// pnpId: USB\VID_1D50&PID_606D&MI_00\6&3B3CEA53&0&0000
1213
1214
// pnpId: USB\VID_1D50&PID_606D&MI_02\6&3B3CEA53&0&0002
1215
+ // pnpId: USB\VID_1D50&PID_606D\0084-D639-0084-08C6
1214
1216
1215
1217
// WARNING -- explicit test against VIP/PID combo.
1216
- if ( ( x = item . pnpId . match ( / ^ U S B \\ V I D _ ( [ 0 - 9 A - F a - f ] + ) & P I D _ ( [ 0 - 9 A - F a - f ] + ) & M I _ ( [ 0 - 9 ] + ) \\ ( .* ) $ / ) ) && // eslint-disable-line
1218
+ if ( ( x = item . pnpId . match ( / ^ U S B \\ V I D _ ( [ 0 - 9 A - F a - f ] + ) & P I D _ ( [ 0 - 9 A - F a - f ] + ) (?: (?: & M I _ ( [ 0 - 9 ] + ) \\ ( .* ) ) | (?: \\ ( . * ) ) ) $ / ) ) && // eslint-disable-line
1217
1219
( x [ 1 ] == '1D50' ) && ( x [ 2 ] == '606D' )
1218
1220
) {
1221
+ let serialNumber ;
1219
1222
// let vendor = x[1]; // never used
1220
1223
// let pid = x[2]; // never used
1221
- let theRest = x [ 4 ] . split ( '&' ) ;
1222
- let serialNumber = theRest [ 1 ] ;
1224
+ if ( x [ 4 ] ) {
1225
+ let theRest = x [ 4 ] . split ( '&' ) ;
1226
+ serialNumber = theRest [ 1 ] ;
1227
+ } else {
1228
+ serialNumber = x [ 5 ] ;
1229
+ }
1223
1230
1224
1231
if (
1225
1232
( g2s . length > 0 ) &&
0 commit comments