Description
I would like to change the size of the LV symbols
Used repo.:
ropg/m5core2_esp-idf_dem
Only the main.c changed:
// SPDX: MIT
// Copyright 2021 Brian Starkey <stark3y@gmail.com>
// Portions from lvgl example: https://github.com/lvgl/lv_port_esp32/blob/master/main/main.c
//
//
#include <stdio.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "esp_system.h"
#include "esp_spi_flash.h"
#include <esp_log.h>
#include "i2c_manager.h"
#include "m5core2_axp192.h"
#include "lvgl.h"
#include "lvgl_helpers.h"
#define LV_TICK_PERIOD_MS 1
static void gui_timer_tick(void *arg)
{
// Unused
(void) arg;
lv_tick_inc(LV_TICK_PERIOD_MS);
}
static void gui_thread(void *pvParameter)
{
(void) pvParameter;
static lv_color_t bufs[2][DISP_BUF_SIZE];
static lv_disp_buf_t disp_buf;
uint32_t size_in_px = DISP_BUF_SIZE;
// Set up the frame buffers
lv_disp_buf_init(&disp_buf, &bufs[0], &bufs[1], size_in_px);
// Set up the display driver
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.flush_cb = disp_driver_flush;
disp_drv.buffer = &disp_buf;
lv_disp_drv_register(&disp_drv);
// Register the touch screen. All of the properties of it
// are set via the build config
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.read_cb = touch_driver_read;
indev_drv.type = LV_INDEV_TYPE_POINTER;
lv_indev_drv_register(&indev_drv);
// Timer to drive the main lvgl tick
const esp_timer_create_args_t periodic_timer_args = {
.callback = &gui_timer_tick,
.name = "periodic_gui"
};
esp_timer_handle_t periodic_timer;
ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args, &periodic_timer));
ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, LV_TICK_PERIOD_MS * 1000));
// Full screen root container
lv_obj_t *root = lv_cont_create(lv_scr_act(), NULL);
lv_obj_set_style_local_bg_color(root,0,LV_STATE_DEFAULT,LV_COLOR_GRAY);
lv_obj_set_size(root, 320, 240);
lv_cont_set_layout(root, LV_LAYOUT_OFF);
// Don't let the containers be clicked on
lv_obj_set_click(root, false);
lv_obj_t * b1 = lv_btn_create(root,NULL);
lv_obj_set_size(b1,150,50);
//lv_obj_set_size(b1,40,40);
//lv_btn_set_layout(b1,LV_LAYOUT_PRETTY_MID);
lv_obj_set_pos(b1,100,10);
//lv_btn_set_layout(b1,LV_LAYOUT_PRETTY_TOP);
lv_obj_t * l1 = lv_label_create(b1,NULL);
lv_label_set_text(l1,"Button1");
/////////////////////////////////////////////////////////////////////////////////////
lv_obj_t * lte = lv_img_create(root,NULL);
lv_img_set_src(lte,LV_SYMBOL_WIFI);
lv_obj_refresh_style(lte,0,LV_STYLE_PROP_ALL);
lv_obj_set_size(lte,50,50);
lv_obj_t * sdkater = lv_img_create(root,NULL);
lv_img_set_src(sdkater,LV_SYMBOL_FILE);
lv_obj_set_pos(sdkater,100,100);
lv_obj_set_size(sdkater,60,60);
lv_obj_refresh_style(sdkater,0,LV_STYLE_PROP_ALL);
lv_obj_reset_style_list(sdkater,0);
while (1) {
vTaskDelay(10 / portTICK_PERIOD_MS);
lv_task_handler();
}
// Never returns
}
void app_main(void)
{
printf("Hello world!\n");
/* Print chip information */
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
printf("This is %s chip with %d CPU cores, WiFi%s%s, ",
CONFIG_IDF_TARGET,
chip_info.cores,
(chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
(chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
printf("silicon revision %d, ", chip_info.revision);
printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
printf("Free heap: %d\n", esp_get_free_heap_size());
m5core2_init();
lvgl_i2c_locking(i2c_manager_locking());
lv_init();
lvgl_driver_init();
// Needs to be pinned to a core
xTaskCreatePinnedToCore(gui_thread, "gui", 4096*2, NULL, 0, NULL, 1);
printf("Running...\n");
fflush(stdout);
for ( ; ; ) {
vTaskDelay(portMAX_DELAY);
}
printf("Restarting now.\n");
esp_restart();
}
What MCU/Processor/Board and compiler are you using?
ESP32-D0WDQ6-V3
M5Core2
What LVGL version are you using?
V7
What do you want to achieve?
Change the size of the LV_SYMBOL
What have you tried so far?
lv_obj_t * lte = lv_img_create(root,NULL);
lv_img_set_src(lte,LV_SYMBOL_WIFI);
lv_obj_set_style_local_size(lte,0,LV_STATE_DEFAULT,15);
lv_obj_t * lte = lv_img_create(root,NULL);
lv_img_set_src(lte,LV_SYMBOL_WIFI);
lv_obj_set_size(lte,50,50);
lv_obj_t * lte = lv_img_create(root,NULL);
lv_img_set_src(lte,LV_SYMBOL_WIFI);
lv_obj_refresh_style(lte,0,LV_STYLE_PROP_ALL);
lv_obj_set_size(lte,50,50);