Keypad Problem , focus not moving

Description

What MCU/Processor/Board and compiler are you using?

ESP32-WROOM32D - FreeRtos - Platformio

What LVGL version are you using?

8.1

What do you want to achieve?

Move between elements with a keypad (Left,Right,Up,Down,Enter)

What have you tried so far?

lv_group_send_data(group, LV_KEY_RIGHT);

> data->key = LV_KEY_NEXT; //It works

data->key = LV_KEY_RIGHT; //It didnt work

Code

The code block(s) should be formatted like:


void lvSetup(){

  /*  setup del input (Keypad)  */
  static lv_indev_drv_t indev_drv;           /*Descriptor of a input device driver*/
  lv_indev_drv_init(&indev_drv);             /*Basic initialization*/
  indev_drv.type = LV_INDEV_TYPE_KEYPAD;    /*Touch pad is a pointer-like device*/
  indev_drv.read_cb = keyboard_read;      /*Set your driver function*/
  indev_keypad = lv_indev_drv_register(&indev_drv);         /*Finally register the driver*/
}


void keyboard_read(lv_indev_drv_t *drv, lv_indev_data_t *data) {

 if (xQueueReceive(colaTeclas, (void *)&received, 0) == pdTRUE) {
      Serial.printf("KeyPressed");
           data->state =  LV_INDEV_STATE_PRESSED;

switch(received) {
    case 'D':  
        data->key = LV_KEY_DOWN;
        break;

    case 'R': 
        data->key = LV_KEY_RIGHT;
        break;

    case 'L':  
        data->key = LV_KEY_LEFT;
        break;

    case 'U':  
        data->key = LV_KEY_UP;
        break;
}

 Serial.printf("Value of data->key = %d ", data->key);

}

  if (xQueueReceive(colaTeclaslib, (void *)&received, 0) == pdTRUE) {

      Serial.print("Key Realeased");
      
       data->state =  LV_INDEV_STATE_RELEASED;
}
}

void display_init( void ) {


 group = lv_group_create();
    lv_indev_set_group(indev_keypad, group);
    lv_group_set_default(group);

  screen1 = lv_obj_create(NULL);
  lv_scr_load(screen1);


lv_obj_t * btn1 = lv_btn_create(screen1);
lv_obj_set_pos(btn1, 50, 50);
lv_obj_set_size(btn1, 100, 50);
lv_obj_t * label1 = lv_label_create(btn1);
lv_label_set_text(label1, "Botón 1");

lv_obj_t * btn2 = lv_btn_create(screen1);
lv_obj_set_pos(btn2, 160, 50);
lv_obj_set_size(btn2, 100, 50);
lv_obj_t * label2 = lv_label_create(btn2);
lv_label_set_text(label2, "Botón 2");

lv_obj_t * btn3 = lv_btn_create(screen1);
lv_obj_set_pos(btn3, 50, 120);
lv_obj_set_size(btn3, 100, 50);
lv_obj_t * label3 = lv_label_create(btn3);
lv_label_set_text(label3, "Botón 3");

lv_obj_t * btn4 = lv_btn_create(screen1);
lv_obj_set_pos(btn4, 160, 120);
lv_obj_set_size(btn4, 100, 50);
lv_obj_t * label4 = lv_label_create(btn4);
lv_label_set_text(label4, "Botón 4");

lv_group_add_obj(group, btn1);
lv_group_add_obj(group, btn2);
lv_group_add_obj(group, btn3);
lv_group_add_obj(group, btn4);


}

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Terminal Output:

KeyPressed R Value of data->key = 19 Key Realeased
KeyPressed L Value of data->key = 20 Key Realeased
KeyPressed U Value of data->key = 17 Key Realeased
KeyPressed D Value of data->key = 18 Key Realeased

But focus it is not moving.

If i reemplace with LV_KEY_NEXT it works, but i cant move to down element.