Skip to content

Commit

Permalink
Parametrically generate microcontrollers
Browse files Browse the repository at this point in the history
  • Loading branch information
rianadon committed Dec 13, 2023
1 parent 0448854 commit 555c5a6
Show file tree
Hide file tree
Showing 11 changed files with 44,694 additions and 6 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ You'll likely have an STL file of the part that goes into the socket. Follow the

> The working name of Cosmos was Cuttleform, named after the Cuttlefish. Cuttlefish are pretty adaptable!
### Contributing Microcontrollers

1. Add the microcontroller name to the `SpecificCuttleform` interface in `src/lib/worker/config.ts`. There's no standard for naming yet.
2. Add configuration for the microcontroller in `src/lib/geometry/microcontrollers.ts`. You'll need to give the microcontroller a nicely formatted name, size (width x height x thickness), bounding box height (set this to about how tall the components stick up from the bottom of the microcontroller), offset (set x and y to zero, and z is set to the distance between the center of the connector & the bottom of the microcontroller), and how far in the cutouts go so that pins are accessible.
3. Make a model for the microcontroller. You can parametrically generate a board model by editing `src/model_gen/parts.ts` then run `make parts`. You don't need to specify much, since the parametric generator uses the size properties you previously configured. Alternatively, if you have a STL file, you'll need to convert it to GLB and put it in `src/assets` (I use Blender for this). Follow the following conventions: the board's short edge is the X axis, the long edge is the Y axis, and the top of the board faces +Z. The board should be centered on the X axis and the side with the connector should be touching the X axis (Y=0), so that most of the board is below the X axis (Y < 0). The bottom of the microcontroller should touching the XY plane. Make sure to export with "Y axis up" unchecked.
4. Edit `src/lib/loaders/boardElement.ts` and add the model url to `MICROCONTROLLER_URLS`. The glb file will be placed in `target` or `src/assets` depending on whether you autogenerated the board or not.
5. Edit `src/proto/cuttleform.proto` to add the microcontroller to the UI. You'll also need to edit `MAP_MICROCONTROLLER` in `src/lib/worker/config.ts`.
6. To auto-assign a specific connector when choosing the microcontroller in basic mode, edit `caseChange` in `src/routes/beta/lib/editor/VisualEditor.svelte`.

## Hand Scanning

The code is at [`src/routes/scan`](https://github.com/rianadon/Cosmos-Keyboards/tree/main/src/routes/scan). Most of the processing happens in [`lib/hand.ts`](https://github.com/rianadon/Cosmos-Keyboards/tree/main/src/routes/scan/lib/hand.ts).
Expand Down
Loading

0 comments on commit 555c5a6

Please sign in to comment.