mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
4P5T and DP5T guitar switches were not properly configured for internal
pin connections
This commit is contained in:
@@ -2782,6 +2782,10 @@
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>When moving or deleting trace cuts from a vero board, highlight connected areas would still render the area from before the cut was deleted</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>4P5T and DP5T guitar switches were not properly configured for internal pin connections</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
</changes>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||
</org.diylc.appframework.update.Version>
|
||||
|
||||
Binary file not shown.
@@ -143,7 +143,12 @@ public class LeverSwitch extends AbstractTransparentComponent<String> implements
|
||||
g2d.setColor(COMMON_LUG_COLOR);
|
||||
g2d.fill(body[3]);
|
||||
g2d.setColor(COMMON_LUG_COLOR.darker());
|
||||
g2d.draw(body[3]);
|
||||
g2d.draw(body[3]);
|
||||
|
||||
g2d.setColor(Color.black);
|
||||
for(int i = 0; i < getControlPointCount(); i++) {
|
||||
g2d.drawString(i + "", controlPoints[i].x, controlPoints[i].y);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
@@ -304,7 +309,7 @@ public class LeverSwitch extends AbstractTransparentComponent<String> implements
|
||||
for (Point point : controlPoints) {
|
||||
rotation.transform(point, point);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -470,9 +475,11 @@ public class LeverSwitch extends AbstractTransparentComponent<String> implements
|
||||
return (index2 == 6 && (index1 == 2 || (index1 == 0 && position == 1) || (index1 == 4 && position == 3))) ||
|
||||
(index1 == 1 && (index2 == 5 || (index2 == 3 && position == 1) || (index2 == 7 && position == 3)));
|
||||
case DP5T:
|
||||
return (index1 == 0 || index2 == 11) && index2 - index1 == position + 1;
|
||||
return (index1 == 0 && index2 - index1 == position + 1)
|
||||
|| (index2 == 11 && index2 - index1 == 5 - position);
|
||||
case _4P5T:
|
||||
return (index1 == 0 || index1 == 12 || index2 == 11 || index2 == 23) && index2 - index1 == position + 1;
|
||||
return ((index1 == 0 || index1 == 12) && index2 - index1 == position + 1)
|
||||
|| ((index2 == 11 || index2 == 23) && index2 - index1 == 5 - position);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -22,9 +22,16 @@
|
||||
package org.diylc.netlist;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.diylc.components.electromechanical.OpenJack1_4;
|
||||
import org.diylc.components.guitar.HumbuckerPickup;
|
||||
import org.diylc.components.guitar.LeverSwitch;
|
||||
import org.diylc.components.guitar.LeverSwitch.LeverSwitchType;
|
||||
import org.diylc.components.guitar.SingleCoilPickup;
|
||||
import org.diylc.components.passive.PotentiometerPanel;
|
||||
import org.diylc.components.passive.RadialCeramicDiskCapacitor;
|
||||
@@ -271,4 +278,41 @@ public class GuitarNetlistAnalyzerTests {
|
||||
String s = tree.toString();
|
||||
assertEquals("(((Volume.1-2) + ((Pickup1.North<- + Pickup1.South<-) || (Pickup2.North<- + Pickup2.South<-) || (Tone1.2-3 + Cap1) || (Tone2.2-3 + Cap2))) || (Volume.2-3))", s);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLeverSwitch() {
|
||||
LeverSwitch leverSwitch = new LeverSwitch();
|
||||
|
||||
leverSwitch.setType(LeverSwitchType.DP5T);
|
||||
String[] validCombinations = new String[]{
|
||||
"0,0,1", "0,6,11", "0,12,13", "0,18,23",
|
||||
"1,0,2", "1,7,11", "1,12,14", "1,19,23",
|
||||
"2,0,3", "2,8,11", "2,12,15", "2,20,23",
|
||||
"3,0,4", "3,9,11", "3,12,16", "3,21,23",
|
||||
"4,0,5", "4,10,11", "4,12,17", "4,22,23"};
|
||||
Arrays.sort(validCombinations);
|
||||
for (int p = 0; p < leverSwitch.getPositionCount(); p++)
|
||||
for (int i = 0; i < leverSwitch.getControlPointCount(); i++)
|
||||
for (int j = 0; j < leverSwitch.getControlPointCount(); j++) {
|
||||
String test = p + "," + i + "," + j;
|
||||
boolean isConnected = leverSwitch.arePointsConnected(i, j, p);
|
||||
boolean isOk = (isConnected && Arrays.binarySearch(validCombinations, test) >= 0) ||
|
||||
!isConnected && Arrays.binarySearch(validCombinations, test) < 0;
|
||||
if (!isOk)
|
||||
fail("Bad connection for p=" + p + ", i=" + i + ",j=" + j);
|
||||
}
|
||||
|
||||
leverSwitch.setType(LeverSwitchType._4P5T);
|
||||
Arrays.sort(validCombinations);
|
||||
for (int p = 0; p < leverSwitch.getPositionCount(); p++)
|
||||
for (int i = 0; i < leverSwitch.getControlPointCount(); i++)
|
||||
for (int j = 0; j < leverSwitch.getControlPointCount(); j++) {
|
||||
String test = p + "," + i + "," + j;
|
||||
boolean isConnected = leverSwitch.arePointsConnected(i, j, p);
|
||||
boolean isOk = (isConnected && Arrays.binarySearch(validCombinations, test) >= 0) ||
|
||||
!isConnected && Arrays.binarySearch(validCombinations, test) < 0;
|
||||
if (!isOk)
|
||||
fail("Bad connection for p=" + p + ", i=" + i + ",j=" + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user