Skip to content

Commit e126f6c

Browse files
committed
rgb enable button to toggle the feature, display of serial boards in the overview, directpinindex is now called key index and matrix position is removed, keycaps now render the text in the correct size, added some rgb keycodes to the keycap display helper
1 parent a95cf99 commit e126f6c

File tree

12 files changed

+89
-48
lines changed

12 files changed

+89
-48
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pog",
3-
"version": "1.1.9",
3+
"version": "1.2.0",
44
"license": "MIT",
55
"description": "A KMK firmware configurator",
66
"main": "./out/main/index.js",

src/main/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ export const connectSerialKeyboard = async (keyboard) => {
382382
console.log('keyboard info', chunk)
383383
}
384384
} catch (e) {
385-
console.log('not a proper json command, moving to simple commands', e, data, data.toString())
385+
// console.log('not a proper json command, moving to simple commands', e, data, data.toString())
386386
}
387387

388388
// pinging for next chunk

src/main/saveConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export const saveConfiguration = (data: string) => {
1919
const { pogConfig, serial, overwriteFiles, writeFirmware } = JSON.parse(data)
2020
if (serial) {
2121
// write by serial to current keyboard
22-
console.log('writing firmware vio usb serial')
23-
writePogConfViaSerial(JSON.stringify(pogConfig, null, 4))
22+
console.log('writing firmware via usb serial')
23+
writePogConfViaSerial(JSON.stringify(pogConfig, null, 0))
2424
} else {
2525
// write pog.json
2626
console.log('writing firmware via usb files', 'overwriting Firmware:', writeFirmware)

src/renderer/src/components/CoordMap.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ const keyboardlayout = computed(() => {
157157
keys.value.forEach((row, rowindex) => {
158158
row.forEach((key, kindex) => {
159159
if (key === 'spc') return
160-
realKeys.push(new Key({ x: kindex, y: rowindex, directPinIndex: globalkeyindex }))
160+
realKeys.push(new Key({ x: kindex, y: rowindex, idx: globalkeyindex }))
161161
globalkeyindex++
162162
})
163163
})

src/renderer/src/components/KeyCap.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const action = computed(() => {
143143
if (props.mode === 'layout') return //String(props.keyData.matrix)
144144
let keyIndex = 0
145145
146-
keyIndex = props.keyData.directPinIndex
146+
keyIndex = props.keyData.coordMapIndex
147147
if (!props.keymap[selectedLayer.value]) return 'l missing'
148148
const keyCode = props.keymap[selectedLayer.value][keyIndex]
149149
// resolve readable character
@@ -344,6 +344,8 @@ const fixLabelWidth = () => {
344344
const label = keyElem.value.querySelector('.keylabel-main')
345345
const labels = keyElem.value.querySelector('.keylabels')
346346
if (label) {
347+
console.log("fixing label width")
348+
label.style.transform = `scale(1)`
347349
const labelWidth = label.getBoundingClientRect().width
348350
const wrapperWidth = labels.getBoundingClientRect().width
349351
const scaling = Math.min(wrapperWidth / labelWidth, 1)

src/renderer/src/components/KeyLayoutInfo.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
</div>
8989
</div>
9090
</div>
91-
<template v-if="keyboardStore.wiringMethod === 'matrix'">
91+
<template v-if="keyboardStore.wiringMethod === 'matrix' && false ">
9292
<p class="mt-2 text-sm" :class="{ 'text-error': matrixValid }">Matrix</p>
9393
<div class="flex gap-2">
9494
<div class="keydata-input-group">
@@ -114,8 +114,8 @@
114114
</div>
115115
</template>
116116
<div>
117-
<p>Direct Pin Index</p>
118-
<input v-model="tmpKey.directPinIndex" type="text" class="keyinfo-input" @change="updateKey" />
117+
<p>Key Index <span class="text-xs">(from CoordMap)</span></p>
118+
<input v-model="tmpKey.coordMapIndex" type="text" class="keyinfo-input" @change="updateKey" />
119119
</div>
120120
<div>
121121
<p>Encoder Index</p>
@@ -178,7 +178,7 @@ const tmpKey = ref<{
178178
d: boolean | ''
179179
matrix: (number | '')[]
180180
variant: (number | '')[]
181-
directPinIndex?: number | ''
181+
coordMapIndex?: number | ''
182182
encoderIndex?: number | ''
183183
r: number | ''
184184
rx: number | ''
@@ -195,7 +195,7 @@ const tmpKey = ref<{
195195
d: false,
196196
matrix: ['', ''],
197197
variant: ['', ''],
198-
directPinIndex: '',
198+
coordMapIndex: '',
199199
encoderIndex: '',
200200
r: 0,
201201
rx: 0,
@@ -252,7 +252,7 @@ const updateSelectedKey = () => {
252252
tmpKey.value = {
253253
matrix: ['', ''],
254254
variant: ['', ''],
255-
directPinIndex: '',
255+
coordMapIndex: '',
256256
encoderIndex: '',
257257
x2: '',
258258
x: '',
@@ -293,9 +293,9 @@ const updateKey = () => {
293293
if (tmpKey.value.r !== '') props.layout[keyIndex].r = Number(tmpKey.value.r)
294294
if (tmpKey.value.rx !== '') props.layout[keyIndex].rx = Number(tmpKey.value.rx)
295295
if (tmpKey.value.ry !== '') props.layout[keyIndex].ry = Number(tmpKey.value.ry)
296-
if (tmpKey.value.directPinIndex !== '' && !isNaN(tmpKey.value.directPinIndex as any))
297-
props.layout[keyIndex].directPinIndex = Number(tmpKey.value.directPinIndex)
298-
else props.layout[keyIndex].directPinIndex = ""
296+
if (tmpKey.value.coordMapIndex !== '' && !isNaN(tmpKey.value.coordMapIndex as any))
297+
props.layout[keyIndex].coordMapIndex = Number(tmpKey.value.coordMapIndex)
298+
else props.layout[keyIndex].coordMapIndex = ""
299299
if (tmpKey.value.encoderIndex !== '' && !isNaN(Number(tmpKey.value.encoderIndex)))
300300
props.layout[keyIndex].encoderIndex = Number(tmpKey.value.encoderIndex)
301301
else props.layout[keyIndex].encoderIndex = undefined

src/renderer/src/components/KmkInstaller.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
<a class="link" href="https://circuitpython.org/downloads" target="_blank">circuit python</a>
1010
on your controller
1111
</p>
12+
<p>
13+
info: this does not work when the controller is only connected via the serial port (and not as mounted usb drive)
14+
</p>
1215
<p v-if="!keyboardStore.firmwareInstalled">
1316
You can let kmk automatically install to this keyboard
1417
<span class="font-mono">{{ keyboardStore.path }}</span>
Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
<template>
22
<div>
3-
<div class="flex items-center gap-4 mb-2">
4-
<label>RGB Pin</label>
5-
<input
6-
type="text"
7-
class="input input-bordered input-sm"
8-
v-model="rgbPin"
9-
placeholder="board.GP3"
10-
@change="savePin"
11-
/>
12-
</div>
13-
<div class="flex items-center gap-4">
14-
<label>RGB Number of LEDS</label>
15-
<input
16-
type="text"
17-
class="input input-bordered input-sm"
18-
v-model="rgbNumLeds"
19-
placeholder="14"
20-
@change="saveNumLeds"
21-
/>
22-
</div>
3+
<label class="flex gap-4">
4+
<input class="checkbox" type="checkbox" v-model="rgbEnabled" @change="toggleRgbEnabled">
5+
<p>Enable RGB</p>
6+
</label>
7+
<p class="p-4 my-4 rounded bg-base-300">info: to enable rgb you also will need a neopixel.mpy file in the lib folder on your circuit python drive. you
8+
can download that here:
9+
<a href="https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/releases">Adafruit GitHub</a></p>
10+
<div class="flex items-center gap-4 mb-2">
11+
<label>RGB Pin</label>
12+
<input
13+
type="text"
14+
class="input input-bordered input-sm"
15+
v-model="rgbPin"
16+
placeholder="board.GP3"
17+
@change="savePin"
18+
/>
19+
</div>
20+
<div class="flex items-center gap-4">
21+
<label>RGB Number of LEDS</label>
22+
<input
23+
type="text"
24+
class="input input-bordered input-sm"
25+
v-model="rgbNumLeds"
26+
placeholder="14"
27+
@change="saveNumLeds"
28+
/>
29+
</div>
2330
</div>
2431
</template>
2532

@@ -29,10 +36,12 @@ import {onMounted, ref} from "vue";
2936
3037
const rgbPin = ref('')
3138
const rgbNumLeds = ref('')
39+
const rgbEnabled = ref(false)
3240
3341
onMounted(() => {
3442
rgbPin.value = keyboardStore.rgbPin
3543
rgbNumLeds.value = String(keyboardStore.rgbNumLeds)
44+
rgbEnabled.value = keyboardStore.kbFeatures.some((feature) => feature.toLowerCase() === 'rgb')
3645
})
3746
3847
const savePin = () => {
@@ -43,6 +52,15 @@ const saveNumLeds = () => {
4352
keyboardStore.rgbNumLeds = Number(rgbNumLeds.value)
4453
}
4554
55+
const toggleRgbEnabled = () => {
56+
if (keyboardStore.kbFeatures.some((feature) => feature.toLowerCase() === 'rgb')) {
57+
keyboardStore.kbFeatures = keyboardStore.kbFeatures.filter(
58+
(feature) => feature.toLowerCase() !== 'rgb'
59+
)
60+
} else {
61+
keyboardStore.kbFeatures.push('rgb')
62+
}
63+
}
4664
</script>
4765

4866
<style lang="scss" scoped></style>

src/renderer/src/components/debug.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
<button class="btn-sm btn" @click="enterRepl">enter REPL</button>
3232
<button class="btn-sm btn" @click="exitRepl">exit REPL</button>
3333
</div>
34+
<div class="mt-4" v-if="false">
35+
<p>we can load some info from the controller to know what features it offers</p>
36+
<buttom class="btn">check which pins the controller has</buttom>
37+
</div>
3438
</div>
3539
</template>
3640

src/renderer/src/helpers/index.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,18 @@ export const renderLabel = (keycode: string) => {
308308
send_string: { label: 'String' },
309309
RESET: { label: 'Reset' },
310310
RELOAD: { label: 'Reload' },
311-
DEBUG: { label: 'Debug' }
312-
311+
DEBUG: { label: 'Debug' },
312+
RGB_TOG: { label: 'Toggle<br/>RGB' },
313+
RGB_HUI: { label: 'RGB<br/>Hue +' },
314+
RGB_HUD: { label: 'RGB<br/>Hue -' },
315+
RGB_SAI: { label: 'RGB<br/>Sat +' },
316+
RGB_SAD: { label: 'RGB<br/>Sat -' },
317+
RGB_ANI: { label: 'RGB<br/>Animation +' },
318+
RGB_AND: { label: 'RGB<br/>Animation -' },
319+
RGB_MODE_SWIRL: { label: 'RGB<br/>Swirl' },
320+
RGB_MODE_PLAIN: { label: 'RGB<br/>Plain' },
321+
RGB_MODE_KNIGHT: { label: 'RGB<br/>Knight' },
322+
RGB_MODE_RAINBOW: { label: 'RGB<br/>Rainbow' },
313323
}
314324

315325
const keylabel: {

0 commit comments

Comments
 (0)