Update logoIro image data
Refreshed the logoIro_map array in assets/logoIro.c with new image data. This may reflect a visual update or optimization to the logo asset.
This commit is contained in:
954
assets/logoIro.c
954
assets/logoIro.c
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@ dependencies:
|
|||||||
esp_lcd_sh8601:
|
esp_lcd_sh8601:
|
||||||
dependencies: []
|
dependencies: []
|
||||||
source:
|
source:
|
||||||
path: C:\Users\neila\Coding\iroBotAMOLED\components\esp_lcd_sh8601
|
path: /Users/neil/Coding/iroBot/components/esp_lcd_sh8601
|
||||||
type: local
|
type: local
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
espressif/esp_io_expander:
|
espressif/esp_io_expander:
|
||||||
|
|||||||
149
main/main.c
149
main/main.c
@@ -4,6 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
@@ -19,21 +20,75 @@
|
|||||||
#include "freertos/semphr.h"
|
#include "freertos/semphr.h"
|
||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
|
||||||
<<<<<<< Updated upstream
|
|
||||||
#include "src/extra/libs/gif/lv_gif.h"
|
#include "src/extra/libs/gif/lv_gif.h"
|
||||||
#include "emotions/facetestLCD.h"
|
#include "emotions/facetestLCD.h"
|
||||||
=======
|
|
||||||
#include "esp_lcd_sh8601.h"
|
#include "esp_lcd_sh8601.h"
|
||||||
#include "esp_lcd_touch_ft5x06.h"
|
#include "esp_lcd_touch_ft5x06.h"
|
||||||
>>>>>>> Stashed changes
|
|
||||||
|
|
||||||
#include "esp_io_expander_tca9554.h"
|
#include "esp_io_expander_tca9554.h"
|
||||||
#include "../assets/logoIro.c"
|
#include "../assets/logoIro.c"
|
||||||
|
|
||||||
|
/* Re-enable input devices after splash timeout */
|
||||||
|
static void reenable_input_cb(lv_timer_t * t)
|
||||||
|
{
|
||||||
|
lv_indev_t *indev = lv_indev_get_next(NULL);
|
||||||
|
while (indev) {
|
||||||
|
lv_indev_enable(indev, true);
|
||||||
|
indev = lv_indev_get_next(indev);
|
||||||
|
}
|
||||||
|
lv_timer_del(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Helper to animate screen background color (exec callback for lv_anim) */
|
||||||
|
static void scr_bg_anim(void * var, int32_t v)
|
||||||
|
{
|
||||||
|
lv_obj_t *scr = (lv_obj_t *)var;
|
||||||
|
lv_color_t c = lv_color_hex((uint32_t)v);
|
||||||
|
lv_obj_set_style_bg_color(scr, c, LV_PART_MAIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Timer callback started after fade-in completes; starts fade-out and background animation */
|
||||||
|
static void fadeout_start_cb(lv_timer_t * t)
|
||||||
|
{
|
||||||
|
lv_obj_t *logo = (lv_obj_t *)t->user_data;
|
||||||
|
if (!logo) {
|
||||||
|
lv_timer_del(t);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Start image fade-out (750 ms) */
|
||||||
|
lv_obj_fade_out(logo, 750, 0);
|
||||||
|
|
||||||
|
/* Animate screen background color from sampled bg to black over 750 ms */
|
||||||
|
lv_obj_t *scr = lv_obj_get_parent(logo);
|
||||||
|
uint32_t from_hex = 0x000000;
|
||||||
|
/* Try to sample from the image data if available */
|
||||||
|
if (logoIro_img.data && logoIro_img.data_size >= 2) {
|
||||||
|
const uint8_t *d = (const uint8_t *)logoIro_img.data;
|
||||||
|
uint16_t pix = (uint16_t)(d[0] | (d[1] << 8));
|
||||||
|
uint8_t r5 = (pix >> 11) & 0x1F;
|
||||||
|
uint8_t g6 = (pix >> 5) & 0x3F;
|
||||||
|
uint8_t b5 = pix & 0x1F;
|
||||||
|
uint8_t r8 = (r5 * 255) / 31;
|
||||||
|
uint8_t g8 = (g6 * 255) / 63;
|
||||||
|
uint8_t b8 = (b5 * 255) / 31;
|
||||||
|
from_hex = (r8 << 16) | (g8 << 8) | b8;
|
||||||
|
}
|
||||||
|
|
||||||
|
lv_anim_t a;
|
||||||
|
lv_anim_init(&a);
|
||||||
|
lv_anim_set_var(&a, scr);
|
||||||
|
lv_anim_set_exec_cb(&a, scr_bg_anim);
|
||||||
|
lv_anim_set_values(&a, (int)from_hex, 0x000000);
|
||||||
|
lv_anim_set_time(&a, 750);
|
||||||
|
lv_anim_start(&a);
|
||||||
|
|
||||||
|
lv_timer_del(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static const char *TAG = "LVGL_AMOLED";
|
|
||||||
|
static const char *TAG __attribute__((unused)) = "LVGL_AMOLED";
|
||||||
|
|
||||||
/* LCD Host */
|
/* LCD Host */
|
||||||
#define LCD_HOST SPI2_HOST
|
#define LCD_HOST SPI2_HOST
|
||||||
@@ -80,27 +135,25 @@ static const char *TAG = "LVGL_AMOLED";
|
|||||||
#define LVGL_TASK_PRIORITY 4
|
#define LVGL_TASK_PRIORITY 4
|
||||||
|
|
||||||
/* LCD IO and panel handles */
|
/* LCD IO and panel handles */
|
||||||
static esp_lcd_panel_io_handle_t lcd_io = NULL;
|
static esp_lcd_panel_io_handle_t lcd_io __attribute__((unused)) = NULL;
|
||||||
static esp_lcd_panel_handle_t lcd_panel = NULL;
|
static esp_lcd_panel_handle_t lcd_panel __attribute__((unused)) = NULL;
|
||||||
|
|
||||||
#if USE_TOUCH
|
#if USE_TOUCH
|
||||||
static esp_lcd_touch_handle_t tp = NULL;
|
static esp_lcd_touch_handle_t tp __attribute__((unused)) = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
<<<<<<< Updated upstream
|
/* LVGL mutex for thread safety */
|
||||||
static lv_obj_t *g_lvgl_gif = NULL;
|
static SemaphoreHandle_t lvgl_mux = NULL;
|
||||||
static const lv_img_dsc_t g_lvgl_gif_src = {
|
|
||||||
|
static lv_obj_t *g_lvgl_gif __attribute__((unused)) = NULL;
|
||||||
|
static const lv_img_dsc_t g_lvgl_gif_src __attribute__((unused)) = {
|
||||||
.header.always_zero = 0,
|
.header.always_zero = 0,
|
||||||
.header.w = 240,
|
.header.w = 240,
|
||||||
.header.h = 135,
|
.header.h = 135,
|
||||||
.header.cf = LV_IMG_CF_RAW,
|
.header.cf = LV_IMG_CF_RAW,
|
||||||
.data_size = sizeof(facetestLCD),
|
.data_size = sizeof(facetestLCD),
|
||||||
.data = facetestLCD,
|
.data = facetestLCD,
|
||||||
=======
|
};
|
||||||
/* LVGL mutex for thread safety */
|
|
||||||
static SemaphoreHandle_t lvgl_mux = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* LCD initialization commands for SH8601 */
|
/* LCD initialization commands for SH8601 */
|
||||||
static const sh8601_lcd_init_cmd_t lcd_init_cmds[] = {
|
static const sh8601_lcd_init_cmd_t lcd_init_cmds[] = {
|
||||||
@@ -113,7 +166,6 @@ static const sh8601_lcd_init_cmd_t lcd_init_cmds[] = {
|
|||||||
{0x51, (uint8_t[]){0x00}, 1, 10},
|
{0x51, (uint8_t[]){0x00}, 1, 10},
|
||||||
{0x29, (uint8_t[]){0x00}, 0, 10},
|
{0x29, (uint8_t[]){0x00}, 0, 10},
|
||||||
{0x51, (uint8_t[]){0xFF}, 1, 0}, /* Max brightness */
|
{0x51, (uint8_t[]){0xFF}, 1, 0}, /* Max brightness */
|
||||||
>>>>>>> Stashed changes
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* LVGL display driver variable (for flush callback) */
|
/* LVGL display driver variable (for flush callback) */
|
||||||
@@ -123,16 +175,9 @@ static lv_disp_drv_t disp_drv;
|
|||||||
|
|
||||||
static bool notify_lvgl_flush_ready(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx)
|
static bool notify_lvgl_flush_ready(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx)
|
||||||
{
|
{
|
||||||
<<<<<<< Updated upstream
|
|
||||||
g_lvgl_gif = lv_gif_create(parent);
|
|
||||||
lv_gif_set_src(g_lvgl_gif, &g_lvgl_gif_src);
|
|
||||||
lv_obj_align(g_lvgl_gif, LV_ALIGN_CENTER, 0, 0);
|
|
||||||
return ESP_OK;
|
|
||||||
=======
|
|
||||||
lv_disp_drv_t *disp_driver = (lv_disp_drv_t *)user_ctx;
|
lv_disp_drv_t *disp_driver = (lv_disp_drv_t *)user_ctx;
|
||||||
lv_disp_flush_ready(disp_driver);
|
lv_disp_flush_ready(disp_driver);
|
||||||
return false;
|
return false;
|
||||||
>>>>>>> Stashed changes
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lvgl_flush_cb(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map)
|
static void lvgl_flush_cb(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map)
|
||||||
@@ -268,13 +313,7 @@ void app_main(void)
|
|||||||
esp_log_level_set("lcd_panel.io.i2c", ESP_LOG_NONE);
|
esp_log_level_set("lcd_panel.io.i2c", ESP_LOG_NONE);
|
||||||
esp_log_level_set("FT5x06", ESP_LOG_NONE);
|
esp_log_level_set("FT5x06", ESP_LOG_NONE);
|
||||||
|
|
||||||
<<<<<<< Updated upstream
|
|
||||||
/* Background */
|
|
||||||
lv_obj_set_style_bg_color(scr, lv_color_hex(0xD6F6CD), LV_PART_MAIN);
|
|
||||||
lv_obj_set_style_bg_opa(scr, LV_OPA_COVER, LV_PART_MAIN);
|
|
||||||
=======
|
|
||||||
static lv_disp_draw_buf_t disp_buf;
|
static lv_disp_draw_buf_t disp_buf;
|
||||||
>>>>>>> Stashed changes
|
|
||||||
|
|
||||||
/* Initialize I2C bus for touch and IO expander */
|
/* Initialize I2C bus for touch and IO expander */
|
||||||
ESP_LOGI(TAG, "Initialize I2C bus");
|
ESP_LOGI(TAG, "Initialize I2C bus");
|
||||||
@@ -289,9 +328,6 @@ void app_main(void)
|
|||||||
ESP_ERROR_CHECK(i2c_param_config(TOUCH_HOST, &i2c_conf));
|
ESP_ERROR_CHECK(i2c_param_config(TOUCH_HOST, &i2c_conf));
|
||||||
ESP_ERROR_CHECK(i2c_driver_install(TOUCH_HOST, i2c_conf.mode, 0, 0, 0));
|
ESP_ERROR_CHECK(i2c_driver_install(TOUCH_HOST, i2c_conf.mode, 0, 0, 0));
|
||||||
|
|
||||||
<<<<<<< Updated upstream
|
|
||||||
ESP_ERROR_CHECK(app_gif_init_lvgl(scr));
|
|
||||||
=======
|
|
||||||
/* Initialize IO expander (TCA9554) for LCD/Touch reset and backlight */
|
/* Initialize IO expander (TCA9554) for LCD/Touch reset and backlight */
|
||||||
ESP_LOGI(TAG, "Initialize IO expander");
|
ESP_LOGI(TAG, "Initialize IO expander");
|
||||||
esp_io_expander_handle_t io_expander = NULL;
|
esp_io_expander_handle_t io_expander = NULL;
|
||||||
@@ -299,7 +335,6 @@ void app_main(void)
|
|||||||
|
|
||||||
/* Configure IO expander pins as outputs */
|
/* Configure IO expander pins as outputs */
|
||||||
esp_io_expander_set_dir(io_expander, IO_EXPANDER_PIN_NUM_0 | IO_EXPANDER_PIN_NUM_1 | IO_EXPANDER_PIN_NUM_2, IO_EXPANDER_OUTPUT);
|
esp_io_expander_set_dir(io_expander, IO_EXPANDER_PIN_NUM_0 | IO_EXPANDER_PIN_NUM_1 | IO_EXPANDER_PIN_NUM_2, IO_EXPANDER_OUTPUT);
|
||||||
>>>>>>> Stashed changes
|
|
||||||
|
|
||||||
/* Reset sequence: pull low then high */
|
/* Reset sequence: pull low then high */
|
||||||
esp_io_expander_set_level(io_expander, IO_EXPANDER_PIN_NUM_0, 0);
|
esp_io_expander_set_level(io_expander, IO_EXPANDER_PIN_NUM_0, 0);
|
||||||
@@ -430,17 +465,36 @@ void app_main(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Set full screen background color to #848a5d
|
/* Create a splash screen: sample the image background color, fit image inside
|
||||||
|
* the display (no cropping), disable interaction, and render pixel-perfect
|
||||||
|
* by using LVGL's zoom. */
|
||||||
if (lvgl_lock(-1)) {
|
if (lvgl_lock(-1)) {
|
||||||
lv_obj_t *scr = lv_scr_act();
|
lv_obj_t *scr = lv_scr_act();
|
||||||
lv_obj_set_style_bg_color(scr, lv_color_hex(0x848a5d), LV_PART_MAIN);
|
|
||||||
|
/* Sample first pixel from embedded RGB565 image to use as background.
|
||||||
|
* Assume `logoIro_img.data` contains RGB565 (little-endian) bytes. */
|
||||||
|
uint32_t bg_hex = 0x848a5d; /* fallback */
|
||||||
|
if (logoIro_img.data && logoIro_img.data_size >= 2) {
|
||||||
|
const uint8_t *d = (const uint8_t *)logoIro_img.data;
|
||||||
|
uint16_t pix = (uint16_t)(d[0] | (d[1] << 8));
|
||||||
|
uint8_t r5 = (pix >> 11) & 0x1F;
|
||||||
|
uint8_t g6 = (pix >> 5) & 0x3F;
|
||||||
|
uint8_t b5 = pix & 0x1F;
|
||||||
|
uint8_t r8 = (r5 * 255) / 31;
|
||||||
|
uint8_t g8 = (g6 * 255) / 63;
|
||||||
|
uint8_t b8 = (b5 * 255) / 31;
|
||||||
|
bg_hex = (r8 << 16) | (g8 << 8) | b8;
|
||||||
|
}
|
||||||
|
|
||||||
|
lv_obj_set_style_bg_color(scr, lv_color_hex(bg_hex), LV_PART_MAIN);
|
||||||
lv_obj_set_style_bg_opa(scr, LV_OPA_COVER, LV_PART_MAIN);
|
lv_obj_set_style_bg_opa(scr, LV_OPA_COVER, LV_PART_MAIN);
|
||||||
|
|
||||||
// Create and display the logo image (scaled to cover full screen)
|
/* Create and display the logo image (scaled to fit screen, centered) */
|
||||||
lv_obj_t *logo_img = lv_img_create(scr);
|
lv_obj_t *logo_img = lv_img_create(scr);
|
||||||
lv_img_set_src(logo_img, &logoIro_img);
|
lv_img_set_src(logo_img, &logoIro_img);
|
||||||
|
|
||||||
/* Scale logo to cover the entire screen while keeping aspect ratio */
|
/* Fit the image inside the screen (no crop) using LVGL zoom (256 == 1.0×).
|
||||||
|
* Temporarily disable input devices to prevent scrolling during the splash. */
|
||||||
{
|
{
|
||||||
const lv_img_dsc_t *dsc = &logoIro_img;
|
const lv_img_dsc_t *dsc = &logoIro_img;
|
||||||
int orig_w = dsc->header.w;
|
int orig_w = dsc->header.w;
|
||||||
@@ -452,13 +506,26 @@ void app_main(void)
|
|||||||
int scale_w = (scr_w * 256) / orig_w;
|
int scale_w = (scr_w * 256) / orig_w;
|
||||||
int scale_h = (scr_h * 256) / orig_h;
|
int scale_h = (scr_h * 256) / orig_h;
|
||||||
|
|
||||||
/* Use the larger scale so the image covers the whole screen (may crop) */
|
/* Use the smaller scale so the image fits inside the screen (no crop) */
|
||||||
uint16_t zoom = (uint16_t)((scale_w > scale_h) ? scale_w : scale_h);
|
uint16_t zoom = (uint16_t)((scale_w < scale_h) ? scale_w : scale_h);
|
||||||
if (zoom == 0) zoom = 1;
|
if (zoom == 0) zoom = 1;
|
||||||
lv_img_set_zoom(logo_img, zoom);
|
lv_img_set_zoom(logo_img, zoom);
|
||||||
|
|
||||||
/* Center the image after zoom so it fills the display evenly */
|
/* Make the image and screen non-interactive / non-scrollable */
|
||||||
|
lv_obj_clear_flag(logo_img, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE);
|
||||||
|
lv_obj_clear_flag(scr, LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_CLICKABLE);
|
||||||
|
|
||||||
|
/* Center the image */
|
||||||
lv_obj_align(logo_img, LV_ALIGN_CENTER, 0, 0);
|
lv_obj_align(logo_img, LV_ALIGN_CENTER, 0, 0);
|
||||||
|
|
||||||
|
/* Disable all input devices temporarily to prevent user scroll/input */
|
||||||
|
lv_indev_t *indev = lv_indev_get_next(NULL);
|
||||||
|
while (indev) {
|
||||||
|
lv_indev_enable(indev, false);
|
||||||
|
indev = lv_indev_get_next(indev);
|
||||||
|
}
|
||||||
|
/* Re-enable inputs after 1500 ms */
|
||||||
|
lv_timer_create(reenable_input_cb, 1500, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
lvgl_unlock();
|
lvgl_unlock();
|
||||||
|
|||||||
@@ -2526,7 +2526,7 @@ CONFIG_LV_USE_GRID=y
|
|||||||
# CONFIG_LV_USE_FS_WIN32 is not set
|
# CONFIG_LV_USE_FS_WIN32 is not set
|
||||||
# CONFIG_LV_USE_FS_FATFS is not set
|
# CONFIG_LV_USE_FS_FATFS is not set
|
||||||
# CONFIG_LV_USE_FS_LITTLEFS is not set
|
# CONFIG_LV_USE_FS_LITTLEFS is not set
|
||||||
CONFIG_LV_USE_PNG=y
|
# CONFIG_LV_USE_PNG is not set
|
||||||
# CONFIG_LV_USE_BMP is not set
|
# CONFIG_LV_USE_BMP is not set
|
||||||
# CONFIG_LV_USE_SJPG is not set
|
# CONFIG_LV_USE_SJPG is not set
|
||||||
CONFIG_LV_USE_GIF=y
|
CONFIG_LV_USE_GIF=y
|
||||||
|
|||||||
2777
sdkconfig.old
Normal file
2777
sdkconfig.old
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user