From fed7b450b36d0d0ce8c270127f9e9c3a22f1b699 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 22 Feb 2023 10:28:11 +1100 Subject: Fix up display artficacts and clean up unused features --- src/main/main.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/main/main.cpp') diff --git a/src/main/main.cpp b/src/main/main.cpp index 1bbd2cca..ddde84e3 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -15,11 +15,13 @@ #include "esp_freertos_hooks.h" #include "esp_intr_alloc.h" #include "esp_log.h" +#include "font/lv_font.h" #include "freertos/portmacro.h" #include "hal/gpio_types.h" #include "hal/spi_types.h" #include "lvgl/lvgl.h" #include "misc/lv_color.h" +#include "misc/lv_style.h" #include "misc/lv_timer.h" #include "widgets/lv_label.h" @@ -63,22 +65,24 @@ extern "C" void lvgl_main(void* voidArgs) { esp_register_freertos_tick_hook(&tick_hook); ESP_LOGI(TAG, "init display"); - auto display_res = + std::unique_ptr display = drivers::Display::create(gpio_expander, drivers::displays::kST7735R); - if (display_res.has_error()) { - ESP_LOGE(TAG, "Failed: %d", display_res.error()); - return; - } - std::unique_ptr display = std::move(display_res.value()); + + lv_style_t style; + lv_style_init(&style); + lv_style_set_text_color(&style, LV_COLOR_MAKE(0xFF, 0, 0)); + // TODO: find a nice bitmap font for this display size and density. + // lv_style_set_text_font(&style, &lv_font_montserrat_24); auto label = lv_label_create(NULL); - lv_label_set_text(label, "g'day, cunts!"); + lv_label_set_text(label, "COLOURS!!"); + lv_obj_add_style(label, &style, 0); + lv_obj_center(label); lv_scr_load(label); while (1) { lv_timer_handler(); - // display->ServiceTransactions(); vTaskDelay(pdMS_TO_TICKS(10)); } -- cgit v1.2.3