Browse Source

Allow friendly names in DATAQ SDK device initialization

Neal Wilson 11 years ago
parent
commit
d941dda5fa
1 changed files with 12 additions and 2 deletions
  1. 12
    2
      src/dataqsdk.w

+ 12
- 2
src/dataqsdk.w View File

495
 	}
495
 	}
496
 	int rstart = finalizedPort.indexOf("COM");
496
 	int rstart = finalizedPort.indexOf("COM");
497
 	finalizedPort.remove(0, rstart + 3);
497
 	finalizedPort.remove(0, rstart + 3);
498
-	if(finalizedPort.toInt() < 10)
498
+	bool chopFinished = false;
499
+	int finalizedPortNumber;
500
+	while(finalizedPort.size() > 0 && !chopFinished)
501
+	{
502
+		finalizedPortNumber = finalizedPort.toInt(&chopFinished);
503
+		if(!chopFinished)
504
+		{
505
+			finalizedPort.chop(1);
506
+		}
507
+	}
508
+	if(finalizedPortNumber < 10)
499
 	{
509
 	{
500
 		imp->device = QString("DI10%1NT.DLL").arg(finalizedPort);
510
 		imp->device = QString("DI10%1NT.DLL").arg(finalizedPort);
501
 	}
511
 	}
504
 		imp->device = QString("DI1%1NT.DLL").arg(finalizedPort);
514
 		imp->device = QString("DI1%1NT.DLL").arg(finalizedPort);
505
 	}
515
 	}
506
 	imp->deviceNumber = 0x12C02D00;
516
 	imp->deviceNumber = 0x12C02D00;
507
-	imp->deviceNumber += finalizedPort.toInt();
517
+	imp->deviceNumber += finalizedPortNumber;
508
 	imp->ready = true;
518
 	imp->ready = true;
509
 }
519
 }
510
 
520
 

Loading…
Cancel
Save