Skip to content

Commit 1fe3840

Browse files
committed
fix(7segment-element): missing pins for 3-digit variant
1 parent 133c1a6 commit 1fe3840

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

src/7segment-element.stories.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ storiesOf('7 Segment', module)
5454
values="[0,1,1,0,0,1,1,1,0,1,1,0,0,1,1,0]"
5555
></wokwi-7segment>`
5656
)
57+
.add(
58+
'3 white digits',
59+
() =>
60+
html`<wokwi-7segment
61+
color="white"
62+
digits="3"
63+
values="[0,1,1,0,0,1,1,1,0,1,1,0,0,1,1,0,0,1,1,0]"
64+
></wokwi-7segment>`
65+
)
5766
.add(
5867
'Clock mode',
5968
() =>

src/7segment-element.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,21 @@ export class SevenSegmentElement extends LitElement {
6969
{ name: 'CLN', ...pinXY(8), signals: [], description: 'Colon' },
7070
];
7171

72-
case 3:
73-
// Pinout based on SP420281N model
74-
return [
75-
{ name: 'A', ...pinXY(11), signals: [], description: 'Segment A' },
76-
{ name: 'B', ...pinXY(7), signals: [], description: 'Segment B' },
77-
{ name: 'C', ...pinXY(4), signals: [], description: 'Segment C' },
78-
{ name: 'D', ...pinXY(2), signals: [], description: 'Segment D' },
79-
{ name: 'E', ...pinXY(1), signals: [], description: 'Segment E' },
80-
{ name: 'F', ...pinXY(10), signals: [], description: 'Segment F' },
81-
{ name: 'G', ...pinXY(5), signals: [], description: 'Segment G' },
82-
{ name: 'DP', ...pinXY(3), signals: [], description: 'Decimal Point' },
83-
{ name: 'DIG1', ...pinXY(12), signals: [], description: 'Digit 1 Common' },
84-
{ name: 'DIG2', ...pinXY(9), signals: [], description: 'Digit 2 Common' },
85-
{ name: 'DIG3', ...pinXY(8), signals: [], description: 'Digit 3 Common' },
86-
];
72+
case 3:
73+
// Pinout based on SP420281N model
74+
return [
75+
{ name: 'A', ...pinXY(11), signals: [], description: 'Segment A' },
76+
{ name: 'B', ...pinXY(7), signals: [], description: 'Segment B' },
77+
{ name: 'C', ...pinXY(4), signals: [], description: 'Segment C' },
78+
{ name: 'D', ...pinXY(2), signals: [], description: 'Segment D' },
79+
{ name: 'E', ...pinXY(1), signals: [], description: 'Segment E' },
80+
{ name: 'F', ...pinXY(10), signals: [], description: 'Segment F' },
81+
{ name: 'G', ...pinXY(5), signals: [], description: 'Segment G' },
82+
{ name: 'DP', ...pinXY(3), signals: [], description: 'Decimal Point' },
83+
{ name: 'DIG1', ...pinXY(12), signals: [], description: 'Digit 1 Common' },
84+
{ name: 'DIG2', ...pinXY(9), signals: [], description: 'Digit 2 Common' },
85+
{ name: 'DIG3', ...pinXY(8), signals: [], description: 'Digit 3 Common' },
86+
];
8787

8888
case 2:
8989
// Pinout based on CL5621C model
@@ -130,7 +130,7 @@ export class SevenSegmentElement extends LitElement {
130130

131131
private get pinPositions() {
132132
const { digits } = this;
133-
const numPins = digits === 4 ? 14 : 10;
133+
const numPins = digits === 4 ? 14 : digits === 3 ? 12 : 10;
134134
const cols = Math.ceil(numPins / 2);
135135
return {
136136
startX: (12.55 * digits - cols * 2.54) / 2,

0 commit comments

Comments
 (0)