Merge branch 'zmkfirmware:main' into sofle-bongo-cat-update

This commit is contained in:
Chatblanc77 2022-10-24 13:19:21 +07:00 committed by GitHub
commit ec0f002f97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 53 deletions

View file

@ -18,8 +18,8 @@ on:
default: "bin" default: "bin"
required: false required: false
type: string type: string
artifact_name: archive_name:
description: 'Artifact output file name' description: 'Archive output file name'
default: 'firmware' default: 'firmware'
required: false required: false
type: string type: string
@ -29,21 +29,18 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Fetch Build Keyboards name: Fetch Build Keyboards
outputs: outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }} build_matrix: ${{ env.build_matrix }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3.1.0
- name: Install yaml2json - name: Install yaml2json
run: python3 -m pip install remarshal run: python3 -m pip install remarshal
- name: Fetch Build Matrix - name: Fetch Build Matrix
id: set-matrix
run: | run: |
set -x echo "build_matrix=$(yaml2json ${{ inputs.build_matrix_path }} | jq -c .)" >> $GITHUB_ENV
matrix=$(yaml2json ${{ inputs.build_matrix_path }} | jq -c .) yaml2json ${{ inputs.build_matrix_path }} | jq
yaml2json ${{ inputs.build_matrix_path }}
echo "::set-output name=matrix::${matrix}"
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -53,35 +50,31 @@ jobs:
name: Build name: Build
strategy: strategy:
fail-fast: false fail-fast: false
matrix: ${{fromJson(needs.matrix.outputs.matrix)}} matrix: ${{ fromJson(needs.matrix.outputs.build_matrix) }}
steps: steps:
- name: Prepare variables - name: Prepare variables
id: variables shell: sh -x {0}
run: | run: |
set -x
if [ -n "${{ matrix.shield }}" ] if [ -n "${{ matrix.shield }}" ]
then then
EXTRA_CMAKE_ARGS="-DSHIELD=\"${{ matrix.shield }}\"" echo "extra_cmake_args=-DSHIELD=\"${{ matrix.shield }}\"" >> $GITHUB_ENV
ARTIFACT_NAME="${{ matrix.shield }}-${{ matrix.board }}-zmk" echo "artifact_name=${{ matrix.shield }}-${{ matrix.board }}-zmk" >> $GITHUB_ENV
DISPLAY_NAME="${{ matrix.shield }} - ${{ matrix.board }}" echo "display_name=${{ matrix.shield }} - ${{ matrix.board }}" >> $GITHUB_ENV
else else
EXTRA_CMAKE_ARGS= echo "extra_cmake_args=" >> $GITHUB_ENV
DISPLAY_NAME="${{ matrix.board }}" echo "artifact_name=${{ matrix.board }}-zmk" >> $GITHUB_ENV
ARTIFACT_NAME="${{ matrix.board }}-zmk" echo "display_name=${{ matrix.board }}" >> $GITHUB_ENV
fi fi
echo ::set-output name=extra-cmake-args::${EXTRA_CMAKE_ARGS} echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV
echo ::set-output name=artifact-name::${ARTIFACT_NAME}
echo ::set-output name=display-name::${DISPLAY_NAME}
echo ::set-output name=zephyr-version::${ZEPHYR_VERSION}
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3.1.0
- name: Cache west modules - name: Cache west modules
uses: actions/cache@v3.0.2 uses: actions/cache@v3.0.11
continue-on-error: true continue-on-error: true
env: env:
cache-name: cache-zephyr-${{ steps.variables.outputs.zephyr-version }}-modules cache_name: cache-zephyr-${{ env.zephyr_version }}-modules
with: with:
path: | path: |
modules/ modules/
@ -89,9 +82,9 @@ jobs:
zephyr/ zephyr/
bootloader/ bootloader/
zmk/ zmk/
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/west.yml', '**/build.yaml') }} key: ${{ runner.os }}-build-${{ env.cache_name }}-${{ hashFiles('**/west.yml', '**/build.yaml') }}
restore-keys: | restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build-${{ env.cache_name }}-
${{ runner.os }}-build- ${{ runner.os }}-build-
${{ runner.os }}- ${{ runner.os }}-
@ -104,28 +97,28 @@ jobs:
- name: West Zephyr export - name: West Zephyr export
run: west zephyr-export run: west zephyr-export
- name: West Build (${{ steps.variables.outputs.display-name }}) - name: West Build (${{ env.display_name }})
shell: sh -x {0}
run: | run: |
set -x west build -s zmk/app -b ${{ matrix.board }} -- -DZMK_CONFIG=${GITHUB_WORKSPACE}/${{ inputs.config_path }} ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }}
west build -s zmk/app -b ${{ matrix.board }} -- -DZMK_CONFIG=${GITHUB_WORKSPACE}/${{ inputs.config_path }} ${{ steps.variables.outputs.extra-cmake-args }} ${{ matrix.cmake-args }}
- name: ${{ steps.variables.outputs.display-name }} Kconfig file - name: ${{ env.display_name }} Kconfig file
run: grep -v -e "^#" -e "^$" build/zephyr/.config | sort run: grep -v -e "^#" -e "^$" build/zephyr/.config | sort
- name: Rename artifacts - name: Rename artifacts
shell: sh -x {0}
run: | run: |
set -x
mkdir build/artifacts mkdir build/artifacts
if [ -f build/zephyr/zmk.uf2 ] if [ -f build/zephyr/zmk.uf2 ]
then then
cp build/zephyr/zmk.uf2 "build/artifacts/${{ steps.variables.outputs.artifact-name }}.uf2" cp build/zephyr/zmk.uf2 "build/artifacts/${{ env.artifact_name }}.uf2"
elif [ -f build/zephyr/zmk.${{ inputs.fallback_binary }} ] elif [ -f build/zephyr/zmk.${{ inputs.fallback_binary }} ]
then then
cp build/zephyr/zmk.${{ inputs.fallback_binary }} "build/artifacts/${{ steps.variables.outputs.artifact-name }}.${{ inputs.fallback_binary }}" cp build/zephyr/zmk.${{ inputs.fallback_binary }} "build/artifacts/${{ env.artifact_name }}.${{ inputs.fallback_binary }}"
fi fi
- name: Archive (${{ steps.variables.outputs.display-name }}) - name: Archive (${{ env.display_name }})
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
with: with:
name: ${{ inputs.artifact_name }} name: ${{ inputs.archive_name }}
path: build/artifacts path: build/artifacts

