shibosoftwaredev/f1c100s-linux-nema17-stepper-controller
A four-layer NEMA 17 motor-controller PCB combining an Allwinner F1C100S Linux computer, USB‑PD/buck power system, W5500 Ethernet, STM32 real-time motion control, DRV8825 stepper driver, protection/temperature/current telemetry, USB interfaces, and local LED/buzzer diagnostics.
- Version
- 0.4.56
- License
- unset
- Stars
- 0
routing-signature.ts
/** Geometry/connectivity that a saved routing solution is allowed to use. */
export function routingSignature(circuit: any[]) {
const types = new Set([
"pcb_board", "pcb_component", "pcb_port", "pcb_smtpad", "pcb_plated_hole", "pcb_hole",
"source_trace", "source_component_internal_connection",
])
const omit = new Set([
"subcircuit_connectivity_map_key", "pcb_group_id", "source_group_id",
"display_offset_x", "display_offset_y", "position_mode", "positioned_relative_to_pcb_group_id",
"cable_insertion_center", "covered_with_solder_mask", "is_covered_with_solder_mask",
"display_name", "name", "max_length", "max_via_count",
])
const normalize = (value: any): any => {
if (typeof value === "number") return Math.round(value * 1e6) / 1e6
if (Array.isArray(value)) return value.map(normalize)
if (value && typeof value === "object") return Object.fromEntries(Object.keys(value)
.filter(key => !omit.has(key) && value[key] !== undefined).sort()
.map(key => [key, normalize(value[key])]))
return value
}
return circuit.filter(element => types.has(element.type)).map(normalize)
.sort((a,b) => {
const left = `${a.type}:${a[a.type + "_id"]}`
const right = `${b.type}:${b[b.type + "_id"]}`
return left < right ? -1 : left > right ? 1 : 0
})
}