Important: unclear posts may not receive useful answers.
Before posting
- Get familiar with Markdown to format and structure your post
- Be sure to update lvgl from the latest version from the
master
branch.- Read the
Delete this section if you read and applied the mentioned points.
Description
I am just trying to display a button with some text… I see three buttons instead and text looks like garbage excpet on one button
What MCU/Processor/Board and compiler are you using?
Nrf5340 MCU, Custom board, RM69090 Display controller (QSPI), 320%360 AMOLED display. Zephyr RTOS with Nordic NCS (SDK) with built-in gcc tools)
NCS version: 1.5.1
LVGL version: ## v7.6.1 (06.10.2020)
Zephyr RTOS version: 2.4.99
What do you want to achieve?
Get a button displayed on the screen but i see three identical buttons
What have you tried so far?
Went through he documentation (pretty good), porting section, your git hub, zephyr’s (poor) VGVL documentation… code compiles and there are no errors/crashes… But the button shows up 3 times and text is surely not very clear. I don’t care for the button press getting recognized (yet) as I have not looked into integrating touch controller driver with lvgl yet. Just want to see a single button with text is all I am looking for right now. AS mentioned, I see multiple buttons when i am coding for just one (or so I think)
Code to reproduce
Add the relevant code snippets here.
The code block(s) should be between ```c
and ```
tags:
/*You code here*/
void btn_event_cb(lv_obj_t * btn, lv_event_t event) {
if(event == LV_EVENT_CLICKED) {
printf("Clicked\n");
}
}
void set_button(void) {
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button to the current screen*/
lv_obj_set_pos(btn, 10, 10); /*Set its position*/
lv_obj_set_size(btn, 150, 100); /*Set its size*/
lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to the button*/
lv_obj_t * label = lv_label_create(btn, NULL); /*Add a label to the button*/
lv_label_set_text(label, "Button"); /*Set the labels text*/
}
void main(void) {
//lots of hardware init stuff here
/* Initialize the device */
display_dev = device_get_binding(DISPLAY_DEV_NAME); //(CONFIG_LVGL_DISPLAY_DEV_NAME);
if (!display_dev) {
printk("Binding Display failed... will loop for ever");
return;
}
set_button();
lv_task_handler();
display_get_chipid(display_dev); //gets the chip id of the display controller)
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.