gokul/usb3-sd-hub

Engineering draft: four-layer, computer-powered USB 3 hub with one USB-C host socket, two USB-C and two USB-A accessory sockets, and a full-size SD slot. Board and three schematic previews are available. Routing and production checks are incomplete; not fabrication ready.

Version
0.1.5
License
MIT
Stars
0

design/schematic-group-compatibility.ts

import { Group } from "tscircuit";

// Scoped workaround for core #2845. Non-subcircuit schematic groups serialize a null
// subcircuit_id. Use the real enclosing subcircuit ID after native layout;
// positions, symbols, wires and electrical connectivity are unchanged.
const groupLayout = Group.prototype.doInitialSchematicLayout;
Group.prototype.doInitialSchematicLayout = function () {
	groupLayout.call(this);
	if (this._getBoard()?.name !== "USB_HUB_BOARD" || !this.schematic_group_id)
		return;
	const schematicGroup = this.root?.db.schematic_group.get(
		this.schematic_group_id,
	);
	const subcircuit_id = this.getSubcircuit().subcircuit_id;
	if (!schematicGroup || schematicGroup.subcircuit_id || !subcircuit_id) return;
	this.root?.db.schematic_group.update(this.schematic_group_id, {
		subcircuit_id,
	});
};