From a3a99cb688506767d78b170d8b5b10a4811dee23 Mon Sep 17 00:00:00 2001 From: Scott Olson Date: Mon, 6 Jan 2025 23:02:16 -0600 Subject: [PATCH 1/3] Add 43mm trackball variant --- src/lib/geometry/socketsParts.ts | 11 ++++++----- src/lib/loaders/parts.ts | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/geometry/socketsParts.ts b/src/lib/geometry/socketsParts.ts index e6b620f..b15b4ab 100644 --- a/src/lib/geometry/socketsParts.ts +++ b/src/lib/geometry/socketsParts.ts @@ -409,12 +409,12 @@ export const PART_INFO: Record = { }, 'trackball': { partName: 'Trackball', - bomName: (v: Variant) => `${v.size || '25/34/55mm'} Trackballs`, + bomName: (v: Variant) => `${v.size || '25/34/43/55mm'} Trackballs`, category: 'Trackballs & Trackpads', stepFile: '/target/key-trackball.step', partOverride: '/target/switch-trackball.glb', socketSize: (v: Variant) => ({ - radius: { '25mm': 16.4, '34mm': 20.9, '55mm': 31.4 }[v.size as TrackballVariant['size']], + radius: { '25mm': 16.4, '34mm': 20.9, '43mm': 25.4, '55mm': 31.4 }[v.size as TrackballVariant['size']], height: 4, sides: 20, }), @@ -424,16 +424,17 @@ export const PART_INFO: Record = { const pcbHeight = { 'Joe (QMK)': 21.3, 'Skree (ZMK)': 24 }[v.sensor as TrackballVariant['sensor']] if (v.size == '25mm') return [box(pcbWidth, pcbHeight, 23.8), box(16, 11, 26.3)] + if (v.size == '43mm') return [box(pcbWidth, pcbHeight, 33.0), box(16, 11, 35.6)] if (v.size == '55mm') return [box(pcbWidth, pcbHeight, 38.8), box(16, 11, 41.3)] return [box(pcbWidth, pcbHeight, 28.3), box(16, 11, 30.8)] // 34mm variant }, variants: { - size: ['25mm', '34mm', '55mm'], + size: ['25mm', '34mm', '43mm', '55mm'], bearings: ['Roller', 'Ball', 'BTU (7.5mm)', 'BTU (9mm)'], sensor: ['Joe (QMK)', 'Skree (ZMK)'], }, encodeVariant: (variant: Variant) => { - const size = ['34mm', '25mm', '55mm'].indexOf(variant.size) + const size = ['34mm', '25mm', '43mm', '55mm'].indexOf(variant.size) const bearings = ['Roller', 'Ball', 'BTU (7.5mm)', 'BTU (9mm)'].indexOf(variant.bearings) const sensor = ['Joe (QMK)', 'Skree (ZMK)'].indexOf(variant.sensor) return size + (bearings << 3) + (sensor << 6) @@ -443,7 +444,7 @@ export const PART_INFO: Record = { const bearings = (variant >> 3) & 0x7 const sensor = (variant >> 6) & 0x3 return { - size: ['34mm', '25mm', '55mm'][size] || '34mm', + size: ['34mm', '25mm', '43mm', '55mm'][size] || '34mm', bearings: ['Roller', 'Ball', 'BTU (7.5mm)', 'BTU (9mm)'][bearings] || 'Roller', sensor: ['Joe (QMK)', 'Skree (ZMK)'][sensor] || 'Joe (QMK)', } diff --git a/src/lib/loaders/parts.ts b/src/lib/loaders/parts.ts index a154d5a..2ab9888 100644 --- a/src/lib/loaders/parts.ts +++ b/src/lib/loaders/parts.ts @@ -13,6 +13,7 @@ type Switch = CuttleKey['type'] export async function partGeometry(type: Switch, variant: Record = {}) { if (type == 'trackball' && !(variant?.bearings.includes('BTU'))) { if (variant?.size == '55mm') return new SphereGeometry(27.5, 64, 32).translate(0, 0, -4) + if (variant?.size == '43mm') return new SphereGeometry(21.5, 64, 32).translate(0, 0, -4) if (variant?.size == '34mm') return new SphereGeometry(17, 64, 32).translate(0, 0, -4) if (variant?.size == '25mm') return new SphereGeometry(12.5, 64, 32).translate(0, 0, -4) } From 01db8646bb2082fe8a01776ce00649f417d4bb95 Mon Sep 17 00:00:00 2001 From: Scott Olson Date: Mon, 6 Jan 2025 23:19:47 -0600 Subject: [PATCH 2/3] Keep existing indexes --- src/lib/geometry/socketsParts.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/geometry/socketsParts.ts b/src/lib/geometry/socketsParts.ts index b15b4ab..b1286dd 100644 --- a/src/lib/geometry/socketsParts.ts +++ b/src/lib/geometry/socketsParts.ts @@ -429,12 +429,12 @@ export const PART_INFO: Record = { return [box(pcbWidth, pcbHeight, 28.3), box(16, 11, 30.8)] // 34mm variant }, variants: { - size: ['25mm', '34mm', '43mm', '55mm'], + size: ['25mm', '34mm', '55mm', '43mm'], bearings: ['Roller', 'Ball', 'BTU (7.5mm)', 'BTU (9mm)'], sensor: ['Joe (QMK)', 'Skree (ZMK)'], }, encodeVariant: (variant: Variant) => { - const size = ['34mm', '25mm', '43mm', '55mm'].indexOf(variant.size) + const size = ['34mm', '25mm', '55mm', '43mm'].indexOf(variant.size) const bearings = ['Roller', 'Ball', 'BTU (7.5mm)', 'BTU (9mm)'].indexOf(variant.bearings) const sensor = ['Joe (QMK)', 'Skree (ZMK)'].indexOf(variant.sensor) return size + (bearings << 3) + (sensor << 6) From a01a014c4addb07441e840bbac01000715c663b9 Mon Sep 17 00:00:00 2001 From: Scott Olson Date: Mon, 6 Jan 2025 23:20:43 -0600 Subject: [PATCH 3/3] Keep existing indexes for all of the arrays --- src/lib/geometry/socketsParts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/geometry/socketsParts.ts b/src/lib/geometry/socketsParts.ts index b1286dd..f74d3b8 100644 --- a/src/lib/geometry/socketsParts.ts +++ b/src/lib/geometry/socketsParts.ts @@ -444,7 +444,7 @@ export const PART_INFO: Record = { const bearings = (variant >> 3) & 0x7 const sensor = (variant >> 6) & 0x3 return { - size: ['34mm', '25mm', '43mm', '55mm'][size] || '34mm', + size: ['34mm', '25mm', '55mm', '43mm'][size] || '34mm', bearings: ['Roller', 'Ball', 'BTU (7.5mm)', 'BTU (9mm)'][bearings] || 'Roller', sensor: ['Joe (QMK)', 'Skree (ZMK)'][sensor] || 'Joe (QMK)', }