Skip to content

Commit b34997a

Browse files
committed
skipping 16 and 17 as input pins in the test suit
1 parent a27e187 commit b34997a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/java/src/junit/test/neuronrobotics/namespace/DyIONamespaceTest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.neuronrobotics.sdk.dyio.DyIO;
1414
import com.neuronrobotics.sdk.dyio.DyIOChannelMode;
1515
import com.neuronrobotics.sdk.serial.SerialConnection;
16+
import com.neuronrobotics.sdk.util.ThreadUtil;
1617

1718
public class DyIONamespaceTest {
1819

@@ -101,6 +102,7 @@ public void shutdownDevices(){
101102
for(int i=0;i<modes.size();i++){
102103
assertTrue(modes.get(i)==modesAfter.get(i));
103104
assertTrue(modes.get(i)==testDevice.getMode(i));
105+
testDevice.setMode(i, DyIOChannelMode.DIGITAL_IN);
104106
}
105107
}
106108
@Test public void DyIOInputTest(){
@@ -119,11 +121,13 @@ public void shutdownDevices(){
119121
for(int j=0;j<5;j++){
120122
int pinState = state?1:0;
121123
harness.setValue(testerIndex, pinState);
124+
ThreadUtil.wait(50);
122125
int gotValue = testDevice.getValue(i);
123126
System.out.println(" Pin:"+i+" Tester:"+testerIndex+" setting to: "+pinState+" got:"+gotValue);
124127
assertTrue(gotValue==pinState);
125128
state = !state;
126129
}
130+
harness.setMode(testerIndex, DyIOChannelMode.DIGITAL_IN);
127131
}
128132
}
129133

@@ -136,20 +140,23 @@ public void shutdownDevices(){
136140

137141
//test device as output
138142
for(int i=0;i<numPins;i++){
139-
if(!(i==16 || i==17)){
140-
int testerIndex = numPins-1-i;
143+
int testerIndex = numPins-1-i;
144+
if(!(testerIndex==16 || testerIndex==17)){
145+
141146
harness.setMode(testerIndex, DyIOChannelMode.DIGITAL_IN);
142147
testDevice.setMode(i, DyIOChannelMode.DIGITAL_OUT);
143148

144149
boolean state=true;
145150
for(int j=0;j<5;j++){
146151
int pinState = state?1:0;
147152
testDevice.setValue(i, pinState);
153+
ThreadUtil.wait(200);
148154
int gotValue = harness.getValue(testerIndex);
149155
System.out.println(" Pin:"+i+" Tester:"+testerIndex+" setting to: "+pinState+" got:"+gotValue);
150156
assertTrue(gotValue==pinState);
151157
state = !state;
152158
}
159+
testDevice.setMode(i, DyIOChannelMode.DIGITAL_IN);
153160
}
154161
}
155162

0 commit comments

Comments
 (0)