Skip to content

Commit 8390382

Browse files
authored
fix Range.fuzzy_in() typo bug and add 1210 capacitor smt size (#363)
some mini improvement when debug the the capacitor generator: I found most 47uF capacitor is in big smt size 1210 that is current ignored in JlcCapacitor.py csv part loader. - fix Range.fuzzy_in() typo bug and add 1210 capacitor smt size
1 parent dfeb554 commit 8390382

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ dmypy.json
3737
*.log
3838
*.csv
3939
*.kicad_sch.lck
40+
*.kicad_pcb.lck

edg/core/Range.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def fuzzy_in(self, container: 'Range') -> bool:
230230
else:
231231
lower = container.lower * (1 + self.DOUBLE_FLOAT_ROUND_FACTOR)
232232

233-
if self.upper >= 0:
233+
if container.upper >= 0:
234234
upper = container.upper * (1 + self.DOUBLE_FLOAT_ROUND_FACTOR)
235235
else:
236236
upper = container.upper * (1 - self.DOUBLE_FLOAT_ROUND_FACTOR)

edg/parts/JlcCapacitor.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,22 @@ class JlcCapacitor(TableDeratingCapacitor, CeramicCapacitor, SmdStandardPackageS
1313
'0603': 'Capacitor_SMD:C_0603_1608Metric',
1414
'0805': 'Capacitor_SMD:C_0805_2012Metric',
1515
'1206': 'Capacitor_SMD:C_1206_3216Metric',
16+
'1210': 'Capacitor_SMD:C_1210_3225Metric',
1617
'1812': 'Capacitor_SMD:C_1812_4532Metric',
1718

1819
'C0402': 'Capacitor_SMD:C_0402_1005Metric',
1920
'C0603': 'Capacitor_SMD:C_0603_1608Metric',
2021
'C0805': 'Capacitor_SMD:C_0805_2012Metric',
2122
'C1206': 'Capacitor_SMD:C_1206_3216Metric',
23+
'C1210': 'Capacitor_SMD:C_1210_3225Metric',
2224
'C1812': 'Capacitor_SMD:C_1812_4532Metric',
2325
}
2426
DERATE_VOLTCO_MAP = { # in terms of %capacitance / V over 3.6
2527
'Capacitor_SMD:C_0402_1005Metric': float('inf'), # not supported, should not generate below 1uF
2628
'Capacitor_SMD:C_0603_1608Metric': float('inf'), # not supported, should not generate below 1uF
2729
'Capacitor_SMD:C_0805_2012Metric': 0.08,
2830
'Capacitor_SMD:C_1206_3216Metric': 0.04,
31+
'Capacitor_SMD:C_1210_3225Metric': 0.04,
2932
'Capacitor_SMD:C_1812_4532Metric': 0.04, # arbitrary, copy from 1206
3033
}
3134

@@ -38,10 +41,10 @@ def __init__(self, *args, capacitance_minimum_size: BoolLike = True, **kwargs):
3841
@classmethod
3942
def _make_table(cls) -> PartsTable:
4043
CAPACITOR_MATCHES = {
41-
'nominal_capacitance': re.compile("(^|\s)([^±]\S+F)($|\s)"),
42-
'tolerance': re.compile("(^|\s)(±\S+[%F])($|\s)"),
43-
'voltage': re.compile("(^|\s)(\d\S*V)($|\s)"), # make sure not to catch 'Y5V'
44-
'tempco': re.compile("(^|\s)([CXYZ]\d[GPRSTUV])($|\s)"),
44+
'nominal_capacitance': re.compile(r"(^|\s)([^±]\S+F)($|\s)"),
45+
'tolerance': re.compile(r"(^|\s)(±\S+[%F])($|\s)"),
46+
'voltage': re.compile(r"(^|\s)(\d\S*V)($|\s)"), # make sure not to catch 'Y5V'
47+
'tempco': re.compile(r"(^|\s)([CXYZ]\d[GPRSTUV])($|\s)"),
4548
}
4649

4750
def parse_row(row: PartsTableRow) -> Optional[Dict[PartsTableColumn, Any]]:

0 commit comments

Comments
 (0)