View file

@ -73,7 +73,7 @@ lv_obj_t *zmk_display_status_screen() {
#if IS_ENABLED(CONFIG_ZMK_WIDGET_WPM_STATUS) #if IS_ENABLED(CONFIG_ZMK_WIDGET_WPM_STATUS)
zmk_widget_wpm_status_init(&wpm_status_widget, screen); zmk_widget_wpm_status_init(&wpm_status_widget, screen);
lv_obj_align(zmk_widget_wpm_status_obj(&wpm_status_widget), NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -12, lv_obj_align(zmk_widget_wpm_status_obj(&wpm_status_widget), NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0,
0); 0);
#endif #endif
#if IS_ENABLED(CONFIG_ZMK_WIDGET_BONGO_CAT) #if IS_ENABLED(CONFIG_ZMK_WIDGET_BONGO_CAT)

View file

@ -27,13 +27,13 @@ struct battery_status_state {
}; };
static void set_battery_symbol(lv_obj_t *label, struct battery_status_state state) { static void set_battery_symbol(lv_obj_t *label, struct battery_status_state state) {
char text[2] = " "; char text[8] = {};
uint8_t level = state.level; uint8_t level = state.level;
#if IS_ENABLED(CONFIG_USB_DEVICE_STACK) #if IS_ENABLED(CONFIG_USB_DEVICE_STACK)
if (state.usb_present) { if (state.usb_present) {
strcpy(text, LV_SYMBOL_CHARGE); strcpy(text, LV_SYMBOL_CHARGE " ");
} }
#endif /* IS_ENABLED(CONFIG_USB_DEVICE_STACK) */ #endif /* IS_ENABLED(CONFIG_USB_DEVICE_STACK) */
@ -49,6 +49,7 @@ static void set_battery_symbol(lv_obj_t *label, struct battery_status_state stat
strcat(text, LV_SYMBOL_BATTERY_EMPTY); strcat(text, LV_SYMBOL_BATTERY_EMPTY);
} }
lv_label_set_text(label, text); lv_label_set_text(label, text);
lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
} }
void battery_status_update_cb(struct battery_status_state state) { void battery_status_update_cb(struct battery_status_state state) {

View file

@ -24,15 +24,15 @@ struct layer_status_state {
static void set_layer_symbol(lv_obj_t *label, struct layer_status_state state) { static void set_layer_symbol(lv_obj_t *label, struct layer_status_state state) {
if (state.label == NULL) { if (state.label == NULL) {
char text[6] = {}; char text[7] = {};
sprintf(text, LV_SYMBOL_KEYBOARD "%i", state.index); sprintf(text, LV_SYMBOL_KEYBOARD " %i", state.index);
lv_label_set_text(label, text); lv_label_set_text(label, text);
} else { } else {
char text[12] = {}; char text[13] = {};
snprintf(text, 12, LV_SYMBOL_KEYBOARD "%s", state.label); snprintf(text, sizeof(text), LV_SYMBOL_KEYBOARD " %s", state.label);
lv_label_set_text(label, text); lv_label_set_text(label, text);
} }

View file

@ -39,24 +39,24 @@ static struct output_status_state get_state(const zmk_event_t *_eh) {
} }
static void set_status_symbol(lv_obj_t *label, struct output_status_state state) { static void set_status_symbol(lv_obj_t *label, struct output_status_state state) {
char text[9] = {}; char text[10] = {};
switch (state.selected_endpoint) { switch (state.selected_endpoint) {
case ZMK_ENDPOINT_USB: case ZMK_ENDPOINT_USB:
strcat(text, LV_SYMBOL_USB " "); strcat(text, LV_SYMBOL_USB);
break; break;
case ZMK_ENDPOINT_BLE: case ZMK_ENDPOINT_BLE:
if (state.active_profile_bonded) { if (state.active_profile_bonded) {
if (state.active_profile_connected) { if (state.active_profile_connected) {
snprintf(text, sizeof(text), LV_SYMBOL_WIFI "%i " LV_SYMBOL_OK, snprintf(text, sizeof(text), LV_SYMBOL_WIFI " %i " LV_SYMBOL_OK,
state.active_profile_index); state.active_profile_index + 1);
} else { } else {
snprintf(text, sizeof(text), LV_SYMBOL_WIFI "%i " LV_SYMBOL_CLOSE, snprintf(text, sizeof(text), LV_SYMBOL_WIFI " %i " LV_SYMBOL_CLOSE,
state.active_profile_index); state.active_profile_index + 1);
} }
} else { } else {
snprintf(text, sizeof(text), LV_SYMBOL_WIFI "%i " LV_SYMBOL_SETTINGS, snprintf(text, sizeof(text), LV_SYMBOL_WIFI " %i " LV_SYMBOL_SETTINGS,
state.active_profile_index); state.active_profile_index + 1);
} }
break; break;
} }

View file

@ -28,9 +28,10 @@ void set_wpm_symbol(lv_obj_t *label, struct wpm_status_state state) {
char text[4] = {}; char text[4] = {};
LOG_DBG("WPM changed to %i", state.wpm); LOG_DBG("WPM changed to %i", state.wpm);
snprintf(text, sizeof(text), "%i ", state.wpm); snprintf(text, sizeof(text), "%i", state.wpm);
lv_label_set_text(label, text); lv_label_set_text(label, text);
lv_obj_align(label, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
} }
void wpm_status_update_cb(struct wpm_status_state state) { void wpm_status_update_cb(struct wpm_status_state state) {