Skip to content

Commit

Permalink
Merge branch 'KinesisCorporation:V3.0' into V3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderdrummer authored Nov 22, 2023
2 parents 0465016 + d0ffaf8 commit 1b7eff4
Show file tree
Hide file tree
Showing 11 changed files with 148 additions and 17 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get version data
id: get_info
run: |
timestamp=$(date +"%Y%m%d%H%M")
commit=$(echo "${{ github.sha }}" | cut -c1-7)
file_prefix=$timestamp-$commit
branch_name=$(echo "${{ github.ref }}" | awk -F'/' '{print $3}' | cut -c1-4)
echo "file_prefix=$file_prefix" >> $GITHUB_OUTPUT
bin/get_version.sh $branch_name $commit
- name: Cache west modules
uses: actions/cache@v3
env:
Expand Down Expand Up @@ -42,11 +51,11 @@ jobs:
- name: Adv360 Right Kconfig file
run: grep -vE '(^#|^$)' build/right/zephyr/.config
- name: Rename zmk.uf2
run: cp build/left/zephyr/zmk.uf2 left.uf2 && cp build/right/zephyr/zmk.uf2 right.uf2
run: cp build/left/zephyr/zmk.uf2 ${{ steps.get_info.outputs.file_prefix }}-left.uf2 && cp build/right/zephyr/zmk.uf2 ${{ steps.get_info.outputs.file_prefix }}-right.uf2
- name: Archive (Adv360)
uses: actions/upload-artifact@v3
with:
name: firmware
path: |
left.uf2
right.uf2
${{ steps.get_info.outputs.file_prefix }}-left.uf2
${{ steps.get_info.outputs.file_prefix }}-right.uf2
42 changes: 37 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# Changelog
Here's all notable changes and commits to both the configuration repo and the base ZMK that the config repo builds against.
Here's all notable changes and commits to both the configuration repo and the base ZMK that the config repo builds against.

Many thanks to all those who have submitted issues and pull requests to make this firmware better!
## Config repo

