feat(display): label widget updated licence year and removed text length limit

This commit is contained in:
aggstam 2024-02-06 13:36:20 +02:00
parent 89b12acb72
commit 2aaa7bc09e
4 changed files with 4 additions and 12 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020 The ZMK Contributors * Copyright (c) 2024 The ZMK Contributors
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */

View file

@ -41,7 +41,7 @@ config ZMK_WIDGET_LABEL
select LV_USE_LABEL select LV_USE_LABEL
config ZMK_WIDGET_LABEL_TEXT config ZMK_WIDGET_LABEL_TEXT
string "Custom message to display, up to 7 characters" string "Custom message to display"
default "ZMK" default "ZMK"
endmenu endmenu

View file

@ -1,22 +1,14 @@
/* /*
* Copyright (c) 2020 The ZMK Contributors * Copyright (c) 2024 The ZMK Contributors
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
#include <zephyr/kernel.h> #include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <zmk/display.h> #include <zmk/display.h>
#include <zmk/display/widgets/label.h> #include <zmk/display/widgets/label.h>
#define WIDGET_LABEL_TEXT_MAX 7
BUILD_ASSERT(sizeof(CONFIG_ZMK_WIDGET_LABEL_TEXT) - 1 <= WIDGET_LABEL_TEXT_MAX,
"ERROR: Widget label text length is too long. Max length: 7");
int zmk_widget_label_init(struct zmk_widget_label *widget, lv_obj_t *parent) { int zmk_widget_label_init(struct zmk_widget_label *widget, lv_obj_t *parent) {
widget->obj = lv_label_create(parent); widget->obj = lv_label_create(parent);
lv_label_set_text(widget->obj, CONFIG_ZMK_WIDGET_LABEL_TEXT); lv_label_set_text(widget->obj, CONFIG_ZMK_WIDGET_LABEL_TEXT);

View file

@ -24,7 +24,7 @@ Definition files:
| `CONFIG_ZMK_WIDGET_OUTPUT_STATUS` | bool | Enable a widget to show the current output (USB/BLE) | y | | `CONFIG_ZMK_WIDGET_OUTPUT_STATUS` | bool | Enable a widget to show the current output (USB/BLE) | y |
| `CONFIG_ZMK_WIDGET_WPM_STATUS` | bool | Enable a widget to show words per minute | n | | `CONFIG_ZMK_WIDGET_WPM_STATUS` | bool | Enable a widget to show words per minute | n |
| `ZMK_WIDGET_LABEL` | bool | Enable a widget to display custom messages | n | | `ZMK_WIDGET_LABEL` | bool | Enable a widget to display custom messages | n |
| `ZMK_WIDGET_LABEL_TEXT` | string | Custom message to display, up to 7 characters | ZMK | | `ZMK_WIDGET_LABEL_TEXT` | string | Custom message to display | ZMK |
Note that `CONFIG_ZMK_DISPLAY_INVERT` setting might not work as expected with custom status screens that utilize images. Note that `CONFIG_ZMK_DISPLAY_INVERT` setting might not work as expected with custom status screens that utilize images.