Skip to content

Commit 1571828

Browse files
committed
merge
2 parents 3e5c598 + ba21b04 commit 1571828

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

edg/abstract_parts/AbstractAntenna.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
@abstract_block
88
class Antenna(Interface, Block):
99
@init_in_parent
10-
def __init__(self, frequency: RangeLike, impedance: RangeLike = Range.all(), power: RangeLike = (0, 0*Watt)):
10+
def __init__(self, frequency: RangeLike, impedance: RangeLike = Range.all(), power: RangeLike = (0, 0)*Watt):
1111
super().__init__()
1212

1313
self.frequency = self.ArgParameter(frequency)

edg/electronics_model/KiCadSchematicParser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414

1515
TestCastType = TypeVar('TestCastType')
16-
def test_cast(x: Any, type: Type[TestCastType]) -> TestCastType:
16+
def test_cast(x: Any, tpe: Type[TestCastType]) -> TestCastType:
1717
"""Combination of (dynamic) isinstance test and static typing cast."""
18-
assert isinstance(x, type)
18+
assert isinstance(x, tpe), f"got {x} of type {type(x)}, expected {tpe}"
1919
return x
2020

2121
def extract_only(x: List[TestCastType]) -> TestCastType:

edg/jlcparts/JlcPartsBase.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def config_root_dir(root_dir: str):
9595
CapacitorsMultilayer_Ceramic_Capacitors_MLCC___SMDakaSMT.json.gz
9696
This setting is on a JlcPartsBase-wide basis."""
9797
assert JlcPartsBase._config_parts_root_dir is None, \
98-
f"attempted to reassign config_root_dir, was {JlcPartsBase._config_parts_root_dir}, new {root_dir}"
98+
f"attempted to reassign configure_root_dir, was {JlcPartsBase._config_parts_root_dir}, new {root_dir}"
9999
JlcPartsBase._config_parts_root_dir = root_dir
100100

101101
_JLC_PARTS_FILE_NAMES: ClassVar[List[str]] # set by subclass
@@ -118,14 +118,19 @@ def _entry_to_table_row(cls, row_dict: Dict[PartsTableColumn, Any], filename: st
118118
@classmethod
119119
def _parse_table(cls) -> PartsTable:
120120
"""Parses the file to a PartsTable"""
121-
assert cls._config_parts_root_dir is not None, "must config_root_dir with jlcparts data folder"
121+
jlcparts_dir = os.environ.get("JLCPARTS_DIR")
122+
if jlcparts_dir is None:
123+
jlcparts_dir = cls._config_parts_root_dir
124+
assert jlcparts_dir is not None, "no jlcparts data directory specified, either "\
125+
"set JLCPARTS_DIR environment variable or call JlcPartsBase.config_root_dir "\
126+
"with jlcparts data folder"
122127

123128
rows: List[PartsTableRow] = []
124129

125130
for filename in cls._JLC_PARTS_FILE_NAMES:
126-
with gzip.open(os.path.join(cls._config_parts_root_dir, filename + kTableFilenamePostfix), 'r') as f:
131+
with gzip.open(os.path.join(jlcparts_dir, filename + kTableFilenamePostfix), 'r') as f:
127132
data = JlcPartsFile.model_validate_json(f.read())
128-
with open(os.path.join(cls._config_parts_root_dir, filename + kStockFilenamePostfix), 'r') as f:
133+
with open(os.path.join(jlcparts_dir, filename + kStockFilenamePostfix), 'r') as f:
129134
stocking = JlcPartsStockFile.model_validate_json(f.read())
130135

131136
lcsc_index = data.jlcpart_schema.index("lcsc")

edg/parts/Neopixel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def _svgpcb_template(self) -> str:
201201
assert all([pin is not None for pin in [led_vdd_pin, led_gnd_pin, led_din_pin, led_dout_pin]])
202202

203203
return f"""\
204-
function {self._svgpcb_fn_name()}(xy, rot=90, radius=1, startAngle=0, endAngle=360, powerRadiusOffset=0.2) {{
204+
function {self._svgpcb_fn_name()}(xy, rot=270, radius=1, startAngle=0, endAngle=360, powerRadiusOffset=0.2) {{
205205
const kCount = {self._svgpcb_get(self.count)}
206206
207207
// Global params

examples/IotKnob/IotKnob.svgpcb.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ renderPCB({
464464
mmPerUnit: 25.4
465465
})
466466

467-
function NeopixelArrayCircular_4_rgb_knob(xy, rot=90, radius=1, startAngle=0, endAngle=360, powerRadiusOffset=0.2) {
467+
function NeopixelArrayCircular_4_rgb_knob(xy, rot=270, radius=1, startAngle=0, endAngle=360, powerRadiusOffset=0.2) {
468468
const kCount = 4
469469

470470
// Global params
@@ -575,7 +575,7 @@ function NeopixelArrayCircular_4_rgb_knob(xy, rot=90, radius=1, startAngle=0, en
575575
return obj
576576
}
577577

578-
function NeopixelArrayCircular_24_rgb_ring(xy, rot=90, radius=1, startAngle=0, endAngle=360, powerRadiusOffset=0.2) {
578+
function NeopixelArrayCircular_24_rgb_ring(xy, rot=270, radius=1, startAngle=0, endAngle=360, powerRadiusOffset=0.2) {
579579
const kCount = 24
580580

581581
// Global params
@@ -686,7 +686,7 @@ function NeopixelArrayCircular_24_rgb_ring(xy, rot=90, radius=1, startAngle=0, e
686686
return obj
687687
}
688688

689-
function NeopixelArrayCircular_6_rgb_sw(xy, rot=90, radius=1, startAngle=0, endAngle=360, powerRadiusOffset=0.2) {
689+
function NeopixelArrayCircular_6_rgb_sw(xy, rot=270, radius=1, startAngle=0, endAngle=360, powerRadiusOffset=0.2) {
690690
const kCount = 6
691691

692692
// Global params

0 commit comments

Comments
 (0)