11/16/2023 - Update changelog with base ZMK update [#268](https://github.com/KinesisCorporation/Adv360-Pro-ZMK/pull/268)

11/15/2023 - Add and document the new automatic versioning system [#267](https://github.com/KinesisCorporation/Adv360-Pro-ZMK/pull/267)

11/7/2023 - Add and document a new configuration option for extended NKRO ranges [#264](https://github.com/KinesisCorporation/Adv360-Pro-ZMK/pull/264)

11/2/2023 - Update the documentation to note the new configuration options, other miscellaneous improvements based on feedback [#260](https://github.com/KinesisCorporation/Adv360-Pro-ZMK/pull/260)

10/30/2023 - Update the [settings_reset.uf2](/settings-reset.uf2) file to improve reset behaviour with the new update

10/20/2023 - Disable BLE privacy due to conflict, disable BLE battery reporting, change to point to new ZMK branch with minor update. Please note that due to the minor update the boards will need the [settings_reset.uf2](/settings-reset.uf2) file flashing onto each side prior to updating [#248](https://github.com/KinesisCorporation/Adv360-Pro-ZMK/pull/248) (adv360-z3.2-2)

10/9/2023 - Further documentation refinements, add section on beta testing, document BLE privacy [#241](https://github.com/KinesisCorporation/Adv360-Pro-ZMK/pull/241)

10/9/2023 - Change build actions to fix warnings from shellcheck [#242](https://github.com/KinesisCorporation/Adv360-Pro-ZMK/pull/242)
Expand Down Expand Up @@ -67,13 +79,33 @@ Many thanks to all those who have submitted issues and pull requests to make thi

## Base ZMK

There have beeen 3 mainline branches of ZMK used for the 360 Pro so far. Beta branches are not changelogged as they are subject to frequent changes and tweaks.
There have beeen 4 branches of ZMK used for the 360 Pro so far. Beta branches are not changelogged as they are subject to frequent changes and tweaks.

| Branch | Date From | Date To | Config Branch |
| -------- | ------- |-------|-----|
| [adv360-beta](https://github.com/ReFil/zmk/tree/adv360-beta) | 3/1/2022 | 9/17/2022 | V1.0 (since deleted) |
| [adv360-z3](https://github.com/ReFil/zmk/tree/adv360-z3) | 9/17/2022 | 7/6/2023 | [V2.0](https://github.com/KinesisCorporation/Adv360-Pro-ZMK/tree/V2.0) |
| [adv360-z3.2](https://github.com/ReFil/zmk/tree/adv360-z3.2) | 7/6/2023 | To date | [V3.0](https://github.com/KinesisCorporation/Adv360-Pro-ZMK/tree/V3.0) |
| [adv360-z3](https://github.com/ReFil/zmk/tree/adv360-z3) | 9/17/2022 | 7/6/2023 | V2.0 (since deleted) |
| [adv360-z3.2](https://github.com/ReFil/zmk/tree/adv360-z3.2) | 7/6/2023 | 20/10/2023 | [V3.0](https://github.com/KinesisCorporation/Adv360-Pro-ZMK/tree/V3.0) (Up to commit 82494e7) |
| [adv360-z3.2-2](https://github.com/ReFil/zmk/tree/adv360-z3.2-2) | 20/10/2023 | To date | [V3.0](https://github.com/KinesisCorporation/Adv360-Pro-ZMK/tree/V3.0) (current) |


### adv360-z3.2-2

11/16/2023 - Fix race condition in the bluetooth code causing issues with split connectivity

11/7/2023 - Put HID max NKRO usage on a config option for compatibility (`CONFIG_ZMK_HID_KEYBOARD_EXTENDED_REPORT`)

11/1/2023 - Increase behaviour queue size to permit longer macro sequences to be run

11/1/2023 - Change order of RGB initialisation to prevent situations where lighting could get stuck in battery reporting mode

10/27/2023 - Change HID max NKRO usage to allow usage of F13-F24 and other rarely used keycodes with NKRO enabled

10/18/2023 - Disable saving certain RGB elements to flash memory to help with flash wear

10/18/2023 - Re-enable BLE battery reporting in code (now disabled in config repo using the `CONFIG_BT_BAS` KConfig option)

10/18/2023 - Merge latest upstream ZMK (Commit 7fe9ecd8)

### adv360-z3.2

Expand Down Expand Up @@ -111,7 +143,7 @@ There have beeen 3 mainline branches of ZMK used for the 360 Pro so far. Beta br

10/2/2022 - Add ability to scale RGB and backlight brightness to improve battery life

9/13/2022 - Add custom lighting functionality on top of base ZMK
9/13/2022 - Add custom lighting functionality on top of base ZMK

9/12/2022 - Merge HID indicators pull request [#999](https://github.com/zmkfirmware/zmk/pull/999) atop of base ZMK

Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
DOCKER := $(shell { command -v podman || command -v docker; })
TIMESTAMP := $(shell date -u +"%Y%m%d%H%M%S")
TIMESTAMP := $(shell date -u +"%Y%m%d%H%M")
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
detected_OS := $(shell uname) # Classify UNIX OS
ifeq ($(strip $(detected_OS)),Darwin) #We only care if it's OS X
SELINUX1 :=
Expand All @@ -12,11 +13,13 @@ endif
.PHONY: all clean

all:
$(shell bin/get_version.sh >> /dev/null)
$(DOCKER) build --tag zmk --file Dockerfile .
$(DOCKER) run --rm -it --name zmk \
-v $(PWD)/firmware:/app/firmware$(SELINUX1) \
-v $(PWD)/config:/app/config:ro$(SELINUX2) \
-e TIMESTAMP=$(TIMESTAMP) \
-e COMMIT=$(COMMIT) \
zmk

clean:
Expand Down
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,31 @@ Follow the programming instruction on page 8 of the [Quick Start Guide](https://

> Note: There are also physical reset buttons on both keyboards which can be used to enter and exit the bootloader mode. Their location is described in section 2.7 on page 9 in the [User Manual](https://kinesis-ergo.com/wp-content/uploads/Advantage360-ZMK-KB360-PRO-Users-Manual-v3-10-23.pdf) and use is described in section 5.9 on page 14.
> Note: Some operating systems wont always treat the drive as ejected after the settings-reset file is flashed, this doesn't mean that the flashing process has failed.
### Upgrading from V2 to V3

If you are upgrading from V2 to V3, and if the flashing didn't work as expected (i.e. if you are unable to pair the keyboard via Bluetooth), then consider [resetting](https://kinesis-ergo.com/support/kb360pro/#firmware-updates) both halves of the keyboard to its native state. Make sure to use the `settings-reset.uf2` file from
the V3 branch of this repository. After doing this, proceed with the flashing instructions above.
If you encounter a git conflict when updating your repository to V3.0 please follow the instructions on how to resolve it [here](UPGRADE.md).

Updating from V2.0 based firmwares to V3.0 based firmwares can be a rather complex process. There are reset files for every major firmware revision as well as documentation on the update process available [here](https://kinesis-ergo.com/support/kb360pro/#firmware-updates).

## Versioning

Starting on 11/15/2023 the Advantage 360 Pro will now automatically record the compilation date, branch and Git commit hash in a macro that can be accessed with Mod+V. This will type out the following string: YYYYMMDD-XXXX-YYYYYY, where XXXX is the first 4 characters of the Git branch and YYYYYY is the Git commit hash. In addition to this the builds compiled by GitHub actions are now timestamped and also record the commit hash in the filename.

## Bluetooth LE Privacy
By default this firmware ships with BT Privacy enabled (To read more about BT privacy see [this article](https://novelbits.io/how-to-protect-the-privacy-of-your-bluetooth-low-energy-device/)). This was done based off feedback from MacOS users as some Macs and all iOS devices use resolvable private addresses that they cycle between (the Apple documentation can be found [here](https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf#page=194)), and when the host cycled to a new address the Advantage 360 Pro would need re-pairing. It can cause issues with some operating systems and hardware setups. To disable BT Privacy change `CONFIG_BT_PRIVACY=y` to `CONFIG_BT_PRIVACY=n` in [adv360_left_defconfig](config/boards/arm/adv360/adv360_left_defconfig#L52). Disabling this might necessitate re-pairing to the host.

Since the update on 20/10/2023, BLE privacy is now disabled by default and due to an update in upstream ZMK cannot be enabled again as it will cause issues for the split halves connecting to each other.

Recent updates to MacOS have improved the behaviour for devices without BLE privacy and caused regressions with privacy enabled (e.g. being unable to enter the password on the filevault screen) so BLE privacy is not necessary any more.

## N-Key Rollover

By default this keyboard has NKRO enabled, however for compatibility reasons the higher ranges are not enabled. If you want to use F13-F24 or the INTL1-9 keys with NKRO enabled you can change `CONFIG_ZMK_HID_KEYBOARD_EXTENDED_REPORT=n` to `CONFIG_ZMK_HID_KEYBOARD_EXTENDED_REPORT=y` in [adv360_left_defconfig](/config/boards/arm/adv360/adv360_left_defconfig#L65)

## Battery reporting

By default reporting the battery level over BLE is disabled as this can cause some computers to spontaneously wake up repeatedly. If you'd like to enable this functionality change `CONFIG_BT_BAS=n` to `CONFIG_BT_BAS=y` in [adv360_left_defconfig](/config/boards/arm/adv360/adv360_left_defconfig#L58). Please note that a known bug in windows prevents the battery level from updating by default, it is only updated when the board is paired. A workaround is to set `CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION=n` in [adv360_left_defconfig](/config/boards/arm/adv360/adv360_left_defconfig). This may cause unexpected results on other OSes

## Changelog

Expand Down
5 changes: 3 additions & 2 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
set -eu

PWD=$(pwd)
TIMESTAMP="${TIMESTAMP:-$(date -u +"%Y%m%d%H%M%S")}"
TIMESTAMP="${TIMESTAMP:-$(date -u +"%Y%m%d%H%M")}"
COMMIT="${COMMIT:-$(echo xxxxxx)}"

# West Build (left)
west build -s zmk/app -d build/left -b adv360_left -- -DZMK_CONFIG="${PWD}/config"
Expand All @@ -14,4 +15,4 @@ west build -s zmk/app -d build/right -b adv360_right -- -DZMK_CONFIG="${PWD}/con
# Adv360 Right Kconfig file
grep -vE '(^#|^$)' build/right/zephyr/.config
# Rename zmk.uf2
cp build/left/zephyr/zmk.uf2 "./firmware/${TIMESTAMP}-left.uf2" && cp build/right/zephyr/zmk.uf2 "./firmware/${TIMESTAMP}-right.uf2"
cp build/left/zephyr/zmk.uf2 "./firmware/${TIMESTAMP}-${COMMIT}-left.uf2" && cp build/right/zephyr/zmk.uf2 "./firmware/${TIMESTAMP}-${COMMIT}-right.uf2"
57 changes: 57 additions & 0 deletions bin/get_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

# Get the date, first 4 chars of branch name and short commit hash
date=$(date -u +"%Y%m%d")
branch=${1:-$(git rev-parse --abbrev-ref HEAD | cut -c1-4)}
commit=${2:-$(git rev-parse --short HEAD)}

# Function to transform characters to ZMK key behaviours
transform_char() {
local char=$1
if [[ $char =~ [A-Za-z] ]]; then
echo "<&kp ${char^^}>, "
elif [[ $char =~ [0-9] ]]; then
echo "<&kp N${char}>, "
elif [ "$char" = "." ]; then
echo "<&kp DOT>, "
fi
}

# Iterate over the date and format characters
formatted_date=""
for ((i = 0; i < ${#date}; i++)); do
formatted_date+=$(transform_char "${date:$i:1}")
done

# Insert separator between date and branch
formatted_date+="<&kp MINUS>, "

# Iterate over the branch and format characters
formatted_branch=""
for ((i = 0; i < ${#branch}; i++)); do
formatted_branch+=$(transform_char "${branch:$i:1}")
done

# Insert separator between branch and commit hash
formatted_branch+="<&kp MINUS>, "

# Iterate over the commit hash and format characters
formatted_commit=""
for ((i = 0; i < ${#commit}; i++)); do
formatted_commit+=$(transform_char "${commit:$i:1}")
done

# Combine the formatted string, add trailing carriage return
formatted_result="$formatted_date$formatted_branch$formatted_commit"
formatted_result+="<&kp RET>"

echo $formatted_result
# Create new macro to define version, overwrite previous one

echo '#define VERSION_MACRO' > "config/version.dtsi"
echo 'macro_ver: macro_ver {' >> "config/version.dtsi"
echo 'compatible = "zmk,behavior-macro";' >> "config/version.dtsi"
echo 'label = "macro_ver";' >> "config/version.dtsi"
echo '#binding-cells = <0>;' >> "config/version.dtsi"
echo "bindings = $formatted_result;" >> "config/version.dtsi"
echo '};' >> "config/version.dtsi"
11 changes: 10 additions & 1 deletion config/adv360.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@
};
behaviors {
#include "macros.dtsi"
#include "version.dtsi"
#ifndef VERSION_MACRO
macro_ver: macro_ver {
compatible = "zmk,behavior-macro";
label = "macro_version";
#binding-cells = <0>;
bindings = <&kp RET>;
};
#endif

hm: homerow_mods {
compatible = "zmk,behavior-hold-tap";
Expand Down Expand Up @@ -95,7 +104,7 @@
&none &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &none &trans &none &none &none &none &none &none
&none &none &none &none &none &none &bootloader &bootloader &none &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &bt BT_CLR &none &rgb_ug RGB_MEFS_CMD 5 &none &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &none &none &none &none &none
&none &none &none &none &macro_ver &none &none &none &none &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &bl BL_TOG &rgb_ug RGB_TOG &bl BL_INC &bl BL_DEC &none &none &none
>;
};
Expand Down
4 changes: 3 additions & 1 deletion config/boards/arm/adv360/adv360_left_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,20 @@ CONFIG_ZMK_BACKLIGHT_AUTO_OFF_IDLE=y
#BT configuration
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
CONFIG_BT_DIS_MANUF="Kinesis Corporation"
CONFIG_BT_PRIVACY=y
CONFIG_BT_PRIVACY=n
CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=y
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=600
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=12
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=24
CONFIG_BT_PERIPHERAL_PREF_LATENCY=30
CONFIG_BT_BAS=n #Set this to y to enable BLE battery reporting

#Misc configuration
CONFIG_USB_DEVICE_VID=0x29EA
CONFIG_USB_DEVICE_PID=0x0362
CONFIG_USB_DEVICE_MANUFACTURER="Kinesis Corporation"
CONFIG_ZMK_HID_REPORT_TYPE_NKRO=y
CONFIG_ZMK_HID_KEYBOARD_EXTENDED_REPORT=n #Set this to y for F13-F24 and intl keys with NKRO
CONFIG_ZMK_HID_CONSUMER_REPORT_USAGES_BASIC=y
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_ZMK_BATTERY_REPORT_INTERVAL=9999999
Empty file added config/version.dtsi
Empty file.
2 changes: 1 addition & 1 deletion config/west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ manifest:
projects:
- name: zmk
remote: refil
revision: adv360-z3.2
revision: adv360-z3.2-2
import: app/west.yml
self:
path: config
Binary file modified settings-reset.uf2
Binary file not shown.

0 comments on commit 1b7eff4

Please sign in to comment.