zmk_build

ZMK code & build repository
git clone https://git.pngu.org/zmk_build
Log | Files | Refs | Submodules | README

commit 3180649f051315b1346b0a2ee5de401370794115
parent db727a2a8f11d4bc902962758e8fa55da900c4fd
Author: Jack Sangdahl <0x6A73@pm.me>
Date:   Sat, 24 Feb 2024 20:52:07 -0700

build script improvements

Diffstat:
Mbuild.sh | 35++++++++++++++++++++---------------
Mreadme.md | 4++--
2 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/build.sh b/build.sh @@ -1,33 +1,35 @@ #!/bin/sh ZMK_DIR=~/waffle_git/zmk +RED=$(tput setaf 1) +YELLOW=$(tput setaf 3) +GREEN=$(tput setaf 2) +BLUE=$(tput setaf 4) +BOLD=$(tput bold) +NORMAL=$(tput sgr0) source $ZMK_DIR/.venv/bin/activate build() { - printf "building $1 for $2...\n" + printf "building $GREEN$1$NORMAL for $BLUE$2$NORMAL...\n" (cd $ZMK_DIR/app west build -p always -b $2 -- -DSHIELD=$1 \ -DZMK_CONFIG="$HOME/waffle_git/zmk-build/config" \ &> /dev/null - read -p "flash? (y/n) " yn + read -p "${BOLD}flash? (y/n) $NORMAL" yn case $yn in [Yy]*) - printf "enter bootloader...\n" - mkdir tmp - sleep 10 - doas mount /dev/sdb tmp - doas cp build/zephyr/zmk.uf2 tmp - doas umount /dev/sdb - rmdir tmp + printf "${YELLOW}enter bootloader$NORMAL...\n" + sleep 5 + west flash ;; [Nn]*) cp build/zephyr/zmk.uf2 ~/$1.uf2 ;; - * ) printf "invalid entry\n" ;; + * ) printf "${RED}invalid entry$NORMAL\n" ;; esac ) - printf "complete\n" + printf "${GREEN}complete$NORMAL\n" } -printf "firmware to build...\n" +printf "${BOLD}firmware to build...$NORMAL\n" printf "(1) corne\t(2) revxlp\t(3) sweep\t(4) settings reset:\t" read opt; case $opt in @@ -36,6 +38,9 @@ case $opt in build corne_right nice_nano_v2 ;; 2) + if [ ! -L $ZMK_DIR/app/boards/shields/revxlp ]; then + ln -sv revxlp $ZMK_DIR/app/boards/shields/revxlp + fi build revxlp seeeduino_xiao_ble ;; 3) @@ -43,16 +48,16 @@ case $opt in build splitkb_aurora_sweep_right nice_nano_v2 ;; 4) - printf "select microcontroller...\n" + printf "${BOLD}select microcontroller...$NORMAL\n" printf "(1) nice nano\t(2) nice nano v2\t(3) xiao ble:\t" read val; case $val in 1) MCU="nice_nano" ;; 2) MCU="nice_nano_v2" ;; 3) MCU="seeeduino_xiao_ble" ;; - *) printf "invalid entry\n" ;; + *) printf "${RED}invalid entry$NORMAL\n" ;; esac build settings_reset $MCU ;; - *) printf "invalid entry\n" ;; + *) printf "${RED}invalid entry$NORMAL\n" ;; esac diff --git a/readme.md b/readme.md @@ -1,10 +1,10 @@ ### zmk build repository -my [zmk](https://zmk.dev) configuration & keyboard code! +my [zmk](https://zmk.dev) configuration & keyboard code ![keyboard](https://i.imgur.com/bCRPsDyh.jpg) ### misc * [`util.h`](util.h) contains some simple c macros for combos, 2-key tap dance, & home-row mods. -* [`build.sh`](build.sh) is a (convoluted) script to build and flash firmware using a local build environment.\ +* [`build.sh`](build.sh) is an interactive script to build and flash firmware using a local build environment.\ coincidentally, my primary zmk keyboards use an identical layout, so the necessary files can be temporarily copied over at build time * **layout** is near identical to my layout [here (keymapdb)](https://keymapdb.com/keymaps/waffle87), sans a couple things like unicode.