Skip to content

Commit

Permalink
fix(7segment-element): missing pins for 3-digit variant
Browse files Browse the repository at this point in the history
  • Loading branch information
urish committed Jul 10, 2022
1 parent 133c1a6 commit 1fe3840
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
9 changes: 9 additions & 0 deletions src/7segment-element.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ storiesOf('7 Segment', module)
values="[0,1,1,0,0,1,1,1,0,1,1,0,0,1,1,0]"
></wokwi-7segment>`
)
.add(
'3 white digits',
() =>
html`<wokwi-7segment
color="white"
digits="3"
values="[0,1,1,0,0,1,1,1,0,1,1,0,0,1,1,0,0,1,1,0]"
></wokwi-7segment>`
)
.add(
'Clock mode',
() =>
Expand Down
32 changes: 16 additions & 16 deletions src/7segment-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ export class SevenSegmentElement extends LitElement {
{ name: 'CLN', ...pinXY(8), signals: [], description: 'Colon' },
];

case 3:
// Pinout based on SP420281N model
return [
{ name: 'A', ...pinXY(11), signals: [], description: 'Segment A' },
{ name: 'B', ...pinXY(7), signals: [], description: 'Segment B' },
{ name: 'C', ...pinXY(4), signals: [], description: 'Segment C' },
{ name: 'D', ...pinXY(2), signals: [], description: 'Segment D' },
{ name: 'E', ...pinXY(1), signals: [], description: 'Segment E' },
{ name: 'F', ...pinXY(10), signals: [], description: 'Segment F' },
{ name: 'G', ...pinXY(5), signals: [], description: 'Segment G' },
{ name: 'DP', ...pinXY(3), signals: [], description: 'Decimal Point' },
{ name: 'DIG1', ...pinXY(12), signals: [], description: 'Digit 1 Common' },
{ name: 'DIG2', ...pinXY(9), signals: [], description: 'Digit 2 Common' },
{ name: 'DIG3', ...pinXY(8), signals: [], description: 'Digit 3 Common' },
];
case 3:
// Pinout based on SP420281N model
return [
{ name: 'A', ...pinXY(11), signals: [], description: 'Segment A' },
{ name: 'B', ...pinXY(7), signals: [], description: 'Segment B' },
{ name: 'C', ...pinXY(4), signals: [], description: 'Segment C' },
{ name: 'D', ...pinXY(2), signals: [], description: 'Segment D' },
{ name: 'E', ...pinXY(1), signals: [], description: 'Segment E' },
{ name: 'F', ...pinXY(10), signals: [], description: 'Segment F' },
{ name: 'G', ...pinXY(5), signals: [], description: 'Segment G' },
{ name: 'DP', ...pinXY(3), signals: [], description: 'Decimal Point' },
{ name: 'DIG1', ...pinXY(12), signals: [], description: 'Digit 1 Common' },
{ name: 'DIG2', ...pinXY(9), signals: [], description: 'Digit 2 Common' },
{ name: 'DIG3', ...pinXY(8), signals: [], description: 'Digit 3 Common' },
];

case 2:
// Pinout based on CL5621C model
Expand Down Expand Up @@ -130,7 +130,7 @@ export class SevenSegmentElement extends LitElement {

private get pinPositions() {
const { digits } = this;
const numPins = digits === 4 ? 14 : 10;
const numPins = digits === 4 ? 14 : digits === 3 ? 12 : 10;
const cols = Math.ceil(numPins / 2);
return {
startX: (12.55 * digits - cols * 2.54) / 2,
Expand Down

0 comments on commit 1fe3840

Please sign in to comment.