diff --git a/diylc/diylc-core/src/main/resources/import-defaults/variants.xml b/diylc/diylc-core/src/main/resources/import-defaults/variants.xml index 348478c2..5182f32c 100644 --- a/diylc/diylc-core/src/main/resources/import-defaults/variants.xml +++ b/diylc/diylc-core/src/main/resources/import-defaults/variants.xml @@ -5088,6 +5088,24 @@ false 2026-10-11T00:00:00.0000000 + + 2-Digit 0.56" Common Cathode + + TypeTwoDigit_0_56_10Pin + CommonCathode + + false + 2026-10-11T00:00:00.0000000 + + + 2-Digit 0.56" Common Anode + + TypeTwoDigit_0_56_10Pin + CommonAnode + + false + 2026-10-11T00:00:00.0000000 + 4-Digit 0.36" Common Cathode diff --git a/diylc/diylc-core/src/main/resources/update.xml b/diylc/diylc-core/src/main/resources/update.xml index 7523d1e7..139d6d97 100644 --- a/diylc/diylc-core/src/main/resources/update.xml +++ b/diylc/diylc-core/src/main/resources/update.xml @@ -507,7 +507,7 @@ NEW_FEATURE - 7-Segment Display - 1-digit 0.56 inch, 4-digit in 0.36 inch and 0.56 inch, and TM1637 driver module + 7-Segment Display - 1-digit 0.56 inch, 2-digit 0.56 inch, 4-digit in 0.36 inch and 0.56 inch, and TM1637 driver module NEW_FEATURE diff --git a/diylc/diylc-library/src/main/java/org/diylc/components/displays/SevenSegmentDisplay.java b/diylc/diylc-library/src/main/java/org/diylc/components/displays/SevenSegmentDisplay.java index 20daf440..48be4971 100644 --- a/diylc/diylc-library/src/main/java/org/diylc/components/displays/SevenSegmentDisplay.java +++ b/diylc/diylc-library/src/main/java/org/diylc/components/displays/SevenSegmentDisplay.java @@ -52,7 +52,7 @@ import org.diylc.core.measures.SizeUnit; import org.diylc.utils.Constants; @ComponentDescriptor(name = "7-Segment Display", category = "Displays & Outputs", - author = "Branislav Stojkovic", description = "7-Segment LED Display (1-Digit, 4-Digit, or TM1637 I2C Driver Module)", + author = "Branislav Stojkovic", description = "7-Segment LED Display (1-Digit, 2-Digit, 4-Digit, or TM1637 I2C Driver Module)", instanceNamePrefix = "DISP", zOrder = IDIYComponent.COMPONENT, bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME, enableCache = true) @@ -96,6 +96,15 @@ public class SevenSegmentDisplay extends AbstractMakerBoard { "E", "D", "COM1", "C", "DP", "B", "A", "COM2", "F", "G" }; + /** + * The 5621AS, which is the two-digit member of the same 0.56 inch family as the 5641AS. Ten pins + * rather than twelve: there are two digit commons to bring out instead of four, and no pin is + * freed up by that because the segments already account for the rest. + */ + public static final String[] PIN_NAMES_2DIGIT = new String[] { + "E", "D", "DP", "C", "G", "B", "D2", "D1", "F", "A" + }; + /** * Shared by both bare four-digit packages: the 3641AS and the 5641AS differ in size but not in * pin function, confirmed by the maintainer. @@ -591,11 +600,13 @@ public class SevenSegmentDisplay extends AbstractMakerBoard { * until someone reads a datasheet or measures a part. */ public enum DisplayType { - // The parts these model: 5161AS for the single digit, 3641AS for the 0.36 inch four-digit - // package and 5641AS for the 0.56 inch one. The two four-digit parts differ in size but share - // a pinout, which is why one array serves both. + // The parts these model: 5161AS for the single digit, 5621AS for the two-digit package, 3641AS + // for the 0.36 inch four-digit package and 5641AS for the 0.56 inch one. The two four-digit + // parts differ in size but share a pinout, which is why one array serves both. SingleDigit_10Pin("1-Digit 0.56\"", 12.7d, 19.0d, 8.1d, 14.2d, 0d, 15.24d, true, 1, PIN_NAMES_1DIGIT, null), + TwoDigit_0_56_10Pin("2-Digit 0.56\"", 25.0d, 19.0d, 8.1d, 14.2d, 12.7d, 15.24d, true, 2, + PIN_NAMES_2DIGIT, null), FourDigit_0_36_12Pin("4-Digit 0.36\"", 30.0d, 14.0d, 5.2d, 9.14d, 7.5d, 10.16d, true, 4, PIN_NAMES_4DIGIT, null), FourDigit_0_56_12Pin("4-Digit 0.56\"", 50.3d, 19.0d, 8.1d, 14.2d, 12.7d, 15.24d, true, 4, diff --git a/diylc/diylc-library/src/test/java/org/diylc/components/displays/SevenSegmentDisplayTest.java b/diylc/diylc-library/src/test/java/org/diylc/components/displays/SevenSegmentDisplayTest.java index 51a8a794..1d7ce3c3 100644 --- a/diylc/diylc-library/src/test/java/org/diylc/components/displays/SevenSegmentDisplayTest.java +++ b/diylc/diylc-library/src/test/java/org/diylc/components/displays/SevenSegmentDisplayTest.java @@ -35,8 +35,8 @@ import org.junit.BeforeClass; import org.junit.Test; /** - * Basic checks for the seven-segment displays. Three of the four variants are DIP packages that - * straddle their pins with a row either side, and the fourth is a module carrying a single header + * Basic checks for the seven-segment displays. All but one of the variants are DIP packages that + * straddle their pins with a row either side, and the last is a module carrying a single header * down one edge, so the pin layout is what differs most between them. */ public class SevenSegmentDisplayTest { @@ -75,6 +75,7 @@ public class SevenSegmentDisplayTest { @Test public void pinCountFollowsThePackage() { Assert.assertEquals(10, of(DisplayType.SingleDigit_10Pin).getControlPointCount()); + Assert.assertEquals(10, of(DisplayType.TwoDigit_0_56_10Pin).getControlPointCount()); Assert.assertEquals(12, of(DisplayType.FourDigit_0_36_12Pin).getControlPointCount()); Assert.assertEquals(12, of(DisplayType.FourDigit_0_56_12Pin).getControlPointCount()); Assert.assertEquals(4, of(DisplayType.TM1637_Module_4Pin).getControlPointCount()); @@ -87,6 +88,8 @@ public class SevenSegmentDisplayTest { public void pinNamesAreInDipOrder() { Assert.assertArrayEquals(new String[] {"E", "D", "COM1", "C", "DP", "B", "A", "COM2", "F", "G"}, SevenSegmentDisplay.PIN_NAMES_1DIGIT); + Assert.assertArrayEquals(new String[] {"E", "D", "DP", "C", "G", "B", "D2", "D1", "F", "A"}, + SevenSegmentDisplay.PIN_NAMES_2DIGIT); Assert.assertArrayEquals( new String[] {"E", "D", "DP", "C", "G", "D4", "B", "D3", "D2", "F", "A", "D1"}, SevenSegmentDisplay.PIN_NAMES_4DIGIT); @@ -127,6 +130,7 @@ public class SevenSegmentDisplayTest { @Test public void digitCountComesFromThePackage() { Assert.assertEquals(1, DisplayType.SingleDigit_10Pin.getDigitCount()); + Assert.assertEquals(2, DisplayType.TwoDigit_0_56_10Pin.getDigitCount()); Assert.assertEquals(4, DisplayType.FourDigit_0_36_12Pin.getDigitCount()); Assert.assertEquals(4, DisplayType.FourDigit_0_56_12Pin.getDigitCount()); Assert.assertEquals(4, DisplayType.TM1637_Module_4Pin.getDigitCount()); @@ -141,8 +145,8 @@ public class SevenSegmentDisplayTest { /** * A driven module brings out no common pins, so its polarity is not something you order -- which * is why the BOM line omits it. Asked of the variant rather than of its identity, and paired with - * the pin arrangement so that the two cannot quietly become one question: they agree on all four - * variants today, but a single-in-line bare package or a module in a DIP outline would separate + * the pin arrangement so that the two cannot quietly become one question: they agree on every + * variant today, but a single-in-line bare package or a module in a DIP outline would separate * them. */ @Test