modules: lvgl: input: Fix invalid encoder readout

When the encoder button was pressed, it would send a LV_KEY_LEFT/RIGHT
instead of a LV_KEY_ENTER event.
This clears the enc_diff field, and set the key field to LV_KEY_ENTER
for button events.

Fixes #73529

Signed-off-by: Lorenz Clijnen <lorenz_reclame@outlook.be>
This commit is contained in:
Lorenz Clijnen 2024-05-31 17:13:29 +02:00 committed by Fabio Baltieri
parent 0d56a3c3f4
commit d7e5451799

View file

@ -28,6 +28,8 @@ static void lvgl_encoder_process_event(const struct device *dev, struct input_ev
data->pending_event.enc_diff = evt->value;
} else if (evt->code == cfg->button_input_code) {
data->pending_event.state = evt->value ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
data->pending_event.enc_diff = 0;
data->pending_event.key = LV_KEY_ENTER;
} else {
LOG_DBG("Ignored input event: %u", evt->code);
return;