Fixes and improvements (#620)
- Standardized keyboard input using Unicode-based key codes across supported devices and the simulator. Keyboards don't emit `LV_KEY_*` anymore. - Refactored lilygo encoder driver into a reusable GPIO rotary encoder driver (see `Drivers/gpio-encoder-module/`). Added more features to the config file. - Improved LVGL keyboard device management, including duplicate prevention and reliable reconnects. - LVGL file mutex now registers with lvgl start/stop - Improved LVGL startup/shutdown stability and memory allocation reliability. - Increased simulator LVGL memory capacity and improved USB device-class handling.
This commit is contained in:
committed by
GitHub
parent
4fea48f433
commit
db48dfe812
@@ -12,8 +12,6 @@
|
||||
#include <tactility/log.h>
|
||||
#include <tactility/time.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#define TAG "ButtonControl"
|
||||
@@ -105,8 +103,8 @@ static error_t start(Device* device) {
|
||||
|
||||
error_t error = acquire_button(
|
||||
config->pin_primary,
|
||||
two_button_mode ? LV_KEY_ENTER : LV_KEY_NEXT,
|
||||
two_button_mode ? LV_KEY_ESC : LV_KEY_ENTER,
|
||||
two_button_mode ? (uint32_t)CODEPOINT_ENTER : (uint32_t)CODEPOINT_ARROW_DOWN,
|
||||
two_button_mode ? (uint32_t)CODEPOINT_ESCAPE : (uint32_t)CODEPOINT_ENTER,
|
||||
&internal->primary
|
||||
);
|
||||
if (error != ERROR_NONE) {
|
||||
@@ -114,7 +112,7 @@ static error_t start(Device* device) {
|
||||
return error;
|
||||
}
|
||||
|
||||
error = acquire_button(config->pin_secondary, LV_KEY_NEXT, LV_KEY_PREV, &internal->secondary);
|
||||
error = acquire_button(config->pin_secondary, CODEPOINT_ARROW_DOWN, CODEPOINT_ARROW_UP, &internal->secondary);
|
||||
if (error != ERROR_NONE) {
|
||||
if (internal->primary.in_use) {
|
||||
gpio_descriptor_release(internal->primary.descriptor);
|
||||
@@ -176,7 +174,7 @@ static void poll_button(const ButtonControlConfig* config, ButtonControlInternal
|
||||
}
|
||||
|
||||
// Release: decide short vs. long press by elapsed hold duration, then queue a synthetic
|
||||
// key tap (press followed by release) for the LVGL key this gesture maps to.
|
||||
// key tap (press followed by release) for the key this gesture maps to.
|
||||
uint32_t held_ms = now - state->press_start_time;
|
||||
uint32_t key = held_ms < config->long_press_ms ? state->short_press_key : state->long_press_key;
|
||||
push_pending(internal, key, true);
|
||||
|
||||
Reference in New Issue
Block a user