Skip to content

Commit

Permalink
fix CAN chain bug - lwjgl3
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyLi23 committed Jul 5, 2021
1 parent 8c42bd8 commit 7bfbece
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ public String getCAN(Cable c1, Cable c2) {
} 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))) {
return "CAN chain improperly wired at Falcon " + hardwareID2;
} else {
if(!CircuitGUIManager.getSim().temp.containsKey(getOther(3))) {
CircuitGUIManager.getSim().temp.put(getOther(3), getOther(3).getCAN(get(3), get(2)));
}
return CircuitGUIManager.getSim().temp.get(getOther(3));
return getOther(3).getCAN(get(3), get(2));
}
} else if (c1 == get(3) && c2 == get(2)) {
if (getNull(5) || getNull(4)) {
Expand All @@ -92,10 +89,7 @@ public String getCAN(Cable c1, Cable c2) {
} 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))) {
return "CAN chain improperly wired at Falcon " + hardwareID2;
} else {
if(!CircuitGUIManager.getSim().temp.containsKey(getOther(5))) {
CircuitGUIManager.getSim().temp.put(getOther(5), getOther(5).getCAN(get(5), get(4)));
}
return CircuitGUIManager.getSim().temp.get(getOther(5));
return getOther(5).getCAN(get(5), get(4));
}
} else {
return "CAN chain improperly wired at Falcon " + hardwareID2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,10 @@ public String getCAN(Cable c1, Cable c2) {
return "RoboRIO";
}
return "Incorrectly wired to RoboRIO";
} 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))) {
} 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))) {
return "CAN chain improperly wired at SPARK " + hardwareID2;
} else {
if(!CircuitGUIManager.getSim().temp.containsKey(getOther(6))) {
CircuitGUIManager.getSim().temp.put(getOther(6), getOther(6).getCAN(get(6), get(5)));
}
return CircuitGUIManager.getSim().temp.get(getOther(6));
return getOther(6).getCAN(get(6), get(5));
}
} else if (c1 == get(6) && c2 == get(5)) {
if (getNull(8) || getNull(7)) {
Expand All @@ -93,10 +90,7 @@ public String getCAN(Cable c1, Cable c2) {
} 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))) {
return "CAN chain improperly wired at SPARK " + hardwareID2;
} else {
if(!CircuitGUIManager.getSim().temp.containsKey(getOther(8))) {
CircuitGUIManager.getSim().temp.put(getOther(8), getOther(8).getCAN(get(8), get(7)));
}
return CircuitGUIManager.getSim().temp.get(getOther(8));
return getOther(8).getCAN(get(8), get(7));
}
} else {
return "CAN chain improperly wired at SPARK " + hardwareID2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ public String getCAN(Cable c1, Cable c2) {
} 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))) {
return "CAN chain improperly wired at Talon " + hardwareID2;
} else {
if(!CircuitGUIManager.getSim().temp.containsKey(getOther(5))) {
CircuitGUIManager.getSim().temp.put(getOther(5), getOther(5).getCAN(get(5), get(4)));
}
return CircuitGUIManager.getSim().temp.get(getOther(5));
return getOther(5).getCAN(get(5), get(4));
}
} else if (c1 == get(5) && c2 == get(4)) {
if (getNull(7) || getNull(6)) {
Expand All @@ -90,10 +87,7 @@ public String getCAN(Cable c1, Cable c2) {
} 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))) {
return "CAN chain improperly wired at Talon " + hardwareID2;
} else {
if(!CircuitGUIManager.getSim().temp.containsKey(getOther(7))) {
CircuitGUIManager.getSim().temp.put(getOther(7), getOther(7).getCAN(get(7), get(6)));
}
return CircuitGUIManager.getSim().temp.get(getOther(7));
return getOther(7).getCAN(get(7), get(6));
}
} else {
return "CAN chain improperly wired at Talon " + hardwareID2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void blinkTime(int speed, int time) {
et = time;
}

public void stopBink() {
public void stopBlink() {
blinking = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ public class Simulation {
public boolean isRunning = false;
public boolean changed = false;
private DelayedRemovalArray<Hardware> h;
public HashMap<Hardware, String> temp, store;
public HashMap<Hardware, String> store;

public Simulation() {
temp = new HashMap<>();
store = new HashMap<>();
}

public void simulate() {
temp.clear();
store.clear();
isRunning = true;
changed = false;
Expand All @@ -42,9 +40,6 @@ public void simulate() {

System.gc();

//CircuitGUIManager.popup.activateError("Simulation Not Implemented");

//return error;
}


Expand Down

0 comments on commit 7bfbece

Please sign in to comment.