Skip to content

Commit 7bfbece

Browse files
committed
fix CAN chain bug - lwjgl3
1 parent 8c42bd8 commit 7bfbece

File tree

5 files changed

+9
-32
lines changed

5 files changed

+9
-32
lines changed

core/src/main/java/com/amhsrobotics/circuitsim/hardware/devices/Falcon.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ public String getCAN(Cable c1, Cable c2) {
6666
} else if (!(((getOther(3) instanceof Talon && getOther(2) instanceof Talon) || (getOther(3) instanceof Spark && getOther(2) instanceof Spark) || (getOther(3) instanceof Falcon && getOther(2) instanceof Falcon)) && getONum(2) == getONum(3))) {
6767
return "CAN chain improperly wired at Falcon " + hardwareID2;
6868
} else {
69-
if(!CircuitGUIManager.getSim().temp.containsKey(getOther(3))) {
70-
CircuitGUIManager.getSim().temp.put(getOther(3), getOther(3).getCAN(get(3), get(2)));
71-
}
72-
return CircuitGUIManager.getSim().temp.get(getOther(3));
69+
return getOther(3).getCAN(get(3), get(2));
7370
}
7471
} else if (c1 == get(3) && c2 == get(2)) {
7572
if (getNull(5) || getNull(4)) {
@@ -92,10 +89,7 @@ public String getCAN(Cable c1, Cable c2) {
9289
} else if (!(((getOther(5) instanceof Talon && getOther(4) instanceof Talon) || (getOther(5) instanceof Spark && getOther(4) instanceof Spark) || (getOther(5) instanceof Falcon && getOther(4) instanceof Falcon)) && getONum(4) == getONum(5))) {
9390
return "CAN chain improperly wired at Falcon " + hardwareID2;
9491
} else {
95-
if(!CircuitGUIManager.getSim().temp.containsKey(getOther(5))) {
96-
CircuitGUIManager.getSim().temp.put(getOther(5), getOther(5).getCAN(get(5), get(4)));
97-
}
98-
return CircuitGUIManager.getSim().temp.get(getOther(5));
92+
return getOther(5).getCAN(get(5), get(4));
9993
}
10094
} else {
10195
return "CAN chain improperly wired at Falcon " + hardwareID2;

core/src/main/java/com/amhsrobotics/circuitsim/hardware/devices/Spark.java

+3-9
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,10 @@ public String getCAN(Cable c1, Cable c2) {
6464
return "RoboRIO";
6565
}
6666
return "Incorrectly wired to RoboRIO";
67-
} else if (!(((getOther(6) instanceof Talon && getOther(5) instanceof Talon) || (getOther(6) instanceof Spark && getOther(4) instanceof Spark) || (getOther(6) instanceof Falcon && getOther(5) instanceof Falcon)) && getONum(5) == getONum(6))) {
67+
} else if (!(((getOther(6) instanceof Talon && getOther(5) instanceof Talon) || (getOther(6) instanceof Spark && getOther(5) instanceof Spark) || (getOther(6) instanceof Falcon && getOther(5) instanceof Falcon)) && getONum(5) == getONum(6))) {
6868
return "CAN chain improperly wired at SPARK " + hardwareID2;
6969
} else {
70-
if(!CircuitGUIManager.getSim().temp.containsKey(getOther(6))) {
71-
CircuitGUIManager.getSim().temp.put(getOther(6), getOther(6).getCAN(get(6), get(5)));
72-
}
73-
return CircuitGUIManager.getSim().temp.get(getOther(6));
70+
return getOther(6).getCAN(get(6), get(5));
7471
}
7572
} else if (c1 == get(6) && c2 == get(5)) {
7673
if (getNull(8) || getNull(7)) {
@@ -93,10 +90,7 @@ public String getCAN(Cable c1, Cable c2) {
9390
} else if (!(((getOther(8) instanceof Talon && getOther(7) instanceof Talon) || (getOther(8) instanceof Spark && getOther(7) instanceof Spark) || (getOther(8) instanceof Falcon && getOther(7) instanceof Falcon)) && getONum(7) == getONum(8))) {
9491
return "CAN chain improperly wired at SPARK " + hardwareID2;
9592
} else {
96-
if(!CircuitGUIManager.getSim().temp.containsKey(getOther(8))) {
97-
CircuitGUIManager.getSim().temp.put(getOther(8), getOther(8).getCAN(get(8), get(7)));
98-
}
99-
return CircuitGUIManager.getSim().temp.get(getOther(8));
93+
return getOther(8).getCAN(get(8), get(7));
10094
}
10195
} else {
10296
return "CAN chain improperly wired at SPARK " + hardwareID2;

core/src/main/java/com/amhsrobotics/circuitsim/hardware/devices/Talon.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ public String getCAN(Cable c1, Cable c2) {
6464
} else if (!(((getOther(5) instanceof Talon && getOther(4) instanceof Talon) || (getOther(5) instanceof Spark && getOther(4) instanceof Spark) || (getOther(5) instanceof Falcon && getOther(4) instanceof Falcon)) && getONum(4) == getONum(5))) {
6565
return "CAN chain improperly wired at Talon " + hardwareID2;
6666
} else {
67-
if(!CircuitGUIManager.getSim().temp.containsKey(getOther(5))) {
68-
CircuitGUIManager.getSim().temp.put(getOther(5), getOther(5).getCAN(get(5), get(4)));
69-
}
70-
return CircuitGUIManager.getSim().temp.get(getOther(5));
67+
return getOther(5).getCAN(get(5), get(4));
7168
}
7269
} else if (c1 == get(5) && c2 == get(4)) {
7370
if (getNull(7) || getNull(6)) {
@@ -90,10 +87,7 @@ public String getCAN(Cable c1, Cable c2) {
9087
} else if (!(((getOther(7) instanceof Talon && getOther(6) instanceof Talon) || (getOther(7) instanceof Spark && getOther(6) instanceof Spark) || (getOther(7) instanceof Falcon && getOther(6) instanceof Falcon)) && getONum(6) == getONum(7))) {
9188
return "CAN chain improperly wired at Talon " + hardwareID2;
9289
} else {
93-
if(!CircuitGUIManager.getSim().temp.containsKey(getOther(7))) {
94-
CircuitGUIManager.getSim().temp.put(getOther(7), getOther(7).getCAN(get(7), get(6)));
95-
}
96-
return CircuitGUIManager.getSim().temp.get(getOther(7));
90+
return getOther(7).getCAN(get(7), get(6));
9791
}
9892
} else {
9993
return "CAN chain improperly wired at Talon " + hardwareID2;

core/src/main/java/com/amhsrobotics/circuitsim/hardware/parts/LED.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public void blinkTime(int speed, int time) {
116116
et = time;
117117
}
118118

119-
public void stopBink() {
119+
public void stopBlink() {
120120
blinking = false;
121121
}
122122

core/src/main/java/com/amhsrobotics/circuitsim/utility/Simulation.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ public class Simulation {
1212
public boolean isRunning = false;
1313
public boolean changed = false;
1414
private DelayedRemovalArray<Hardware> h;
15-
public HashMap<Hardware, String> temp, store;
15+
public HashMap<Hardware, String> store;
1616

1717
public Simulation() {
18-
temp = new HashMap<>();
1918
store = new HashMap<>();
2019
}
2120

2221
public void simulate() {
23-
temp.clear();
2422
store.clear();
2523
isRunning = true;
2624
changed = false;
@@ -42,9 +40,6 @@ public void simulate() {
4240

4341
System.gc();
4442

45-
//CircuitGUIManager.popup.activateError("Simulation Not Implemented");
46-
47-
//return error;
4843
}
4944

5045

0 commit comments

Comments
 (0)