Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVGPCB templates name fix #348

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions electronics_lib/LedMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def _svgpcb_template(self) -> str:

for (let xIndex=0; xIndex < kXCount; xIndex++) {{
ledPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * yIndex]
obj.footprints[`d[${{yIndex}}_${{xIndex}}]`] = led = board.add({led_footprint}, {{
obj.footprints[`led[${{yIndex}}_${{xIndex}}]`] = led = board.add({led_footprint}, {{
translate: ledPos,
id: `{self._svgpcb_pathname()}_d[${{yIndex}}_${{xIndex}}]`
id: `{self._svgpcb_pathname()}_led_${{yIndex}}_${{xIndex}}_`
}})
rowLeds.push(led)

Expand Down Expand Up @@ -98,9 +98,9 @@ def _svgpcb_template(self) -> str:
allResistors = []
for (let xIndex=0; xIndex < kXCount; xIndex++) {{
const resPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * kYCount]
obj.footprints[`r[${{xIndex + 1}}]`] = res = board.add({res_footprint}, {{
obj.footprints[`res[${{xIndex + 1}}]`] = res = board.add({res_footprint}, {{
translate: resPos,
id: `{self._svgpcb_pathname()}_r[${{xIndex + 1}}]`
id: `{self._svgpcb_pathname()}_res_${{xIndex + 1}}_`
}})
allResistors.push(res)

Expand Down
2 changes: 1 addition & 1 deletion electronics_lib/Neopixel.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def _svgpcb_template(self) -> str:
obj.footprints[`led[${{i}}]`] = led = board.add({led_footprint}, {{
translate: origin,
rotate: angle + rot,
id: `{self._svgpcb_pathname()}_led[${{i}}]`
id: `{self._svgpcb_pathname()}_led_${{i}}_`
}})

const gndOrigin = pAdd(xy, vRotate([radius - powerRadiusOffset, 0], angle))
Expand Down
8 changes: 4 additions & 4 deletions electronics_lib/SwitchMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ def _svgpcb_template(self) -> str:
index = yIndex * ncols + xIndex + 1

buttonPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * yIndex]
obj.footprints[`sw[${{xIndex}}][${{yIndex}}]`] = button = board.add(
obj.footprints[`sw[${{xIndex}},${{yIndex}}]`] = button = board.add(
{switch_footprint},
{{
translate: buttonPos, rotate: 0,
id: `{self._svgpcb_pathname()}_sw[${{xIndex}}][${{yIndex}}]`
id: `{self._svgpcb_pathname()}_sw_${{xIndex}}_${{yIndex}}_`
}})

diodePos = [buttonPos[0] + diodeOffset[0], buttonPos[1] + diodeOffset[1]]
obj[`d[${{xIndex}}][${{yIndex}}]`] = diode = board.add(
obj[`d[${{xIndex}},${{yIndex}}]`] = diode = board.add(
{diode_footprint},
{{
translate: diodePos, rotate: 90,
id: `{self._svgpcb_pathname()}_d[${{xIndex}}][${{yIndex}}]`
id: `{self._svgpcb_pathname()}_d_${{xIndex}}_${{yIndex}}_`
}})

// create stub wire for button -> column common line
Expand Down
8 changes: 4 additions & 4 deletions examples/BasicKeyboard/BasicKeyboard.svgpcb.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ function SwitchMatrix_2_3_sw(xy, colSpacing=1, rowSpacing=1, diodeOffset=[0.25,
index = yIndex * ncols + xIndex + 1

buttonPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * yIndex]
obj.footprints[`sw[${xIndex}][${yIndex}]`] = button = board.add(
obj.footprints[`sw[${xIndex},${yIndex}]`] = button = board.add(
SW_Hotswap_Kailh_MX,
{
translate: buttonPos, rotate: 0,
id: `sw_sw[${xIndex}][${yIndex}]`
id: `sw_sw_${xIndex}_${yIndex}_`
})

diodePos = [buttonPos[0] + diodeOffset[0], buttonPos[1] + diodeOffset[1]]
obj[`d[${xIndex}][${yIndex}]`] = diode = board.add(
obj[`d[${xIndex},${yIndex}]`] = diode = board.add(
D_SMA,
{
translate: diodePos, rotate: 90,
id: `sw_d[${xIndex}][${yIndex}]`
id: `sw_d_${xIndex}_${yIndex}_`
})

// create stub wire for button -> column common line
Expand Down
6 changes: 3 additions & 3 deletions examples/IotKnob/IotKnob.svgpcb.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function NeopixelArrayCircular_4_rgb_knob(xy, rot=90, radius=1, startAngle=0, en
obj.footprints[`led[${i}]`] = led = board.add(LED_SK6812_EC15_1_5x1_5mm, {
translate: origin,
rotate: angle + rot,
id: `rgb_knob_led[${i}]`
id: `rgb_knob_led_${i}_`
})

const gndOrigin = pAdd(xy, vRotate([radius - powerRadiusOffset, 0], angle))
Expand Down Expand Up @@ -181,7 +181,7 @@ function NeopixelArrayCircular_24_rgb_ring(xy, rot=90, radius=1, startAngle=0, e
obj.footprints[`led[${i}]`] = led = board.add(LED_SK6812_EC15_1_5x1_5mm, {
translate: origin,
rotate: angle + rot,
id: `rgb_ring_led[${i}]`
id: `rgb_ring_led_${i}_`
})

const gndOrigin = pAdd(xy, vRotate([radius - powerRadiusOffset, 0], angle))
Expand Down Expand Up @@ -292,7 +292,7 @@ function NeopixelArrayCircular_6_rgb_sw(xy, rot=90, radius=1, startAngle=0, endA
obj.footprints[`led[${i}]`] = led = board.add(LED_SK6812_EC15_1_5x1_5mm, {
translate: origin,
rotate: angle + rot,
id: `rgb_sw_led[${i}]`
id: `rgb_sw_led_${i}_`
})

const gndOrigin = pAdd(xy, vRotate([radius - powerRadiusOffset, 0], angle))
Expand Down
8 changes: 4 additions & 4 deletions examples/Keyboard/Keyboard.svgpcb.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ function SwitchMatrix_2_3_sw(xy, colSpacing=1, rowSpacing=1, diodeOffset=[0.25,
index = yIndex * ncols + xIndex + 1

buttonPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * yIndex]
obj.footprints[`sw[${xIndex}][${yIndex}]`] = button = board.add(
obj.footprints[`sw[${xIndex},${yIndex}]`] = button = board.add(
SW_Hotswap_Kailh_MX,
{
translate: buttonPos, rotate: 0,
id: `sw_sw[${xIndex}][${yIndex}]`
id: `sw_sw_${xIndex}_${yIndex}_`
})

diodePos = [buttonPos[0] + diodeOffset[0], buttonPos[1] + diodeOffset[1]]
obj[`d[${xIndex}][${yIndex}]`] = diode = board.add(
obj[`d[${xIndex},${yIndex}]`] = diode = board.add(
D_SMA,
{
translate: diodePos, rotate: 90,
id: `sw_d[${xIndex}][${yIndex}]`
id: `sw_d_${xIndex}_${yIndex}_`
})

// create stub wire for button -> column common line
Expand Down
8 changes: 4 additions & 4 deletions examples/LedMatrix/LedMatrix.svgpcb.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ function CharlieplexedLedMatrix_5_6_matrix(xy, colSpacing=1, rowSpacing=1) {

for (let xIndex=0; xIndex < kXCount; xIndex++) {
ledPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * yIndex]
obj.footprints[`d[${yIndex}_${xIndex}]`] = led = board.add(LED_0603_1608Metric, {
obj.footprints[`led[${yIndex}_${xIndex}]`] = led = board.add(LED_0603_1608Metric, {
translate: ledPos,
id: `matrix_d[${yIndex}_${xIndex}]`
id: `matrix_led_${yIndex}_${xIndex}_`
})
rowLeds.push(led)

Expand Down Expand Up @@ -71,9 +71,9 @@ function CharlieplexedLedMatrix_5_6_matrix(xy, colSpacing=1, rowSpacing=1) {
allResistors = []
for (let xIndex=0; xIndex < kXCount; xIndex++) {
const resPos = [xy[0] + colSpacing * xIndex, xy[1] + rowSpacing * kYCount]
obj.footprints[`r[${xIndex + 1}]`] = res = board.add(R_0603_1608Metric, {
obj.footprints[`res[${xIndex + 1}]`] = res = board.add(R_0603_1608Metric, {
translate: resPos,
id: `matrix_r[${xIndex + 1}]`
id: `matrix_res_${xIndex + 1}_`
})
allResistors.push(res)

Expand Down
Loading