Hello
I’m busy with the implementation of the encoder to LVGL. The screen contains input spinners and some buttons. My idea is to control these object with the encoder. After writing the logic to interface the encoder and adding the callback function to LVGL nothing happens on the screen.
The callback for reading the encoder is called. I check this already.
The focus is not changing to any object there is no reaction on the button.
Did I forget something before it will work?
Registration of the encoder:
lv_indev_t * Enc_indev = lv_indev_create();
lv_indev_set_type(Enc_indev, LV_INDEV_TYPE_ENCODER); /*See below.*/;
lv_indev_set_read_cb(Enc_indev, encoder_read); /*See below.*/
Spinbox:
lv_obj_t *spinboxCH = lv_spinbox_create(lv_scr_act());
lv_spinbox_set_range(spinboxCH, 1, 8); // Set range from 1 to 9
lv_spinbox_set_digit_format(spinboxCH, 1, 0); // 1 digit, no decimal places
lv_spinbox_set_value(spinboxCH, 1); // Initial value
lv_obj_set_width(spinboxCH, 40);
lv_obj_center(spinboxCH);
lv_obj_set_pos(spinboxCH, -30, -40); // X = 50 px, Y = 30 px from top-left
lv_obj_set_style_text_align(spinboxCH, LV_TEXT_ALIGN_CENTER, 0);
lv_obj_set_style_bg_color(spinboxCH, lv_color_hex(0x002142), 0); // Blue background
lv_obj_set_style_border_color(spinboxCH, lv_palette_main(LV_PALETTE_BLUE), 0);
lv_obj_set_style_bg_opa(spinboxCH, LV_OPA_COVER, 0); // Ensure background is fully visible
lv_obj_set_style_text_color(spinboxCH, lv_color_white(), 0);
lv_obj_add_event_cb(spinboxCH, spinbox_event_cb_ChSet, LV_EVENT_VALUE_CHANGED, NULL);