Remove GIF decoder and add swipe gesture support
Deleted GIF decoder files (app_gifdec.c/h) and blink emotion asset. Added swipe_gesture.c/h for new gesture handling. Updated CMakeLists and emotion_manager to reflect these changes. Added Geist font asset.
This commit is contained in:
65
main/main.c
65
main/main.c
@@ -43,6 +43,7 @@
|
||||
/* Project Assets */
|
||||
#include "../assets/logoIroScreen.c"
|
||||
#include "emotion_manager.h"
|
||||
#include "swipe_gesture.h"
|
||||
|
||||
// Emotions handled by emotion_manager
|
||||
|
||||
@@ -206,7 +207,8 @@ static void start_watch_face(void) {
|
||||
|
||||
/* Initialize Emotion Manager */
|
||||
emotion_manager_init(scr);
|
||||
|
||||
/* Initialize swipe gesture handling */
|
||||
swipe_gesture_init(scr);
|
||||
/* Load the watch face screen immediately */
|
||||
lv_scr_load(scr);
|
||||
}
|
||||
@@ -397,9 +399,11 @@ static void ui_task(void *arg) {
|
||||
|
||||
/* Process Event Queue */
|
||||
ui_event_t ev;
|
||||
/*
|
||||
if (xQueueReceive(g_event_queue, &ev, 0) == pdTRUE) {
|
||||
/* Handle UI events here */
|
||||
// Handle UI events here
|
||||
}
|
||||
*/
|
||||
|
||||
lvgl_unlock();
|
||||
}
|
||||
@@ -417,7 +421,7 @@ static void ui_task(void *arg) {
|
||||
* ------------------------------------------------------------------------- */
|
||||
|
||||
void app_main(void) {
|
||||
esp_log_level_set("lcd_panel.io.i2c", ESP_LOG_INFO);
|
||||
esp_log_level_set("lcd_panel.io.i2c", ESP_LOG_DEBUG);
|
||||
esp_log_level_set("FT5x06", ESP_LOG_DEBUG);
|
||||
esp_log_level_set("esp_lcd_touch", ESP_LOG_DEBUG);
|
||||
|
||||
@@ -430,12 +434,29 @@ void app_main(void) {
|
||||
.sda_pullup_en = GPIO_PULLUP_ENABLE,
|
||||
.scl_io_num = PIN_NUM_TOUCH_SCL,
|
||||
.scl_pullup_en = GPIO_PULLUP_ENABLE,
|
||||
.master.clk_speed = 100 * 1000,
|
||||
.master.clk_speed = 200 * 1000,
|
||||
};
|
||||
|
||||
ESP_ERROR_CHECK(i2c_param_config(TOUCH_HOST, &i2c_conf));
|
||||
ESP_ERROR_CHECK(i2c_driver_install(TOUCH_HOST, i2c_conf.mode, 0, 0, 0));
|
||||
|
||||
/* Run a quick I2C scan to list devices on the bus for diagnostics */
|
||||
{
|
||||
ESP_LOGI("I2C_SCAN", "Starting I2C scan on port %d", TOUCH_HOST);
|
||||
for (int addr = 1; addr < 0x7F; addr++) {
|
||||
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
|
||||
i2c_master_start(cmd);
|
||||
i2c_master_write_byte(cmd, (addr << 1) | I2C_MASTER_WRITE, true);
|
||||
i2c_master_stop(cmd);
|
||||
esp_err_t ret = i2c_master_cmd_begin(TOUCH_HOST, cmd, pdMS_TO_TICKS(50));
|
||||
i2c_cmd_link_delete(cmd);
|
||||
if (ret == ESP_OK) {
|
||||
ESP_LOGI("I2C_SCAN", "Found device at 0x%02X", addr);
|
||||
}
|
||||
}
|
||||
ESP_LOGI("I2C_SCAN", "I2C scan complete");
|
||||
}
|
||||
|
||||
/* IO Expander Setup */
|
||||
esp_io_expander_handle_t io_expander = NULL;
|
||||
ESP_ERROR_CHECK(esp_io_expander_new_i2c_tca9554(
|
||||
@@ -445,17 +466,15 @@ void app_main(void) {
|
||||
IO_EXPANDER_PIN_NUM_2,
|
||||
IO_EXPANDER_OUTPUT);
|
||||
|
||||
/* Vendor Init Sequence: Toggle all pins Low -> High with 200ms delay */
|
||||
esp_io_expander_set_level(io_expander, IO_EXPANDER_PIN_NUM_0, 0);
|
||||
esp_io_expander_set_level(io_expander, IO_EXPANDER_PIN_NUM_1, 0);
|
||||
esp_io_expander_set_level(io_expander, IO_EXPANDER_PIN_NUM_2, 0);
|
||||
vTaskDelay(pdMS_TO_TICKS(200));
|
||||
esp_io_expander_set_level(io_expander, IO_EXPANDER_PIN_NUM_0, 1);
|
||||
esp_io_expander_set_level(io_expander, IO_EXPANDER_PIN_NUM_1, 1);
|
||||
|
||||
/* Hard Reset Touch via IO Expander */
|
||||
esp_io_expander_set_level(io_expander, IO_EXPANDER_PIN_NUM_2, 0);
|
||||
vTaskDelay(pdMS_TO_TICKS(20));
|
||||
esp_io_expander_set_level(io_expander, IO_EXPANDER_PIN_NUM_2, 1);
|
||||
/* Add delay to allow Touch IC to wake up and stabilize after reset high */
|
||||
vTaskDelay(pdMS_TO_TICKS(200));
|
||||
|
||||
/* LCD Setup */
|
||||
@@ -488,21 +507,37 @@ void app_main(void) {
|
||||
ESP_ERROR_CHECK(esp_lcd_panel_init(lcd_panel));
|
||||
ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(lcd_panel, true));
|
||||
|
||||
/* Touch Driver Setup (FT5x06) */
|
||||
#if USE_TOUCH
|
||||
esp_lcd_panel_io_handle_t tp_io_handle = NULL;
|
||||
const esp_lcd_panel_io_i2c_config_t tp_io_config =
|
||||
|
||||
/* Overriding default address (usually 0x38) with 0x34 found in scan */
|
||||
esp_lcd_panel_io_i2c_config_t tp_io_config =
|
||||
ESP_LCD_TOUCH_IO_I2C_FT5x06_CONFIG();
|
||||
tp_io_config.dev_addr = 0x34;
|
||||
|
||||
ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)TOUCH_HOST,
|
||||
&tp_io_config, &tp_io_handle));
|
||||
|
||||
const esp_lcd_touch_config_t tp_cfg = {
|
||||
.x_max = LCD_H_RES,
|
||||
.y_max = LCD_V_RES,
|
||||
.rst_gpio_num = PIN_NUM_TOUCH_RST,
|
||||
esp_lcd_touch_config_t tp_cfg = {
|
||||
.x_max = 368,
|
||||
.y_max = 448,
|
||||
.rst_gpio_num = -1, // Reset handled by IO Expander logic above
|
||||
.int_gpio_num = PIN_NUM_TOUCH_INT,
|
||||
.levels = {.reset = 0, .interrupt = 0},
|
||||
.flags = {.swap_xy = 0, .mirror_x = 0, .mirror_y = 0},
|
||||
.levels =
|
||||
{
|
||||
.reset = 0,
|
||||
.interrupt = 0,
|
||||
},
|
||||
.flags =
|
||||
{
|
||||
.swap_xy = 0,
|
||||
.mirror_x = 0,
|
||||
.mirror_y = 0,
|
||||
},
|
||||
};
|
||||
|
||||
esp_lcd_touch_handle_t tp = NULL;
|
||||
ESP_ERROR_CHECK(esp_lcd_touch_new_i2c_ft5x06(tp_io_handle, &tp_cfg, &tp));
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user