Skip to content

Commit 2924ea6

Browse files
committed
locking to kmk version for more stability when in auto setup. resources for keycodes and kmk docs, switched oneshot to stickykeys
1 parent dec9618 commit 2924ea6

File tree

4 files changed

+37
-22
lines changed

4 files changed

+37
-22
lines changed

src/main/kmkUpdater.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,11 @@ import decompress from 'decompress'
55
import { mainWindow } from './index'
66

77
// downloads kmk to app storage
8-
export const updateFirmware = () => {
9-
console.log(appDir)
10-
downloadFile(
11-
'https://github.com/KMKfw/kmk_firmware/archive/refs/heads/main.zip',
12-
appDir + 'kmk.zip'
13-
)
14-
}
15-
16-
// download kmk and copy it to the keyboard
17-
export const downloadFile = async (file_url, targetPath) => {
8+
export const updateFirmware = async () => {
9+
const versionSha = 'f6346937d865f7e1f6baaae93ae5c9be935aae75'
10+
console.log('updating kmk firmware', appDir, versionSha)
11+
const file_url = `https://github.com/KMKfw/kmk_firmware/archive/${versionSha}.zip`
12+
const targetPath = appDir + 'kmk.zip'
1813
if (!fs.existsSync(appDir)) {
1914
fs.mkdirSync(appDir)
2015
}
@@ -73,6 +68,8 @@ export const downloadFile = async (file_url, targetPath) => {
7368
// file copy needs to await the decompression
7469
try {
7570
console.log('moving kmk into keyboard')
71+
// write a file to the keyboard with the version sha
72+
fs.writeFileSync(`${currentKeyboard.path}/kmk/version`, versionSha)
7673
fs.cp(
7774
`${appDir}kmk/kmk_firmware-main/kmk`,
7875
`${currentKeyboard.path}/kmk`,

src/main/pythontemplates/customkeys.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ export const customkeyspy = `# These are yous custom keycodes do any needed impo
33
44
from kmk.keys import KC
55
from kmk.modules.macros import Tap, Release, Press
6+
import microcontroller
67
7-
MyKey = KC.X
8+
# Here you can define your custom keys
9+
# MyKey = KC.X
810
11+
# Builtin macros for use in pog
912
def next_boot_dfu(keyboard):
1013
print('setting next boot to dfu') #serial feedback
11-
import microcontroller
1214
microcontroller.on_next_reset(microcontroller.RunMode.UF2)
1315
1416
DFUMODE = KC.MACRO(next_boot_dfu)
1517
1618
def next_boot_safe(keyboard):
1719
print('setting next boot to safe') #serial feedback
18-
import microcontroller
1920
microcontroller.on_next_reset(microcontroller.RunMode.SAFE_MODE)
2021
SAFEMODE = KC.MACRO(next_boot_safe)
2122
2223
def toggle_drive(keyboard):
2324
print('toggling usb drive') #serial feedback
24-
import microcontroller
2525
if microcontroller.nvm[0] == 0:
2626
microcontroller.nvm[0] = 1
2727
else:

src/main/pythontemplates/kb.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const kbpy = `# kb.py KB base config - v0.9.8
1+
export const kbpy = `# kb.py KB base config - v1.0.0
22
import board
33
import pog
44
import microcontroller
@@ -22,9 +22,12 @@ class POGKeyboard(KMKKeyboard):
2222
from pog_serial import pogSerial; self.modules.append(pogSerial())
2323
2424
if "oneshot" in features:
25-
from kmk.modules.oneshot import OneShot
26-
self.oneshot = OneShot()
27-
self.modules.append(self.oneshot)
25+
from kmk.modules.sticky_keys import StickyKeys
26+
sticky_keys = StickyKeys()
27+
# optional: set a custom release timeout in ms (default: 1000ms)
28+
# sticky_keys = StickyKeys(release_after=5000)
29+
self.modules.append(sticky_keys)
30+
2831
2932
if "tapdance" in features:
3033
from kmk.modules.tapdance import TapDance
@@ -42,10 +45,10 @@ class POGKeyboard(KMKKeyboard):
4245
self.combos = Combos()
4346
self.modules.append(self.combos)
4447
45-
if "macros" in features:
46-
from kmk.modules.macros import Macros
47-
self.macros = Macros()
48-
self.modules.append(self.macros)
48+
# if "macros" in features:
49+
from kmk.modules.macros import Macros
50+
self.macros = Macros()
51+
self.modules.append(self.macros)
4952
5053
# TODO: not tested yet
5154
if "capsword" in features:

src/renderer/src/components/KeyPicker.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@
163163
>App/Media/Mouse</a
164164
>
165165
<a class="tab" :class="{ 'tab-active': category === 'rgb' }" @click="category = 'rgb'">RGB</a>
166+
<a class="tab" :class="{ 'tab-active': category === 'advanced' }" @click="category = 'advanced'"
167+
>Advanced & Help</a
168+
>
166169
</div>
167170
<div class="key-chooser">
168171
<div v-if="category === 'basic'" class="bonus">
@@ -282,6 +285,18 @@
282285
<div class="key" @click="setKey('KC.RGB_HUD')">RGB Hue decrease</div>
283286
</div>
284287
</div>
288+
<div v-if="category === 'advanced'">
289+
<p>you can build way more advanced things with custom keys here are some resources, for some you might need to edit the kb.py file or enable a keyboard feature. when testing these check the output of the REPL for errors
290+
</p>
291+
<ul>
292+
<li><a class="text-primary" href="https://github.com/KMKfw/kmk_firmware/blob/main/docs/en/macros.md">Macros</a> KC.MACRO("send a string")</li>
293+
<li><a class="text-primary" href="https://github.com/KMKfw/kmk_firmware/blob/main/docs/en/keycodes.md">Keycodes</a> List of all keys</li>
294+
<li><a class="text-primary" href="https://github.com/KMKfw/kmk_firmware/blob/main/docs/en/layers.md">Layers</a> How layers work</li>
295+
<li><a class="text-primary" href="https://github.com/KMKfw/kmk_firmware/blob/main/docs/en/combos.md">Combos</a> Multiple keys pressed at simultaneously output a different key</li>
296+
<li><a class="text-primary" href="https://github.com/KMKfw/kmk_firmware/blob/main/docs/en/holdtap.md">Holdtap</a> Holding a key down for longer than a certain amount of time outputs a different key</li>
297+
<li><a class="text-primary" href="https://github.com/KMKfw/kmk_firmware/blob/main/docs/en/combo_layers.md">Combo Layers</a> pressing 2 layer keys at once opens a different layer</li>
298+
</ul>
299+
</div>
285300
</div>
286301
</template>
287302

0 commit comments

Comments
 (0)